File tree Expand file tree Collapse file tree 2 files changed +22
-20
lines changed
Expand file tree Collapse file tree 2 files changed +22
-20
lines changed Original file line number Diff line number Diff line change @@ -43,16 +43,17 @@ jobs:
4343 components : rustfmt
4444 - run : cargo fmt --all --check
4545
46- ci-success :
47- name : Complete
46+ # One job that "summarizes" the success state of this pipeline. This can then be added to branch
47+ # protection, rather than having to add each job separately.
48+ success :
49+ name : Success
4850 runs-on : ubuntu-latest
4951 needs : [test, no_std, fmt]
52+ # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
53+ # failed" as success. So we have to do some contortions to ensure the job fails if any of its
54+ # dependencies fails.
55+ if : always() # make sure this is never "skipped"
5056 steps :
51- - run : exit 0
52- ci-failed :
53- name : Complete
54- runs-on : ubuntu-latest
55- needs : [test, no_std, fmt]
56- if : failure()
57- steps :
58- - run : exit 1
57+ # Manually check the status of all dependencies. `if: failure()` does not work.
58+ - name : check if any dependency failed
59+ run : jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
Original file line number Diff line number Diff line change @@ -28,16 +28,17 @@ jobs:
2828 components : rustfmt
2929 - run : cargo fmt --all --check
3030
31- ci-success :
32- name : Complete
31+ # One job that "summarizes" the success state of this pipeline. This can then be added to branch
32+ # protection, rather than having to add each job separately.
33+ success :
34+ name : Success
3335 runs-on : ubuntu-latest
3436 needs : [test, fmt]
37+ # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
38+ # failed" as success. So we have to do some contortions to ensure the job fails if any of its
39+ # dependencies fails.
40+ if : always() # make sure this is never "skipped"
3541 steps :
36- - run : exit 0
37- ci-failed :
38- name : Complete
39- runs-on : ubuntu-latest
40- needs : [test, fmt]
41- if : failure()
42- steps :
43- - run : exit 1
42+ # Manually check the status of all dependencies. `if: failure()` does not work.
43+ - name : check if any dependency failed
44+ run : jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
You can’t perform that action at this time.
0 commit comments