|
1 | 1 | name: CI
|
2 | 2 | on:
|
3 |
| - push: |
4 |
| - branches: |
5 |
| - - auto |
6 |
| - - try |
7 | 3 | pull_request:
|
8 |
| - branches: |
9 |
| - - master |
| 4 | + merge_group: |
10 | 5 |
|
11 | 6 | jobs:
|
12 | 7 | style:
|
|
29 | 24 | - run: ci/dox.sh
|
30 | 25 | env:
|
31 | 26 | CI: 1
|
32 |
| - - name: Publish documentation |
33 |
| - run: | |
34 |
| - cd target/doc |
35 |
| - git init |
36 |
| - git add . |
37 |
| - git -c user.name='ci' -c user.email='ci' commit -m init |
38 |
| - git push -f -q https://git:${{ secrets.github_token }}@github.com/${{ github.repository }} HEAD:gh-pages |
39 |
| - if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' |
40 | 27 |
|
41 | 28 | verify:
|
42 | 29 | name: Automatic intrinsic verification
|
@@ -246,19 +233,25 @@ jobs:
|
246 | 233 | run: rustup update nightly && rustup default nightly
|
247 | 234 | - run: ./ci/build-std-detect.sh
|
248 | 235 |
|
249 |
| - success: |
| 236 | + conclusion: |
250 | 237 | needs:
|
251 | 238 | - docs
|
252 | 239 | - verify
|
253 | 240 | - env_override
|
254 | 241 | - test
|
255 | 242 | - build-std-detect
|
256 | 243 | runs-on: ubuntu-latest
|
257 |
| - # GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency |
258 |
| - # failed" as success. So we have to do some contortions to ensure the job fails if any of its |
259 |
| - # dependencies fails. |
260 |
| - if: always() # make sure this is never "skipped" |
| 244 | + # We need to ensure this job does *not* get skipped if its dependencies fail, |
| 245 | + # because a skipped job is considered a success by GitHub. So we have to |
| 246 | + # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run |
| 247 | + # when the workflow is canceled manually. |
| 248 | + # |
| 249 | + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! |
| 250 | + if: ${{ !cancelled() }} # make sure this is never "skipped" |
261 | 251 | steps:
|
262 |
| - # Manually check the status of all dependencies. `if: failure()` does not work. |
263 |
| - - name: check if any dependency failed |
264 |
| - run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' |
| 252 | + - name: Conclusion |
| 253 | + run: | |
| 254 | + # Print the dependent jobs to see them in the CI log |
| 255 | + jq -C <<< '${{ toJson(needs) }}' |
| 256 | + # Check if all jobs that we depend on (in the needs array) were successful. |
| 257 | + jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' |
0 commit comments