Skip to content

Commit

Permalink
nix: Build static executable on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgangwalther committed Jan 26, 2024
1 parent 1ac5a04 commit d1ceffb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/cachix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,11 @@ jobs:
postgrest-push-cachix
- name: Seed static toolchain
if: matrix.os == 'Linux'
run: |
nix-build -A packagesStatic.hello
postgrest-push-cachix
- name: Seed static postgrest build
if: matrix.os == 'Linux'
run: |
nix-build -A postgrestStatic
postgrest-push-cachix
Expand Down
36 changes: 19 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,22 @@ jobs:


Build-Static-Nix:
name: Build Linux static (Nix)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: Linux
runs-on: ubuntu-latest
artifact: postgrest-linux-static-x64
docker: postgrest-linux-docker-x64

- name: MacOS
runs-on: macos-latest
artifact: postgrest-macos-static-x64
docker: postgrest-macos-docker-x64

name: Build ${{ matrix.name }} static (Nix)
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- name: Setup Nix Environment
Expand All @@ -139,7 +153,7 @@ jobs:
- name: Save built executable as artifact
uses: actions/upload-artifact@v4
with:
name: postgrest-linux-static-x64
name: ${{ matrix.artifact }}
path: result/bin/postgrest
if-no-files-found: error

Expand All @@ -148,22 +162,10 @@ jobs:
- name: Save built Docker image as artifact
uses: actions/upload-artifact@v4
with:
name: postgrest-docker-x64
name: ${{ matrix.docker }}
path: postgrest-docker.tar.gz
if-no-files-found: error

Build-Macos-Nix:
name: Build MacOS (Nix)
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Nix Environment
uses: ./.github/actions/setup-nix

- name: Build everything
run: |
nix-build

Build-Stack:
strategy:
Expand Down Expand Up @@ -476,7 +478,7 @@ jobs:
- name: Download Docker image
uses: actions/download-artifact@v4
with:
name: postgrest-docker-x64
name: postgrest-linux-docker-x64
- name: Publish images on Docker Hub
run: |
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ rec {
inherit (pkgs.haskell.packages."${compiler}") hpc-codecov;
inherit (pkgs.haskell.packages."${compiler}") weeder;
};
} // pkgs.lib.optionalAttrs pkgs.stdenv.isLinux rec {

# Static executable.
inherit (staticHaskellPackage) postgrestStatic;
inherit (staticHaskellPackage) packagesStatic;
Expand Down

0 comments on commit d1ceffb

Please sign in to comment.