From 0852ad337e628be227678403a478d9ddac587e29 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 9 Feb 2024 17:26:32 -0800 Subject: [PATCH 1/3] 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) }}' From bd4269b2b44dfb80b596fc6fb6e86eed5971a07a Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 9 Feb 2024 17:31:36 -0800 Subject: [PATCH 2/3] ci: handle master -> main --- .github/workflows/ci.yml | 3 +-- README.rst | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a58866..2a26d98 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,7 @@ on: push: - branches: [ master ] + branches: [ main ] pull_request: - branches: [ master ] merge_group: name: CI diff --git a/README.rst b/README.rst index 16ec01d..2180c88 100644 --- a/README.rst +++ b/README.rst @@ -16,7 +16,7 @@ __ https://docs.rs/either/ |build_status|_ |crates|_ -.. |build_status| image:: https://github.com/rayon-rs/either/workflows/CI/badge.svg?branch=master +.. |build_status| image:: https://github.com/rayon-rs/either/workflows/CI/badge.svg?branch=main .. _build_status: https://github.com/rayon-rs/either/actions .. |crates| image:: https://img.shields.io/crates/v/either.svg From 6659d0cd2e6389e35175464684bdd60eea5e4269 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 9 Feb 2024 17:37:10 -0800 Subject: [PATCH 3/3] ci: Add a registry cache for git protocol --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a26d98..79c1f3b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,13 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Cache the registry + uses: actions/cache@v4 + if: startsWith(matrix.rust, '1') + with: + path: ~/.cargo/registry/index + key: cargo-${{ matrix.rust }}-git-index + - name: Set up Rust uses: dtolnay/rust-toolchain@master with: