From e04521b96a343853b4120c51ea308074ee6dc210 Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Mon, 21 Sep 2026 13:43:25 -0400 Subject: [PATCH 1/3] ci/test: Clean up unnecessary/dead steps I noticed that there was a bunch of dead code here so delete it. dbmate-tool doesn't need hcl files nor ARGS/result so those go away. The steps creating POSTGRES_MAJOR_VERSION and PGMAJOR were also completely unnecessary as the output from prepare step/matrix value is usable as is, I decided to rename it so it uses the common named used throughout the repo for consistency. --- .github/workflows/test.yml | 45 ++++++-------------------------------- 1 file changed, 7 insertions(+), 38 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c484a295eb..772efc8194 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: prepare: runs-on: blacksmith-4vcpu-ubuntu-2404 outputs: - postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }} + postgres_major_versions: ${{ steps.set-versions.outputs.postgres_major_versions }} steps: - name: Checkout Repo uses: supabase/postgres/.github/actions/shared-checkout@HEAD @@ -20,18 +20,13 @@ jobs: id: set-versions run: | VERSIONS=$(nix run nixpkgs#yq-go -- -o=json -I=0 '.postgres_major' ansible/vars.yml) - echo "postgres_versions=$VERSIONS" >> $GITHUB_OUTPUT + echo "postgres_major_versions=$VERSIONS" >> $GITHUB_OUTPUT build: needs: prepare strategy: matrix: - postgres_version: ${{ fromJson(needs.prepare.outputs.postgres_versions) }} - include: - - runner: large-linux-x86 - arch: amd64 - - runner: large-linux-arm - arch: arm64 - runs-on: ${{ matrix.runner }} + postgres_major_version: ${{ fromJson(needs.gen-matrix.outputs.postgres_major_versions) }} + runs-on: blacksmith-4vcpu-ubuntu-2404 timeout-minutes: 180 env: POSTGRES_PORT: 5478 @@ -42,32 +37,6 @@ jobs: - uses: ./.github/actions/nix-install-ephemeral - - name: Set PostgreSQL version environment variable - run: echo "POSTGRES_MAJOR_VERSION=${{ matrix.postgres_version }}" >> $GITHUB_ENV - - - name: Strip quotes from pg major and set env var - run: | - stripped_version=$(echo "${{ matrix.postgres_version }}" | sed 's/^"\(.*\)"$/\1/') - echo "PGMAJOR=$stripped_version" >> $GITHUB_ENV - - - name: Generate common-nix.vars.pkr.hcl - run: | - PG_VERSION=$(nix run nixpkgs#yq-go -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml) - PG_VERSION=$(echo $PG_VERSION | tr -d '"') # Remove any surrounding quotes - echo 'postgres-version = "'$PG_VERSION'"' > common-nix.vars.pkr.hcl - echo "" >> common-nix.vars.pkr.hcl - - - id: settings - run: sed -r 's/(\s|\")+//g' common-nix.vars.pkr.hcl >> $GITHUB_OUTPUT - - - name: Generate args - id: args - run: | - ARGS=$(nix run nixpkgs#yq-go -- 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' ansible/vars.yml) - echo "result<> $GITHUB_OUTPUT - echo "$ARGS" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - name: Resolve git sha id: resolve-git-sha uses: ./.github/actions/resolve-git-sha @@ -76,9 +45,9 @@ jobs: - name: verify schema.sql is committed run: | - nix run github:supabase/postgres/${{ steps.resolve-git-sha.outputs.sha }}#dbmate-tool -- --version ${{ env.PGMAJOR }} --flake-url github:supabase/postgres/${{ steps.resolve-git-sha.outputs.sha }} - if ! git diff --exit-code --quiet migrations/schema-${{ env.PGMAJOR }}.sql; then + nix run github:supabase/postgres/${{ steps.resolve-git-sha.outputs.sha }}#dbmate-tool -- --version ${{ matrix.postgres_major_version }} --flake-url github:supabase/postgres/${{ steps.resolve-git-sha.outputs.sha }} + if ! git diff --exit-code --quiet migrations/schema-${{ matrix.postgres_major_version }}.sql; then echo "Detected changes in schema.sql:" - git diff migrations/schema-${{ env.PGMAJOR }}.sql + git diff migrations/schema-${{ matrix.postgres_major_version }}.sql exit 1 fi From d243aa9db8e24e604a6739ea829f49a4b1ecb0f2 Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Mon, 21 Sep 2026 14:29:19 -0400 Subject: [PATCH 2/3] ci/docker-image-test: Make worflow_call only No point running this on its own *and* as part of nix-build so lets drop the non-workflow-call cases. --- .github/workflows/docker-image-test.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/docker-image-test.yml b/.github/workflows/docker-image-test.yml index b8eb0fc4c0..d2c9c2c060 100644 --- a/.github/workflows/docker-image-test.yml +++ b/.github/workflows/docker-image-test.yml @@ -1,12 +1,6 @@ name: Docker Image Test on: - pull_request: - types: [opened, reopened, synchronize] - push: - branches: - - develop - - release/* workflow_call: secrets: DEV_AWS_ROLE: @@ -121,14 +115,3 @@ jobs: docker ps -a --filter "name=pg-test-${{ matrix.name }}" -q | xargs -r docker rm -f || true docker rmi "pg-docker-test:${{ matrix.name }}" || true docker rmi "supabase-postgres:${{ matrix.name }}-analyze" || true - - skip-notification: - name: Docker Image Test (Skipped) - needs: check-changes - if: needs.check-changes.outputs.should_run == 'false' - runs-on: ubuntu-latest - steps: - - name: Report skipped - run: | - echo "Docker image tests skipped - inputs unchanged" - echo "Input hash: ${{ needs.check-changes.outputs.input_hash }}" From 8be299d1dd766f4e39a6ad59aae73a4299377118 Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Mon, 21 Sep 2026 13:43:25 -0400 Subject: [PATCH 3/3] ci/nix-build & co: Use better job/step names All these names have a long common prefix which means the GHA UI truncates the most interesting information. So I'm renaming these so the Summary view is more informative at a glance. I also tweaked some `needs` that didn't really need to be explicit. --- .github/workflows/docker-image-test.yml | 2 +- .github/workflows/nix-build.yml | 118 ++++++++++------------ .github/workflows/test.yml | 6 +- .github/workflows/testinfra-ami-build.yml | 4 +- 4 files changed, 57 insertions(+), 73 deletions(-) diff --git a/.github/workflows/docker-image-test.yml b/.github/workflows/docker-image-test.yml index d2c9c2c060..29df0903f2 100644 --- a/.github/workflows/docker-image-test.yml +++ b/.github/workflows/docker-image-test.yml @@ -21,7 +21,7 @@ permissions: jobs: check-changes: - name: Check Docker Image Changes + name: skippable runs-on: blacksmith-2vcpu-ubuntu-2404 outputs: should_run: ${{ steps.check.outputs.should_run }} diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml index e286015cca..856526bdf2 100644 --- a/.github/workflows/nix-build.yml +++ b/.github/workflows/nix-build.yml @@ -19,7 +19,7 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - nix-eval: + eval: runs-on: blacksmith-32vcpu-ubuntu-2404 outputs: packages_matrix: ${{ steps.gen-matrix.outputs.packages_matrix }} @@ -46,17 +46,15 @@ jobs: sudo pkill -9 nix-daemon || true sleep 2 - nix-build-packages-aarch64-linux: - name: >- - ${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }} - (aarch64-linux) - needs: nix-eval + builds-aarch64-linux: + name: ${{ matrix.name }}${{ matrix.postgresql_version || '' }} + needs: eval runs-on: ${{ matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }} - if: ${{ fromJSON(needs.nix-eval.outputs.packages_matrix).aarch64_linux != null }} + if: ${{ fromJSON(needs.eval.outputs.packages_matrix).aarch64_linux != null }} strategy: fail-fast: false max-parallel: 25 - matrix: ${{ fromJSON(needs.nix-eval.outputs.packages_matrix).aarch64_linux }} + matrix: ${{ fromJSON(needs.eval.outputs.packages_matrix).aarch64_linux }} steps: - name: Checkout Repo if: ${{ matrix.attr != '' }} @@ -74,19 +72,17 @@ jobs: with: attr: .#${{ matrix.attr }} - nix-build-checks-aarch64-linux: - name: >- - ${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }} - (aarch64-linux) + checks-aarch64-linux: + name: ${{ matrix.name }}${{ matrix.postgresql_version || '' }} needs: - - nix-eval - - nix-build-packages-aarch64-linux + - eval + - builds-aarch64-linux runs-on: ${{ matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }} - if: ${{ fromJSON(needs.nix-eval.outputs.checks_matrix).aarch64_linux != null }} + if: ${{ fromJSON(needs.eval.outputs.checks_matrix).aarch64_linux != null }} strategy: fail-fast: false max-parallel: 25 - matrix: ${{ fromJSON(needs.nix-eval.outputs.checks_matrix).aarch64_linux }} + matrix: ${{ fromJSON(needs.eval.outputs.checks_matrix).aarch64_linux }} steps: - name: Checkout Repo if: ${{ matrix.attr != '' }} @@ -104,17 +100,15 @@ jobs: with: attr: .#${{ matrix.attr }} - nix-build-packages-aarch64-darwin: - name: >- - ${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }} - (aarch64-darwin) - needs: nix-eval + builds-aarch64-darwin: + name: ${{ matrix.name }}${{ matrix.postgresql_version || '' }} + needs: eval runs-on: ${{ matrix.attr != '' && matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }} - if: ${{ fromJSON(needs.nix-eval.outputs.packages_matrix).aarch64_darwin != null }} + if: ${{ fromJSON(needs.eval.outputs.packages_matrix).aarch64_darwin != null }} strategy: fail-fast: false max-parallel: 25 - matrix: ${{ fromJSON(needs.nix-eval.outputs.packages_matrix).aarch64_darwin }} + matrix: ${{ fromJSON(needs.eval.outputs.packages_matrix).aarch64_darwin }} steps: - name: Checkout Repo if: ${{ matrix.attr != '' }} @@ -135,19 +129,17 @@ jobs: with: attr: .#${{ matrix.attr }} - nix-build-checks-aarch64-darwin: - name: >- - ${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }} - (aarch64-darwin) + checks-aarch64-darwin: + name: ${{ matrix.name }}${{ matrix.postgresql_version || '' }} needs: - - nix-eval - - nix-build-packages-aarch64-darwin + - eval + - builds-aarch64-darwin runs-on: ${{ matrix.attr != '' && matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }} - if: ${{ fromJSON(needs.nix-eval.outputs.checks_matrix).aarch64_darwin != null }} + if: ${{ fromJSON(needs.eval.outputs.checks_matrix).aarch64_darwin != null }} strategy: fail-fast: false max-parallel: 25 - matrix: ${{ fromJSON(needs.nix-eval.outputs.checks_matrix).aarch64_darwin }} + matrix: ${{ fromJSON(needs.eval.outputs.checks_matrix).aarch64_darwin }} steps: - name: Checkout Repo if: ${{ matrix.attr != '' }} @@ -165,17 +157,15 @@ jobs: with: attr: .#${{ matrix.attr }} - nix-build-packages-x86_64-linux: - name: >- - ${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }} - (x86_64-linux) - needs: nix-eval + builds-x86_64-linux: + name: ${{ matrix.name }}${{ matrix.postgresql_version || '' }} + needs: eval runs-on: ${{ matrix.attr != '' && matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }} - if: ${{ fromJSON(needs.nix-eval.outputs.packages_matrix).x86_64_linux != null }} + if: ${{ fromJSON(needs.eval.outputs.packages_matrix).x86_64_linux != null }} strategy: fail-fast: false max-parallel: 25 - matrix: ${{ fromJSON(needs.nix-eval.outputs.packages_matrix).x86_64_linux }} + matrix: ${{ fromJSON(needs.eval.outputs.packages_matrix).x86_64_linux }} steps: - name: Checkout Repo if: ${{ matrix.attr != '' }} @@ -193,19 +183,17 @@ jobs: with: attr: .#${{ matrix.attr }} - nix-build-checks-x86_64-linux: - name: >- - ${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }} - (x86_64-linux) + checks-x86_64-linux: + name: ${{ matrix.name }}${{ matrix.postgresql_version || '' }} needs: - - nix-eval - - nix-build-packages-x86_64-linux + - eval + - builds-x86_64-linux runs-on: ${{ matrix.attr != '' && matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }} - if: ${{ fromJSON(needs.nix-eval.outputs.checks_matrix).x86_64_linux != null }} + if: ${{ fromJSON(needs.eval.outputs.checks_matrix).x86_64_linux != null }} strategy: fail-fast: false max-parallel: 25 - matrix: ${{ fromJSON(needs.nix-eval.outputs.checks_matrix).x86_64_linux }} + matrix: ${{ fromJSON(needs.eval.outputs.checks_matrix).x86_64_linux }} steps: - name: Checkout Repo if: ${{ matrix.attr != '' }} @@ -223,13 +211,13 @@ jobs: with: attr: .#${{ matrix.attr }} - nix-build-checks: + checks: name: Nix Checks ✅ runs-on: blacksmith-2vcpu-ubuntu-2404 needs: - - nix-build-checks-aarch64-darwin - - nix-build-checks-aarch64-linux - - nix-build-checks-x86_64-linux + - checks-aarch64-darwin + - checks-aarch64-linux + - checks-x86_64-linux steps: - name: Check dependent job results if: contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') @@ -237,41 +225,37 @@ jobs: jq -rn --argjson needs '${{ toJSON(needs) }}' '$needs|to_entries[]|select(.value.result!="success")|"::error::"+.key+": "+.value.result' exit 1 - run-testinfra: + amis: needs: - - nix-eval - - nix-build-packages-aarch64-linux - - nix-build-packages-aarch64-darwin - - nix-build-packages-x86_64-linux + - builds-aarch64-linux + - builds-x86_64-linux uses: ./.github/workflows/testinfra-ami-build.yml secrets: DEV_AWS_ROLE: ${{ secrets.DEV_AWS_ROLE }} NIX_SIGN_SECRET_KEY: ${{ secrets.NIX_SIGN_SECRET_KEY }} - run-tests: + schema: needs: - - nix-eval - - nix-build-packages-aarch64-linux - - nix-build-packages-aarch64-darwin - - nix-build-packages-x86_64-linux + - builds-aarch64-linux + - builds-x86_64-linux uses: ./.github/workflows/test.yml - docker-image-test: - needs: nix-build-packages-aarch64-linux + containers: + needs: builds-aarch64-linux uses: ./.github/workflows/docker-image-test.yml secrets: DEV_AWS_ROLE: ${{ secrets.DEV_AWS_ROLE }} NIX_SIGN_SECRET_KEY: ${{ secrets.NIX_SIGN_SECRET_KEY }} - nix-ci-check: + check: name: Nix CI ✅ if: always() runs-on: blacksmith-2vcpu-ubuntu-2404 needs: - - docker-image-test - - nix-build-checks - - run-testinfra - - run-tests + - amis + - checks + - containers + - schema steps: - name: Check dependent job results if: contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 772efc8194..1170b46b64 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ permissions: id-token: write jobs: - prepare: + gen-matrix: runs-on: blacksmith-4vcpu-ubuntu-2404 outputs: postgres_major_versions: ${{ steps.set-versions.outputs.postgres_major_versions }} @@ -21,8 +21,8 @@ jobs: run: | VERSIONS=$(nix run nixpkgs#yq-go -- -o=json -I=0 '.postgres_major' ansible/vars.yml) echo "postgres_major_versions=$VERSIONS" >> $GITHUB_OUTPUT - build: - needs: prepare + verify: + needs: gen-matrix strategy: matrix: postgres_major_version: ${{ fromJson(needs.gen-matrix.outputs.postgres_major_versions) }} diff --git a/.github/workflows/testinfra-ami-build.yml b/.github/workflows/testinfra-ami-build.yml index 7288358399..bacc6ed63a 100644 --- a/.github/workflows/testinfra-ami-build.yml +++ b/.github/workflows/testinfra-ami-build.yml @@ -36,7 +36,7 @@ jobs: VERSIONS=$(nix run nixpkgs#yq-go -- -o=json -I=0 '.postgres_major' ansible/vars.yml) echo "postgres_versions=$VERSIONS" >> "$GITHUB_OUTPUT" - test-ami-nix: + build: needs: gen-matrix strategy: fail-fast: false @@ -190,7 +190,7 @@ jobs: fi report-disk-usage: - needs: test-ami-nix + needs: build runs-on: blacksmith-2vcpu-ubuntu-2404 steps: - name: Download AMI disk usage