Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions .github/workflows/docker-image-test.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -27,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 }}
Expand Down Expand Up @@ -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 }}"
118 changes: 51 additions & 67 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 != '' }}
Expand All @@ -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 != '' }}
Expand All @@ -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 != '' }}
Expand All @@ -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 != '' }}
Expand All @@ -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 != '' }}
Expand All @@ -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 != '' }}
Expand All @@ -223,55 +211,51 @@ 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Darwin run; Thought it was excluded in the previous PR? 🤔

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

darwin is also excluded from the amis list below

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checks-aarch64-darwin is for the nix checks, which we do run for all 3 flavors. This is stuff like linters, formatters, nixosVMTests etc. If you are referring to #2477, whats being skipped there is nixos-tests for aarch64-darwin which are the qemu based nixos vm tests. No point doing those I guess.

Darwin being excluded from amis is correct too, we don't build darwin AMIs. The needs was dropped because there's no reason to depend on darwin binaries if they aren't going to be used in the AMIs.

- 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')
run: |
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')
Expand Down
51 changes: 10 additions & 41 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ permissions:
id-token: write

jobs:
prepare:
gen-matrix:
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
Expand All @@ -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
build:
needs: prepare
echo "postgres_major_versions=$VERSIONS" >> $GITHUB_OUTPUT
verify:
needs: gen-matrix
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
Expand All @@ -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<<EOF" >> $GITHUB_OUTPUT
echo "$ARGS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Resolve git sha
id: resolve-git-sha
uses: ./.github/actions/resolve-git-sha
Expand All @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/testinfra-ami-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading