|
1 | 1 | name: CI |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - # Run in PRs and for bors, but not on master. |
6 | | - branches: |
7 | | - - 'auto' |
8 | | - - 'try' |
| 4 | + merge_group: |
9 | 5 | pull_request: |
10 | 6 | branches: |
11 | 7 | - 'master' |
@@ -62,27 +58,24 @@ jobs: |
62 | 58 | - name: rustdoc |
63 | 59 | run: RUSTDOCFLAGS="-Dwarnings" ./miri doc --document-private-items |
64 | 60 |
|
65 | | - # These jobs doesn't actually test anything, but they're only used to tell |
66 | | - # bors the build completed, as there is no practical way to detect when a |
67 | | - # workflow is successful listening to webhooks only. |
68 | | - # |
69 | | - # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! |
70 | | - end-success: |
71 | | - name: bors build finished |
72 | | - runs-on: ubuntu-latest |
| 61 | + conclusion: |
73 | 62 | needs: [build, style] |
74 | | - if: github.event.pusher.name == 'bors' && success() |
75 | | - steps: |
76 | | - - name: mark the job as a success |
77 | | - run: exit 0 |
78 | | - end-failure: |
79 | | - name: bors build finished |
| 63 | + # We need to ensure this job does *not* get skipped if its dependencies fail, |
| 64 | + # because a skipped job is considered a success by GitHub. So we have to |
| 65 | + # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run |
| 66 | + # when the workflow is canceled manually. |
| 67 | + # |
| 68 | + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! |
| 69 | + if: ${{ !cancelled() }} |
80 | 70 | runs-on: ubuntu-latest |
81 | | - needs: [build, style] |
82 | | - if: github.event.pusher.name == 'bors' && (failure() || cancelled()) |
83 | 71 | steps: |
84 | | - - name: mark the job as a failure |
85 | | - run: exit 1 |
| 72 | + # Manually check the status of all dependencies. `if: failure()` does not work. |
| 73 | + - name: Conclusion |
| 74 | + run: | |
| 75 | + # Print the dependent jobs to see them in the CI log |
| 76 | + jq -C <<< '${{ toJson(needs) }}' |
| 77 | + # Check if all jobs that we depend on (in the needs array) were successful. |
| 78 | + jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' |
86 | 79 |
|
87 | 80 | cron-fail-notify: |
88 | 81 | name: cronjob failure notification |
|
0 commit comments