Skip to content

Commit f1a8a79

Browse files
committed
Move the actual vm tests / flake regressions into the generic build phase
This lets these steps run in maximal parallelism. This also uses a success job to "combine" all the component jobs into a single signal.
1 parent 37ab15a commit f1a8a79

File tree

3 files changed

+206
-135
lines changed

3 files changed

+206
-135
lines changed

.github/workflows/build.yml

Lines changed: 177 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
on:
22
workflow_call:
33
inputs:
4-
os:
4+
system:
55
required: true
66
type: string
7-
system:
7+
runner:
8+
default: |
9+
${{
10+
(system == "x86_64-linux" && "blacksmith-32vcpu-ubuntu-2204")
11+
|| (system == "aarch64-linux" && "blacksmith-32vcpu-ubuntu-2204-arm")
12+
|| (system == "x86_64-darwin" && "macos-latest-large")
13+
|| (system == "aarch64-darwin" && "macos-latest-xlarge")
14+
|| "unknown-system"
15+
}}
16+
required: true
17+
type: string
18+
runner_small:
19+
default: |
20+
${{
21+
(system == "x86_64-linux" && "ubuntu-latest")
22+
|| (system == "aarch64-linux" && "blacksmith-32vcpu-ubuntu-2204-arm")
23+
|| (system == "x86_64-darwin" && "macos-latest-large")
24+
|| (system == "aarch64-darwin" && "macos-latest-xlarge")
25+
|| "unknown-system"
26+
}}
827
required: true
928
type: string
1029
if:
@@ -15,13 +34,21 @@ on:
1534
required: false
1635
default: true
1736
type: boolean
37+
run_vm_tests:
38+
required: false
39+
default: false
40+
type: boolean
41+
run_regression_tests:
42+
required: false
43+
default: false
44+
type: boolean
1845

