-
Notifications
You must be signed in to change notification settings - Fork 107
353 lines (324 loc) · 12.7 KB
/
ci.yml
File metadata and controls
353 lines (324 loc) · 12.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
name: Merge Queue Tasks
on:
merge_group:
workflow_dispatch:
jobs:
# NOTE: For every job added here, add a matching cancel-if-<name>-failed
# sentinel job in the cancel-if-* section below.
# Checks whether all build artifacts already exist in a prior run for this
# commit. If so, downstream build jobs are skipped and tests download
# artifacts from that prior run instead of the current one.
# NOTE: No cancel sentinel is needed for this job — it is designed to always
# succeed. Individual steps use continue-on-error and the final 'result'
# step runs unconditionally, so the job never leaves the workflow in a
# failed state.
check-prior-build:
name: Check for Prior Build Artifacts
runs-on: ubuntu-latest-amd64
permissions:
actions: read
# Outputs are set by the final 'result' step so this job always succeeds
# and never blocks downstream jobs even if individual checks fail.
outputs:
artifacts_run_id: ${{ steps.result.outputs.artifacts_run_id }}
skip_docker: ${{ steps.result.outputs.skip_docker }}
steps:
- uses: actions/checkout@v4
# Finds the first prior run for this commit that has all Rust/Java build
# artifacts. If found, its run ID is used by downstream jobs to download
# artifacts instead of rebuilding.
- name: Find prior run with all Rust/Java build artifacts
id: find-builds
continue-on-error: true
uses: ./.github/actions/find-artifacts-run
with:
required-artifacts: |
fda-x86_64-unknown-linux-gnu
fda-aarch64-unknown-linux-gnu
pipeline-manager-x86_64-unknown-linux-gnu
pipeline-manager-aarch64-unknown-linux-gnu
feldera-test-binaries-x86_64-unknown-linux-gnu
feldera-test-binaries-aarch64-unknown-linux-gnu
feldera-sql-compiler
token: ${{ github.token }}
# Checks whether the run found above also has the Docker image artifact.
# This artifact is uploaded by merge-manifests only after the image is
# verified in GHCR, so its presence guarantees the sha-{sha} tag exists.
- name: Check if Docker image artifact also present
id: find-docker
if: steps.find-builds.outputs.run-id != ''
continue-on-error: true
uses: ./.github/actions/find-artifacts-run
with:
required-artifacts: docker-image-ready
token: ${{ github.token }}
run-id: ${{ steps.find-builds.outputs.run-id }}
# Consolidates outputs so both are always set even if a find step failed.
# Defaults: artifacts_run_id='' (run builds), skip_docker=false (run Docker build).
- name: Consolidate outputs
id: result
if: always()
run: |
echo "artifacts_run_id=${{ steps.find-builds.outputs.run-id }}" >> "$GITHUB_OUTPUT"
echo "skip_docker=${{ steps.find-docker.outputs.run-id != '' && 'true' || 'false' }}" >> "$GITHUB_OUTPUT"
invoke-build-rust:
name: Build Rust
needs: [check-prior-build]
if: needs.check-prior-build.outputs.artifacts_run_id == ''
uses: ./.github/workflows/build-rust.yml
secrets: inherit
invoke-build-java:
name: Build Java
needs: [check-prior-build]
if: needs.check-prior-build.outputs.artifacts_run_id == ''
uses: ./.github/workflows/build-java.yml
secrets: inherit
invoke-build-docs:
name: Build Docs
uses: ./.github/workflows/build-docs.yml
secrets: inherit
invoke-tests-unit:
name: Unit Tests
needs: [check-prior-build, invoke-build-rust, invoke-build-java]
if: |
always() &&
(needs.invoke-build-rust.result == 'success' || needs.invoke-build-rust.result == 'skipped') &&
(needs.invoke-build-java.result == 'success' || needs.invoke-build-java.result == 'skipped')
uses: ./.github/workflows/test-unit.yml
with:
artifacts_run_id: ${{ needs.check-prior-build.outputs.artifacts_run_id }}
secrets: inherit
invoke-tests-adapter:
name: Adapter Tests
needs: [check-prior-build, invoke-build-rust]
if: |
always() &&
(needs.invoke-build-rust.result == 'success' || needs.invoke-build-rust.result == 'skipped')
uses: ./.github/workflows/test-adapters.yml
with:
artifacts_run_id: ${{ needs.check-prior-build.outputs.artifacts_run_id }}
secrets: inherit
invoke-build-docker:
name: Build Docker
needs: [check-prior-build, invoke-build-rust, invoke-build-java]
if: |
always() &&
needs.check-prior-build.outputs.skip_docker != 'true' &&
(needs.invoke-build-rust.result == 'success' || needs.invoke-build-rust.result == 'skipped') &&
(needs.invoke-build-java.result == 'success' || needs.invoke-build-java.result == 'skipped')
uses: ./.github/workflows/build-docker.yml
with:
artifacts_run_id: ${{ needs.check-prior-build.outputs.artifacts_run_id }}
secrets: inherit
invoke-generate-sbom:
name: Generate SBOMs
needs: [invoke-build-docker]
if: |
always() &&
(needs.invoke-build-docker.result == 'success' || needs.invoke-build-docker.result == 'skipped')
uses: ./.github/workflows/generate-sbom.yml
secrets: inherit
invoke-tests-integration-platform:
name: Integration Tests
needs: [check-prior-build, invoke-build-docker]
if: |
always() &&
(needs.invoke-build-docker.result == 'success' || needs.invoke-build-docker.result == 'skipped')
uses: ./.github/workflows/test-integration-platform.yml
with:
artifacts_run_id: ${{ needs.check-prior-build.outputs.artifacts_run_id }}
secrets: inherit
invoke-tests-integration-runtime:
name: Integration Tests
needs: [check-prior-build, invoke-build-java]
if: |
always() &&
(needs.invoke-build-java.result == 'success' || needs.invoke-build-java.result == 'skipped')
uses: ./.github/workflows/test-integration-runtime.yml
secrets: inherit
invoke-tests-java:
name: Java Tests
needs: [check-prior-build, invoke-build-java]
if: |
always() &&
(needs.invoke-build-java.result == 'success' || needs.invoke-build-java.result == 'skipped')
uses: ./.github/workflows/test-java.yml
secrets: inherit
invoke-publish-crates-dry-run:
name: Publish Crates (Dry Run)
needs: [check-prior-build, invoke-build-rust]
if: |
always() &&
(needs.invoke-build-rust.result == 'success' || needs.invoke-build-rust.result == 'skipped')
uses: ./.github/workflows/publish-crates.yml
with:
environment: ci
secrets: inherit
# GitHub doesn't cancel in-progress sibling jobs when one job fails — they keep running
# until they finish, which wastes runner time when a build or test fails early.
# The jobs below work around this: each one watches a single upstream job and, if that
# job fails, immediately cancels the entire workflow run so everything else stops too.
cancel-if-build-rust-failed:
name: Cancel if Rust Build Failed
needs: [invoke-build-rust]
if: failure()
runs-on: ubuntu-latest-amd64
permissions:
actions: write
steps:
- name: Cancel workflow
run: |
curl -fsSL -X POST \
-H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
cancel-if-build-java-failed:
name: Cancel if Java Build Failed
needs: [invoke-build-java]
if: failure()
runs-on: ubuntu-latest-amd64
permissions:
actions: write
steps:
- name: Cancel workflow
run: |
curl -fsSL -X POST \
-H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
cancel-if-build-docs-failed:
name: Cancel if Docs Build Failed
needs: [invoke-build-docs]
if: failure()
runs-on: ubuntu-latest-amd64
permissions:
actions: write
steps:
- name: Cancel workflow
run: |
curl -fsSL -X POST \
-H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
cancel-if-tests-unit-failed:
name: Cancel if Unit Tests Failed
needs: [invoke-tests-unit]
if: failure()
runs-on: ubuntu-latest-amd64
permissions:
actions: write
steps:
- name: Cancel workflow
run: |
curl -fsSL -X POST \
-H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
cancel-if-tests-adapter-failed:
name: Cancel if Adapter Tests Failed
needs: [invoke-tests-adapter]
if: failure()
runs-on: ubuntu-latest-amd64
permissions:
actions: write
steps:
- name: Cancel workflow
run: |
curl -fsSL -X POST \
-H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
cancel-if-build-docker-failed:
name: Cancel if Docker Build Failed
needs: [invoke-build-docker]
if: failure()
runs-on: ubuntu-latest-amd64
permissions:
actions: write
steps:
- name: Cancel workflow
run: |
curl -fsSL -X POST \
-H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
cancel-if-tests-integration-platform-failed:
name: Cancel if Platform Integration Tests Failed
needs: [invoke-tests-integration-platform]
if: failure()
runs-on: ubuntu-latest-amd64
permissions:
actions: write
steps:
- name: Cancel workflow
run: |
curl -fsSL -X POST \
-H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
cancel-if-tests-integration-runtime-failed:
name: Cancel if Runtime Integration Tests Failed
needs: [invoke-tests-integration-runtime]
if: failure()
runs-on: ubuntu-latest-amd64
permissions:
actions: write
steps:
- name: Cancel workflow
run: |
curl -fsSL -X POST \
-H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
cancel-if-tests-java-failed:
name: Cancel if Java Tests Failed
needs: [invoke-tests-java]
if: failure()
runs-on: ubuntu-latest-amd64
permissions:
actions: write
steps:
- name: Cancel workflow
run: |
curl -fsSL -X POST \
-H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
cancel-if-publish-crates-dry-run-failed:
name: Cancel if Publish Crates Dry Run Failed
needs: [invoke-publish-crates-dry-run]
if: failure()
runs-on: ubuntu-latest-amd64
permissions:
actions: write
steps:
- name: Cancel workflow
run: |
curl -fsSL -X POST \
-H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
# This job needs to be called main (the same as the ci-pre-mergequeue.yml workflow)
# because of how merge queues work: https://stackoverflow.com/a/78030618
# and https://github.com/orgs/community/discussions/103114
main:
if: always()
runs-on: ubuntu-latest-amd64
needs:
- check-prior-build
- invoke-build-rust
- invoke-build-java
- invoke-build-docs
- invoke-tests-unit
- invoke-tests-adapter
- invoke-build-docker
- invoke-generate-sbom
- invoke-tests-integration-platform
- invoke-tests-integration-runtime
- invoke-tests-java
- invoke-publish-crates-dry-run
steps:
- name: Finalize Workflow
run: echo "All tasks completed!"
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1