Skip to content

Commit

Permalink
Merge pull request #81 from rust-lang/protect
Browse files Browse the repository at this point in the history
update comments and details of branch protection 'success' job
  • Loading branch information
RalfJung authored Oct 22, 2024
2 parents bb6d9d5 + ddbe6f6 commit 5e08473
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,24 @@ jobs:

# 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.
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
success:
name: Success
runs-on: ubuntu-latest
needs: [test-core, test-alloc, test-std, test-simd, test-stdarch]
# 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"
# We need to ensure this job does *not* get skipped if its dependencies fail,
# because a skipped job is considered a success by Github. So we have to
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
# when the workflow is canceled manually.
if: ${{ !cancelled() }}
steps:
# 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) }}'
run: |
# Print the dependent jobs to see them in the CI log
jq -C <<< '${{ toJson(needs) }}'
# Check if all jobs that we depend on (in the needs array) were successful.
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
# Make a PR to update `rust-version` when the cron job succeeds.
# The primary reason for this is that Github stops running our cron job
Expand Down

0 comments on commit 5e08473

Please sign in to comment.