Skip to content

Commit 4e672ef

Browse files
committed
Check that all omissions from tests-pass are intentional
This intentionally fails right now, by omitting `tests-pass` itself as a job that `tests-pass` should not depend on, in order to ensure that it is able to fail. Once this is observed (and any other bugs fixed), this omission should be corrected, and then it should pass.
1 parent 20794ff commit 4e672ef

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/ci.yml

+37
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,42 @@ jobs:
289289
git status
290290
git diff --exit-code
291291
292+
# Check that only jobs intended not to block PR auto-merge are omitted as
293+
# dependencies of the `tests-pass` job below, so that whenever a job is
294+
# added, a decision is made about whether it must pass for PRs to merge.
295+
check-blocking:
296+
runs-on: ubuntu-latest
297+
298+
env:
299+
# List all jobs that are intended NOT to block PR auto-merge here.
300+
# FIXME: After ensuring this can fail, add `test-pass` below to fix it.
301+
EXPECTED_NONBLOCKING_JOBS: |-
302+
test-fixtures-windows
303+
# tests-pass
304+
305+
defaults:
306+
run:
307+
shell: bash # Without specifying this, we don't get `-o pipefail`.
308+
309+
steps:
310+
- name: Find this workflow
311+
run: |
312+
relative_workflow_with_ref="${GITHUB_WORKFLOW_REF#"$GITHUB_REPOSITORY/"}"
313+
echo "WORKFLOW_PATH=${relative_workflow_with_ref%@*}" >> "$GITHUB_ENV"
314+
- uses: actions/checkout@v4
315+
with:
316+
sparse-checkout: ${{ env.WORKFLOW_PATH }}
317+
- name: Get all jobs
318+
run: yq '.jobs | keys.[]' -- "$WORKFLOW_PATH" | sort > all-jobs.txt
319+
- name: Get blocking jobs
320+
run: yq '.jobs.tests-pass.needs.[]' -- "$WORKFLOW_PATH" | sort > blocking-jobs.txt
321+
- name: Get jobs we intend do not block
322+
run: sort <<<"$EXPECTED_NONBLOCKING_JOBS" > expected-nonblocking-jobs.txt
323+
- name: Check that each job blocks PRs xor intentionally doesn't
324+
run: |
325+
sort -m blocking-jobs.txt expected-nonblocking-jobs.txt |
326+
diff --color=always -U1000 -- - all-jobs.txt
327+
292328
# Dummy job to have a stable name for the "all tests pass" requirement
293329
tests-pass:
294330
name: Tests pass
@@ -302,6 +338,7 @@ jobs:
302338
- cargo-deny
303339
- wasm
304340
- check-packetline
341+
- check-blocking
305342

306343
if: always() # always run even if dependencies fail
307344

0 commit comments

Comments
 (0)