From 9edaf28580348324f8b3b6970b1a31a4f5b7f8ca Mon Sep 17 00:00:00 2001 From: samrose Date: Wed, 6 Nov 2024 20:38:55 -0500 Subject: [PATCH] chore: adding support for x86_64-darwin (#1310) * 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 --- .github/workflows/nix-build.yml | 13 ++++++++----- ansible/vars.yml | 4 ++-- docker/nix/build_nix.sh | 18 ++++++++++++------ flake.nix | 1 + nix/ext/plv8.nix | 2 +- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml index 08c316bce..473579875 100644 --- a/.github/workflows/nix-build.yml +++ b/.github/workflows/nix-build.yml @@ -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 @@ -40,6 +42,7 @@ 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: | @@ -47,23 +50,23 @@ jobs: 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" \ diff --git a/ansible/vars.yml b/ansible/vars.yml index da1b61704..1017ef18c 100644 --- a/ansible/vars.yml +++ b/ansible/vars.yml @@ -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" diff --git a/docker/nix/build_nix.sh b/docker/nix/build_nix.sh index 3cf8505c0..5a7896a46 100644 --- a/docker/nix/build_nix.sh +++ b/docker/nix/build_nix.sh @@ -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 diff --git a/flake.nix b/flake.nix index 615df5da5..f1cff1abd 100644 --- a/flake.nix +++ b/flake.nix @@ -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: diff --git a/nix/ext/plv8.nix b/nix/ext/plv8.nix index 785f5e601..a331a1127 100644 --- a/nix/ext/plv8.nix +++ b/nix/ext/plv8.nix @@ -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; }; })