Skip to content

Commit

Permalink
ci: rewrite the success job
Browse files Browse the repository at this point in the history
This is copied from how rust-lang/miri-test-libstd does it.
  • Loading branch information
cuviper committed Feb 10, 2024
1 parent af9f5fb commit 0852ad3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,17 @@ jobs:
- name: Clippy
run: cargo clippy # -- -D warnings

done:
name: Complete
# One job that "summarizes" the success state of this pipeline. This can then be added to branch
# protection, rather than having to add each job separately.
success:
name: Success
runs-on: ubuntu-latest
needs: [ci, clippy]
# Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
# dependencies fails.
if: always() # make sure this is never "skipped"
steps:
- run: exit 0
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: check if any dependency failed
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'

0 comments on commit 0852ad3

Please sign in to comment.