@@ -14,77 +14,201 @@ permissions:
1414 contents : write
1515 packages : write
1616
17- concurrency :
18- group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19- cancel-in-progress : ${{ github.event_name == 'pull_request' }}
20-
2117jobs :
22- build-run-image :
18+ nix-eval :
19+ uses : ./.github/workflows/nix-eval.yml
20+ secrets :
21+ DEV_AWS_ROLE : ${{ secrets.DEV_AWS_ROLE }}
22+ NIX_SIGN_SECRET_KEY : ${{ secrets.NIX_SIGN_SECRET_KEY }}
23+
24+ nix-build-packages-aarch64-linux :
25+ name : >-
26+ ${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }}
27+ (aarch64-linux)
28+ needs : nix-eval
29+ runs-on : ${{ matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }}
30+ if : ${{ fromJSON(needs.nix-eval.outputs.packages_matrix).aarch64_linux != null }}
31+ strategy :
32+ fail-fast : false
33+ max-parallel : 5
34+ matrix : ${{ fromJSON(needs.nix-eval.outputs.packages_matrix).aarch64_linux }}
35+ steps :
36+ - name : Checkout Repo
37+ if : ${{ matrix.attr != '' }}
38+ uses : actions/checkout@v4
39+ - name : Install nix (ephemeral)
40+ if : ${{ matrix.attr != '' && matrix.runs_on.group != 'self-hosted-runners-nix' }}
41+ uses : ./.github/actions/nix-install-ephemeral
42+ with :
43+ push-to-cache : ' true'
44+ env :
45+ DEV_AWS_ROLE : ${{ secrets.DEV_AWS_ROLE }}
46+ NIX_SIGN_SECRET_KEY : ${{ secrets.NIX_SIGN_SECRET_KEY }}
47+ - name : Install nix (self-hosted)
48+ if : ${{ matrix.attr != '' && matrix.runs_on.group == 'self-hosted-runners-nix' }}
49+ uses : ./.github/actions/nix-install-self-hosted
50+ - name : nix build
51+ if : ${{ matrix.attr != '' }}
52+ shell : bash
53+ run : nix build --accept-flake-config -L .#${{ matrix.attr }}
54+
55+ nix-build-checks-aarch64-linux :
56+ name : >-
57+ ${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }}
58+ (aarch64-linux)
59+ needs : [nix-eval, nix-build-packages-aarch64-linux]
60+ runs-on : ${{ matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }}
61+ if : ${{ fromJSON(needs.nix-eval.outputs.checks_matrix).aarch64_linux != null }}
62+ strategy :
63+ fail-fast : false
64+ max-parallel : 5
65+ matrix : ${{ fromJSON(needs.nix-eval.outputs.checks_matrix).aarch64_linux }}
66+ steps :
67+ - name : Checkout Repo
68+ if : ${{ matrix.attr != '' }}
69+ uses : actions/checkout@v4
70+ - name : Install nix (ephemeral)
71+ if : ${{ matrix.attr != '' && matrix.runs_on.group != 'self-hosted-runners-nix' }}
72+ uses : ./.github/actions/nix-install-ephemeral
73+ with :
74+ push-to-cache : ' true'
75+ env :
76+ DEV_AWS_ROLE : ${{ secrets.DEV_AWS_ROLE }}
77+ NIX_SIGN_SECRET_KEY : ${{ secrets.NIX_SIGN_SECRET_KEY }}
78+ - name : Install nix (self-hosted)
79+ if : ${{ matrix.attr != '' && matrix.runs_on.group == 'self-hosted-runners-nix' }}
80+ uses : ./.github/actions/nix-install-self-hosted
81+ - name : nix build
82+ if : ${{ matrix.attr != '' }}
83+ shell : bash
84+ run : nix build --accept-flake-config -L .#${{ matrix.attr }}
85+
86+ nix-build-packages-aarch64-darwin :
87+ name : >-
88+ ${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }}
89+ (aarch64-darwin)
90+ needs : nix-eval
91+ runs-on : ${{ matrix.attr != '' && matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }}
92+ if : ${{ fromJSON(needs.nix-eval.outputs.packages_matrix).aarch64_darwin != null }}
93+ strategy :
94+ fail-fast : false
95+ max-parallel : 5
96+ matrix : ${{ fromJSON(needs.nix-eval.outputs.packages_matrix).aarch64_darwin }}
97+ steps :
98+ - name : Checkout Repo
99+ if : ${{ matrix.attr != '' }}
100+ uses : actions/checkout@v4
101+ - name : Install nix
102+ if : ${{ matrix.attr != '' }}
103+ uses : ./.github/actions/nix-install-self-hosted
104+ - name : nix build
105+ if : ${{ matrix.attr != '' }}
106+ shell : bash
107+ run : nix build --accept-flake-config -L .#${{ matrix.attr }}
108+
109+ nix-build-checks-aarch64-darwin :
110+ name : >-
111+ ${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }}
112+ (aarch64-darwin)
113+ needs : [nix-eval, nix-build-packages-aarch64-darwin]
114+ runs-on : ${{ matrix.attr != '' && matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }}
115+ if : ${{ fromJSON(needs.nix-eval.outputs.checks_matrix).aarch64_darwin != null }}
116+ strategy :
117+ fail-fast : false
118+ max-parallel : 5
119+ matrix : ${{ fromJSON(needs.nix-eval.outputs.checks_matrix).aarch64_darwin }}
120+ steps :
121+ - name : Checkout Repo
122+ if : ${{ matrix.attr != '' }}
123+ uses : actions/checkout@v4
124+ - name : Install nix
125+ if : ${{ matrix.attr != '' }}
126+ uses : ./.github/actions/nix-install-self-hosted
127+ - name : nix build
128+ if : ${{ matrix.attr != '' }}
129+ shell : bash
130+ run : nix build --accept-flake-config -L .#${{ matrix.attr }}
131+
132+ nix-build-packages-x86_64-linux :
133+ name : >-
134+ ${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }}
135+ (x86_64-linux)
136+ needs : nix-eval
137+ runs-on : ${{ matrix.attr != '' && matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }}
138+ if : ${{ fromJSON(needs.nix-eval.outputs.packages_matrix).x86_64_linux != null }}
23139 strategy :
24140 fail-fast : false
25- matrix :
26- include :
27- - runner : blacksmith-32vcpu-ubuntu-2404
28- arch : amd64
29- - runner : blacksmith-32vcpu-ubuntu-2404-arm
30- arch : arm64
31- - runner : macos-latest-xlarge
32- arch : arm64
33- runs-on : ${{ matrix.runner }}
34- timeout-minutes : 180
141+ max-parallel : 5
142+ matrix : ${{ fromJSON(needs.nix-eval.outputs.packages_matrix).x86_64_linux }}
35143 steps :
36144 - name : Checkout Repo
37- uses : supabase/postgres/.github/actions/shared-checkout@HEAD
38- - uses : ./.github/actions/nix-install-ephemeral
145+ if : ${{ matrix.attr != '' }}
146+ uses : actions/checkout@v4
147+ - name : Install nix
148+ if : ${{ matrix.attr != '' }}
149+ uses : ./.github/actions/nix-install-ephemeral
39150 with :
40- push-to-cache : ${{ github.secret_source == 'Actions' && ' true' || 'false' }}
151+ push-to-cache : ' true'
41152 env :
42153 DEV_AWS_ROLE : ${{ secrets.DEV_AWS_ROLE }}
43154 NIX_SIGN_SECRET_KEY : ${{ secrets.NIX_SIGN_SECRET_KEY }}
44- - name : Aggressive disk cleanup for DuckDB build
45- if : matrix.runner == 'macos-latest-xlarge'
46- run : |
47- nix --version
48- echo "=== BEFORE CLEANUP ==="
49- df -h
50- # Remove major space consumers
51- sudo rm -rf /usr/share/dotnet || true
52- sudo rm -rf /usr/local/lib/android || true
53- sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform || true
54- sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/watchOS.platform || true
55- sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/tvOS.platform || true
56- # Clean everything possible
57- sudo rm -rf /opt/ghc || true
58- sudo rm -rf /usr/local/share/boost || true
59- sudo rm -rf /opt/homebrew || true
60- sudo xcrun simctl delete all 2>/dev/null || true
61- # Aggressive cache cleanup
62- sudo rm -rf /System/Library/Caches/* 2>/dev/null || true
63- sudo rm -rf /Library/Caches/* 2>/dev/null || true
64- sudo rm -rf ~/Library/Caches/* 2>/dev/null || true
65- sudo rm -rf /private/var/log/* 2>/dev/null || true
66- sudo rm -rf /tmp/* 2>/dev/null || true
67- echo "=== AFTER CLEANUP ==="
68- df -h
69- -
70- name : Build psql bundle
71- run : >
72- nix run "github:Mic92/nix-fast-build?rev=b1dae483ab7d4139a6297e02b6de9e5d30e43d48"
73- -- --skip-cached --no-nom ${{ matrix.runner == 'macos-latest-xlarge' && '--max-jobs 1' || '' }} --copy-to "s3://nix-postgres-artifacts?secret-key=/etc/nix/nix-secret-key"
74- --flake ".#checks.$(nix eval --raw --impure --expr 'builtins.currentSystem')"
155+ - name : nix build
156+ if : ${{ matrix.attr != '' }}
157+ shell : bash
158+ run : nix build --accept-flake-config -L .#${{ matrix.attr }}
159+
160+ nix-build-checks-x86_64-linux :
161+ name : >-
162+ ${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }}
163+ (x86_64-linux)
164+ needs : [nix-eval, nix-build-packages-x86_64-linux]
165+ runs-on : ${{ matrix.attr != '' && matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }}
166+ if : ${{ fromJSON(needs.nix-eval.outputs.checks_matrix).x86_64_linux != null }}
167+ strategy :
168+ fail-fast : false
169+ max-parallel : 5
170+ matrix : ${{ fromJSON(needs.nix-eval.outputs.checks_matrix).x86_64_linux }}
171+ steps :
172+ - name : Checkout Repo
173+ if : ${{ matrix.attr != '' }}
174+ uses : actions/checkout@v4
175+ - name : Install nix
176+ if : ${{ matrix.attr != '' }}
177+ uses : ./.github/actions/nix-install-ephemeral
178+ with :
179+ push-to-cache : ' true'
75180 env :
76- AWS_ACCESS_KEY_ID : ${{ env.AWS_ACCESS_KEY_ID }}
77- AWS_SECRET_ACCESS_KEY : ${{ env.AWS_SECRET_ACCESS_KEY }}
78- AWS_SESSION_TOKEN : ${{ env.AWS_SESSION_TOKEN }}
181+ DEV_AWS_ROLE : ${{ secrets.DEV_AWS_ROLE }}
182+ NIX_SIGN_SECRET_KEY : ${{ secrets.NIX_SIGN_SECRET_KEY }}
183+ - name : nix build
184+ if : ${{ matrix.attr != '' }}
185+ shell : bash
186+ run : nix build --accept-flake-config -L .#${{ matrix.attr }}
79187
80188 run-testinfra :
81- needs : build-run-image
82- if : ${{ success() }}
189+ needs : [nix-eval, nix-build-packages-aarch64-linux, nix-build-checks-aarch64-linux, nix-build-packages-aarch64-darwin, nix-build-checks-aarch64-darwin, nix-build-packages-x86_64-linux, nix-build-checks-x86_64-linux]
190+ if : |
191+ !cancelled() &&
192+ needs.nix-eval.result == 'success' &&
193+ (needs.nix-build-packages-aarch64-linux.result == 'skipped' || needs.nix-build-packages-aarch64-linux.result == 'success') &&
194+ (needs.nix-build-checks-aarch64-linux.result == 'skipped' || needs.nix-build-checks-aarch64-linux.result == 'success') &&
195+ (needs.nix-build-packages-aarch64-darwin.result == 'skipped' || needs.nix-build-packages-aarch64-darwin.result == 'success') &&
196+ (needs.nix-build-checks-aarch64-darwin.result == 'skipped' || needs.nix-build-checks-aarch64-darwin.result == 'success') &&
197+ (needs.nix-build-packages-x86_64-linux.result == 'skipped' || needs.nix-build-packages-x86_64-linux.result == 'success') &&
198+ (needs.nix-build-checks-x86_64-linux.result == 'skipped' || needs.nix-build-checks-x86_64-linux.result == 'success')
83199 uses : ./.github/workflows/testinfra-ami-build.yml
84200 secrets :
85201 DEV_AWS_ROLE : ${{ secrets.DEV_AWS_ROLE }}
86202
87203 run-tests :
88- needs : build-run-image
89- if : ${{ success() }}
204+ needs : [nix-eval, nix-build-packages-aarch64-linux, nix-build-checks-aarch64-linux, nix-build-packages-aarch64-darwin, nix-build-checks-aarch64-darwin, nix-build-packages-x86_64-linux, nix-build-checks-x86_64-linux]
205+ if : |
206+ !cancelled() &&
207+ needs.nix-eval.result == 'success' &&
208+ (needs.nix-build-packages-aarch64-linux.result == 'skipped' || needs.nix-build-packages-aarch64-linux.result == 'success') &&
209+ (needs.nix-build-checks-aarch64-linux.result == 'skipped' || needs.nix-build-checks-aarch64-linux.result == 'success') &&
210+ (needs.nix-build-packages-aarch64-darwin.result == 'skipped' || needs.nix-build-packages-aarch64-darwin.result == 'success') &&
211+ (needs.nix-build-checks-aarch64-darwin.result == 'skipped' || needs.nix-build-checks-aarch64-darwin.result == 'success') &&
212+ (needs.nix-build-packages-x86_64-linux.result == 'skipped' || needs.nix-build-packages-x86_64-linux.result == 'success') &&
213+ (needs.nix-build-checks-x86_64-linux.result == 'skipped' || needs.nix-build-checks-x86_64-linux.result == 'success')
90214 uses : ./.github/workflows/test.yml
0 commit comments