Skip to content

Commit

Permalink
chore: adding support for x86_64-darwin (#1310)
Browse files Browse the repository at this point in the history
* chore: adding support for x86_64-darwin

* fix: handle logic for various darwin platforms

* fix: != &&,  == ||

* fix: support system here too

* feature: support added for x86_64-darwin

* fix: increase timeout so that aws access does not expire

* fix: duration was too high

* chore: see if 2 hours will work

* fix: try more than 2 less than 3 hrs

* chore: try a bit lower

* chore: bump down lower

* chore: set to the apparent max

* chore: limit nix build to 15 on x86_64-darwin

---------

Co-authored-by: Sam Rose <[email protected]>
  • Loading branch information
samrose and samrose authored Nov 7, 2024
1 parent c2c383b commit 9edaf28
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ jobs:
arch: arm64
- runner: macos-latest
arch: arm64
- runner: macos-13
arch: amd64
runs-on: ${{ matrix.runner }}

timeout-minutes: 180
steps:

- name: Check out code
Expand All @@ -40,30 +42,31 @@ jobs:
role-to-assume: ${{ secrets.DEV_AWS_ROLE }}
aws-region: "us-east-1"
output-credentials: true
role-duration-seconds: 7200
- name: write secret key
# use python so we don't interpolate the secret into the workflow logs, in case of bugs
run: |
python -c "import os; file = open('nix-secret-key', 'w'); file.write(os.environ['NIX_SIGN_SECRET_KEY']); file.close()"
env:
NIX_SIGN_SECRET_KEY: ${{ secrets.NIX_SIGN_SECRET_KEY }}
- name: Log in to Docker Hub
if: matrix.runner != 'macos-latest'
if: matrix.runner != 'macos-latest' && matrix.runner != 'macos-13'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build psql bundle with nix
if: matrix.runner != 'macos-latest'
if: matrix.runner != 'macos-latest' && matrix.runner != 'macos-13'
run: docker build -t base_nix -f docker/nix/Dockerfile .
- name: Run build psql bundle
if: matrix.runner != 'macos-latest'
if: matrix.runner != 'macos-latest' && matrix.runner != 'macos-13'
run: |
docker run -e AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }} \
-e AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }} \
-e AWS_SESSION_TOKEN=${{ env.AWS_SESSION_TOKEN }} \
base_nix bash -c "./workspace/docker/nix/build_nix.sh"
- name: Build psql bundle on macos
if: matrix.runner == 'macos-latest'
if: matrix.runner == 'macos-latest' || matrix.runner == 'macos-13'
run: |
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-confirm \
--extra-conf "substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com" \
Expand Down
4 changes: 2 additions & 2 deletions ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ postgres_major:

# Full version strings for each major version
postgres_release:
postgres15: "15.8.1.006"
postgres16: "16.3.1.012"
postgres15: "15.8.1.007"
postgres16: "16.3.1.013"

# Non Postgres Extensions
pgbouncer_release: "1.19.0"
Expand Down
18 changes: 12 additions & 6 deletions docker/nix/build_nix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ nix --version
if [ -d "/workspace" ]; then
cd /workspace
fi
nix build .#checks.$(nix-instantiate --eval -E builtins.currentSystem | tr -d '"').psql_15 -L --no-link
nix build .#checks.$(nix-instantiate --eval -E builtins.currentSystem | tr -d '"').psql_16 -L --no-link
nix build .#psql_15/bin -o psql_15
nix build .#psql_16/bin -o psql_16
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_15
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_16
if [ $(nix-instantiate --eval -E builtins.currentSystem | tr -d '"') == "x86_64-darwin" ]; then
nix build .#checks.$(nix-instantiate --eval -E builtins.currentSystem | tr -d '"').psql_15 -L --no-link
nix build .#psql_15/bin -o psql_15
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_15
else
nix build .#checks.$(nix-instantiate --eval -E builtins.currentSystem | tr -d '"').psql_15 -L --no-link
nix build .#checks.$(nix-instantiate --eval -E builtins.currentSystem | tr -d '"').psql_16 -L --no-link
nix build .#psql_15/bin -o psql_15
nix build .#psql_16/bin -o psql_16
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_15
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_16
fi
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
system.x86_64-linux
system.aarch64-linux
system.aarch64-darwin
system.x86_64-darwin
];
in
flake-utils.lib.eachSystem ourSystems (system:
Expand Down
2 changes: 1 addition & 1 deletion nix/ext/plv8.nix
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ stdenv.mkDerivation (finalAttrs: {
description = "V8 Engine Javascript Procedural Language add-on for PostgreSQL";
homepage = "https://plv8.github.io/";
maintainers = with maintainers; [ samrose ];
platforms = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
platforms = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
license = licenses.postgresql;
};
})

0 comments on commit 9edaf28

Please sign in to comment.