1946
jobs:
2047
build:
2148
if: ${{ inputs.if }}
2249
strategy:
2350
fail-fast: false
24-
runs-on: ${{ inputs.os }}
51+
runs-on: ${{ inputs.runner }}
2552
timeout-minutes: 60
2653
steps:
2754
- uses: actions/checkout@v4
@@ -38,10 +65,156 @@ jobs:
3865
needs: build
3966
strategy:
4067
fail-fast: false
41-
runs-on: ${{ inputs.os }}
68+
runs-on: ${{ inputs.runner }}
4269
timeout-minutes: 60
4370
steps:
4471
- uses: actions/checkout@v4
4572
- uses: DeterminateSystems/determinate-nix-action@main
4673
- uses: DeterminateSystems/flakehub-cache-action@main
4774
- run: nix flake check -L --system ${{ inputs.system }}
75+
76+
vm_tests_smoke:
77+
if: inputs.run_vm_tests && github.event_name != 'merge_group'
78+
needs: build
79+
runs-on: ${{ inputs.runner }}
80+
steps:
81+
- uses: actions/checkout@v4
82+
- uses: DeterminateSystems/determinate-nix-action@main
83+
- uses: DeterminateSystems/flakehub-cache-action@main
84+
- run: |
85+
nix build -L \
86+
.#hydraJobs.tests.functional_user \
87+
.#hydraJobs.tests.githubFlakes \
88+
.#hydraJobs.tests.nix-docker \
89+
.#hydraJobs.tests.tarballFlakes \
90+
;
91+
92+
vm_tests_all:
93+
if: inputs.run_vm_tests && github.event_name == 'merge_group'
94+
needs: build
95+
runs-on: ${{ inputs.runner }}
96+
steps:
97+
- uses: actions/checkout@v4
98+
- uses: DeterminateSystems/determinate-nix-action@main
99+
- uses: DeterminateSystems/flakehub-cache-action@main
100+
- run: |
101+
nix build -L --keep-going \
102+
$(nix flake show --json \
103+
| jq -r '
104+
.hydraJobs.tests
105+
| with_entries(select(.value.type == "derivation"))
106+
| keys[]
107+
| ".#hydraJobs.tests." + .')
108+
109+
flake_regressions:
110+
if: |
111+
(inputs.run_regression_tests && github.event_name == 'merge_group')
112+
|| (
113+
github.event.pull_request.head.repo.full_name == 'DeterminateSystems/nix-src'
114+
&& (
115+
(github.event.action == 'labeled' && github.event.label.name == 'flake-regression-test')
116+
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'flake-regression-test'))
117+
)
118+
)
119+
needs: build
120+
runs-on: ${{ inputs.runner }}
121+
steps:
122+
- name: Checkout nix
123+
uses: actions/checkout@v4
124+
- name: Checkout flake-regressions
125+
uses: actions/checkout@v4
126+
with:
127+
repository: DeterminateSystems/flake-regressions
128+
path: flake-regressions
129+
- name: Checkout flake-regressions-data
130+
uses: actions/checkout@v4
131+
with:
132+
repository: DeterminateSystems/flake-regressions-data
133+
path: flake-regressions/tests
134+
- uses: DeterminateSystems/determinate-nix-action@main
135+
- uses: DeterminateSystems/flakehub-cache-action@main
136+
- run: nix build -L --out-link ./new-nix && PATH=$(pwd)/new-nix/bin:$PATH PARALLEL="-P 50%" flake-regressions/eval-all.sh
137+
138+
flake_regressions_lazy:
139+
if: |
140+
(inputs.run_regression_tests && github.event_name == 'merge_group')
141+
|| (
142+
github.event.pull_request.head.repo.full_name == 'DeterminateSystems/nix-src'
143+
&& (
144+
(github.event.action == 'labeled' && github.event.label.name == 'flake-regression-test')
145+
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'flake-regression-test'))
146+
)
147+
)
148+
needs: build
149+
runs-on: ${{ inputs.run_regression_tests }}
150+
steps:
151+
- name: Checkout nix
152+
uses: actions/checkout@v4
153+
- name: Checkout flake-regressions
154+
uses: actions/checkout@v4
155+
with:
156+
repository: DeterminateSystems/flake-regressions
157+
path: flake-regressions
158+
- name: Checkout flake-regressions-data
159+
uses: actions/checkout@v4
160+
with:
161+
repository: DeterminateSystems/flake-regressions-data
162+
path: flake-regressions/tests
163+
- uses: DeterminateSystems/determinate-nix-action@main
164+
- uses: DeterminateSystems/flakehub-cache-action@main
165+
- run: nix build -L --out-link ./new-nix && PATH=$(pwd)/new-nix/bin:$PATH PARALLEL="-P 50%" NIX_CONFIG="lazy-trees = true" flake-regressions/eval-all.sh
166+
167+
manual:
168+
if: github.event_name != 'merge_group'
169+
needs: build
170+
runs-on: ${{ inputs.runner_small }}
171+
permissions:
172+
id-token: "write"
173+
contents: "read"
174+
pull-requests: "write"
175+
statuses: "write"
176+
deployments: "write"
177+
steps:
178+
- name: Checkout nix
179+
uses: actions/checkout@v4
180+
- uses: DeterminateSystems/determinate-nix-action@main
181+
- uses: DeterminateSystems/flakehub-cache-action@main
182+
- name: Build manual
183+
run: nix build .#hydraJobs.manual
184+
- uses: nwtgck/actions-netlify@v3.0
185+
with:
186+
publish-dir: "./result/share/doc/nix/manual"
187+
production-branch: detsys-main
188+
github-token: ${{ secrets.GITHUB_TOKEN }}
189+
deploy-message: "Deploy from GitHub Actions"
190+
# NOTE(cole-h): We have a perpetual PR displaying our changes against upstream open, but
191+
# its conversation is locked, so this PR comment can never be posted.
192+
# https://github.com/DeterminateSystems/nix-src/pull/4
193+
enable-pull-request-comment: ${{ github.event.pull_request.number != 4 }}
194+
enable-commit-comment: true
195+
enable-commit-status: true
196+
overwrites-pull-request-comment: true
197+
env:
198+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
199+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
200+
success:
201+
needs:
202+
- build
203+
- test
204+
- vm_tests_smoke
205+
- vm_tests_all
206+
- flake_regressions
207+
- flake_regressions_lazy
208+
- manual
209+
if: ${{ always() }}
210+
steps:
211+
- run: "true"
212+
- run: |
213+
echo "A dependent in the build matrix failed:"
214+
echo "$needs"
215+
exit 1
216+
env:
217+
needs: ${{ toJSON(needs) }}
218+
if: |
219+
contains(needs.*.result, 'failure') ||
220+
contains(needs.*.result, 'cancelled')

