Skip to content

Commit 82dd7eb

Browse files
committed
Add a "join node" to CI configuration
This adds a "join" at the end of CI which reports the overall status of all prior jobs. The intention is that this job is used to gate whether a PR is merge-able. I'd like to enable merge queues for this repository and to do so requires listing CI jobs to wait on, and by having this "join" node there's just a single job to wait on instead of everything in the repo.
1 parent 55cc34a commit 82dd7eb

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/main.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,36 @@ jobs:
301301
-DCMAKE_C_COMPILER=$WASI_SDK_PATH/bin/clang
302302
- name: Build and test python
303303
run: ninja -C build -v python
304+
305+
# This is a "join node" which depends on all prior workflows. The merge queue,
306+
# for example, gates on this to ensure that everything has executed
307+
# successfully. This enables decoupling the set of CI jobs specified in this
308+
# file with what should be gated on in the repository configuration. With a
309+
# join node here it means, for example, that adding a new CI job doesn't
310+
# require updating repository configuration and this can be updated directly
311+
# here.
312+
#
313+
# Note that this currently always runs to always report a status, even on
314+
# cancellation and even if dependency steps fail. Each dependency tries to
315+
# cancel the whole run if it fails, so if a test matrix entry fails, for
316+
# example, it cancels the build matrix entries too. This step then tries to
317+
# fail on cancellation to ensure that the dependency failures are propagated
318+
# correctly.
319+
ci-status:
320+
name: Record the result of this workflow
321+
runs-on: ubuntu-latest
322+
needs:
323+
- buildlibc
324+
- headerstest
325+
- clang-format
326+
- rustfmt
327+
- bindings
328+
- python
329+
if: always()
330+
steps:
331+
# Calculate the exit status of the whole CI workflow.
332+
# If all dependent jobs were successful, this exits with 0 (and the
333+
# outcome job continues successfully). If a some dependent job has
334+
# failed, this exits with 1.
335+
- name: calculate the correct exit status
336+
run: jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'

0 commit comments

Comments
 (0)