diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-10-14 21:09:08 -0700 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2023-10-14 22:24:24 -0700 |
commit | 222c4b85684424352d65125018d15a9e87d0a851 (patch) | |
tree | 6b1f9428929664f57637d3d014cdd074f0fddd2a /.github | |
parent | 28bd3a96b9cf6830e94389d6288d0b6095de5993 (diff) |
Add result job for required status checks
We've been using matrix jobs as required status checks. However, when
[DOC] pull requests are created, the matrix content and templated
variables are not executed, which results in changing the name of the
matrix jobs. Then required status checks are considered missing because
of the different names. So we can't merge [DOC] PRs right now.
This `result` is a known technique to check the composite status of
matrix jobs. https://github.com/orgs/community/discussions/26822
The `result` job is not only a non-matrix job, which doesn't have the
above problem, but also an independent job that is not skipped by [DOC].
`needs` works even if all dependent jobs are skipped, so this trick
works well.
This is also useful when we want to change the content of matrix. When
we change one, we usually have to update branches of old pull requests
so that they get newly required jobs. However, with this method, only
`result` jobs are required, so you don't need to update old pull
requests.
I still don't like the fact that now you cannot visualize which matrix
jobs are "Required", but this seems like the best compromise.
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/macos.yml | 8 | ||||
-rw-r--r-- | .github/workflows/ubuntu.yml | 8 | ||||
-rw-r--r-- | .github/workflows/yjit-macos.yml | 8 | ||||
-rw-r--r-- | .github/workflows/yjit-ubuntu.yml | 8 |
4 files changed, 32 insertions, 0 deletions
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 72d0484e54..310fb8206a 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -98,6 +98,14 @@ jobs: SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot if: ${{ failure() }} + result: + if: ${{ always() }} + runs-on: macos-latest + needs: [make] + steps: + - run: exit 1 + if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} + defaults: run: working-directory: build diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 661771c730..613a7a0847 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -117,6 +117,14 @@ jobs: SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot if: ${{ failure() }} + result: + if: ${{ always() }} + runs-on: ubuntu-latest + needs: [make] + steps: + - run: exit 1 + if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} + defaults: run: working-directory: build diff --git a/.github/workflows/yjit-macos.yml b/.github/workflows/yjit-macos.yml index 71522f0a18..c8f71ddcba 100644 --- a/.github/workflows/yjit-macos.yml +++ b/.github/workflows/yjit-macos.yml @@ -107,6 +107,14 @@ jobs: SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot if: ${{ failure() }} + result: + if: ${{ always() }} + runs-on: macos-arm-oss + needs: [make] + steps: + - run: exit 1 + if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} + defaults: run: working-directory: build diff --git a/.github/workflows/yjit-ubuntu.yml b/.github/workflows/yjit-ubuntu.yml index 067041d38b..f9ab9e16ac 100644 --- a/.github/workflows/yjit-ubuntu.yml +++ b/.github/workflows/yjit-ubuntu.yml @@ -173,6 +173,14 @@ jobs: SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot if: ${{ failure() }} + result: + if: ${{ always() }} + runs-on: ubuntu-latest + needs: [make] + steps: + - run: exit 1 + if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} + defaults: run: working-directory: build |