.github/workflows/ci.yml

Lines changed: 19 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -26,150 +26,43 @@ jobs:
2626
build_x86_64-linux:
2727
uses: ./.github/workflows/build.yml
2828
with:
29-
os: blacksmith-32vcpu-ubuntu-2204
3029
system: x86_64-linux
30+
run_tests: true
31+
run_vm_tests: true
32+
run_regression_tests: true
3133

3234
build_aarch64-linux:
3335
uses: ./.github/workflows/build.yml
3436
with:
3537
if: ${{ github.event_name == 'merge_group' }}
36-
os: blacksmith-32vcpu-ubuntu-2204-arm
3738
system: aarch64-linux
3839

3940
build_x86_64-darwin:
4041
uses: ./.github/workflows/build.yml
4142
with:
4243
if: ${{ github.event_name == 'merge_group' }}
43-
os: macos-latest-large
4444
system: x86_64-darwin
4545

4646
build_aarch64-darwin:
4747
uses: ./.github/workflows/build.yml
4848
with:
49-
os: namespace-profile-mac-m2-12c28g
5049
system: aarch64-darwin
5150

52-
vm_tests_smoke:
53-
if: github.event_name != 'merge_group'
54-
needs: build_x86_64-linux
55-
runs-on: blacksmith-32vcpu-ubuntu-2204
56-
steps:
57-
- uses: actions/checkout@v4
58-
- uses: DeterminateSystems/determinate-nix-action@main
59-
- uses: DeterminateSystems/flakehub-cache-action@main
60-
- run: |
61-
nix build -L \
62-
.#hydraJobs.tests.functional_user \
63-
.#hydraJobs.tests.githubFlakes \
64-
.#hydraJobs.tests.nix-docker \
65-
.#hydraJobs.tests.tarballFlakes \
66-
;
67-
68-
vm_tests_all:
69-
if: github.event_name == 'merge_group'
70-
needs: build_x86_64-linux
71-
runs-on: blacksmith-32vcpu-ubuntu-2204
72-
steps:
73-
- uses: actions/checkout@v4
74-
- uses: DeterminateSystems/determinate-nix-action@main
75-
- uses: DeterminateSystems/flakehub-cache-action@main
51+
success:
52+
needs:
53+
- build_x86_64-linux
54+
- build_aarch64-linux
55+
- build_x86_64-darwin
56+
- build_aarch64-darwin
57+
if: ${{ always() }}
58+
steps:
59+
- run: "true"
7660
- run: |
77-
nix build -L --keep-going \
78-
$(nix flake show --json \
79-
| jq -r '
80-
.hydraJobs.tests
81-
| with_entries(select(.value.type == "derivation"))
82-
| keys[]
83-
| ".#hydraJobs.tests." + .')
84-
85-
flake_regressions:
86-
if: |
87-
github.event_name == 'merge_group'
88-
|| (
89-
github.event.pull_request.head.repo.full_name == 'DeterminateSystems/nix-src'
90-
&& (
91-
(github.event.action == 'labeled' && github.event.label.name == 'flake-regression-test')
92-
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'flake-regression-test'))
93-
)
94-
)
95-
needs: build_x86_64-linux
96-
runs-on: namespace-profile-x86-32cpu-64gb
97-
steps:
98-
- name: Checkout nix
99-
uses: actions/checkout@v4
100-
- name: Checkout flake-regressions
101-
uses: actions/checkout@v4
102-
with:
103-
repository: DeterminateSystems/flake-regressions
104-
path: flake-regressions
105-
- name: Checkout flake-regressions-data
106-
uses: actions/checkout@v4
107-
with:
108-
repository: DeterminateSystems/flake-regressions-data
109-
path: flake-regressions/tests
110-
- uses: DeterminateSystems/determinate-nix-action@main
111-
- uses: DeterminateSystems/flakehub-cache-action@main
112-
- run: nix build -L --out-link ./new-nix && PATH=$(pwd)/new-nix/bin:$PATH PARALLEL="-P 50%" flake-regressions/eval-all.sh
113-
114-
flake_regressions_lazy:
115-
if: |
116-
github.event_name == 'merge_group'
117-
|| (
118-
github.event.pull_request.head.repo.full_name == 'DeterminateSystems/nix-src'
119-
&& (
120-
(github.event.action == 'labeled' && github.event.label.name == 'flake-regression-test')
121-
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'flake-regression-test'))
122-
)
123-
)
124-
needs: build_x86_64-linux
125-
runs-on: namespace-profile-x86-32cpu-64gb
126-
steps:
127-
- name: Checkout nix
128-
uses: actions/checkout@v4
129-
- name: Checkout flake-regressions
130-
uses: actions/checkout@v4
131-
with:
132-
repository: DeterminateSystems/flake-regressions
133-
path: flake-regressions
134-
- name: Checkout flake-regressions-data
135-
uses: actions/checkout@v4
136-
with:
137-
repository: DeterminateSystems/flake-regressions-data
138-
path: flake-regressions/tests
139-
- uses: DeterminateSystems/determinate-nix-action@main
140-
- uses: DeterminateSystems/flakehub-cache-action@main
141-
- run: nix build -L --out-link ./new-nix && PATH=$(pwd)/new-nix/bin:$PATH PARALLEL="-P 50%" NIX_CONFIG="lazy-trees = true" flake-regressions/eval-all.sh
142-
143-
manual:
144-
if: github.event_name != 'merge_group'
145-
needs: build_x86_64-linux
146-
runs-on: blacksmith
147-
permissions:
148-
id-token: "write"
149-
contents: "read"
150-
pull-requests: "write"
151-
statuses: "write"
152-
deployments: "write"
153-
steps:
154-
- name: Checkout nix
155-
uses: actions/checkout@v4
156-
- uses: DeterminateSystems/determinate-nix-action@main
157-
- uses: DeterminateSystems/flakehub-cache-action@main
158-
- name: Build manual
159-
run: nix build .#hydraJobs.manual
160-
- uses: nwtgck/actions-netlify@v3.0
161-
with:
162-
publish-dir: "./result/share/doc/nix/manual"
163-
production-branch: detsys-main
164-
github-token: ${{ secrets.GITHUB_TOKEN }}
165-
deploy-message: "Deploy from GitHub Actions"
166-
# NOTE(cole-h): We have a perpetual PR displaying our changes against upstream open, but
167-
# its conversation is locked, so this PR comment can never be posted.
168-
# https://github.com/DeterminateSystems/nix-src/pull/4
169-
enable-pull-request-comment: ${{ github.event.pull_request.number != 4 }}
170-
enable-commit-comment: true
171-
enable-commit-status: true
172-
overwrites-pull-request-comment: true
61+
echo "A dependent in the build matrix failed:"
62+
echo "$needs"
63+
exit 1
17364
env:
174-
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
175-
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
65+
needs: ${{ toJSON(needs) }}
66+
if: |
67+
contains(needs.*.result, 'failure') ||
68+
contains(needs.*.result, 'cancelled')

0 commit comments

Comments
 (0)