From 0852ad337e628be227678403a478d9ddac587e29 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 9 Feb 2024 17:26:32 -0800 Subject: [PATCH] ci: rewrite the success job This is copied from how rust-lang/miri-test-libstd does it. --- .github/workflows/ci.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81014e7..0a58866 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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) }}'