From 9162696accdc28559fa5e668c4461927900aef67 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 6 Feb 2024 11:40:11 -0800 Subject: [PATCH 1/2] ci: Switch from bors to merge queues The success job is copied from how rust-lang/miri-test-libstd does it. --- .github/workflows/ci.yaml | 21 ++++++++++++++++----- .github/workflows/pr.yaml | 15 +++++++++++++++ Cargo.toml | 2 +- bors.toml | 13 ------------- 4 files changed, 32 insertions(+), 19 deletions(-) delete mode 100644 bors.toml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a61dc0a7..74dea3df 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,9 +1,5 @@ name: CI -on: - push: - branches: - - staging - - trying +on: merge_group jobs: @@ -65,3 +61,18 @@ jobs: with: components: rustfmt - run: cargo fmt --all --check + + # 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: [test, i686, no_std, fmt] + # 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: + # 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) }}' diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 9a40002b..b06639f3 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -27,3 +27,18 @@ jobs: with: components: rustfmt - run: cargo fmt --all --check + + # 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: [test, fmt] + # 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: + # 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) }}' diff --git a/Cargo.toml b/Cargo.toml index dc99d5f0..98350a5b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/rust-num/num-bigint" version = "0.4.4" readme = "README.md" build = "build.rs" -exclude = ["/bors.toml", "/ci/*", "/.github/*"] +exclude = ["/ci/*", "/.github/*"] edition = "2018" [features] diff --git a/bors.toml b/bors.toml deleted file mode 100644 index 163c03ab..00000000 --- a/bors.toml +++ /dev/null @@ -1,13 +0,0 @@ -status = [ - "Test (1.31.0)", - "Test (1.34.0)", - "Test (1.36.0)", - "Test (1.40.0)", - "Test (1.46.0)", - "Test (stable)", - "Test (beta)", - "Test (nightly)", - "Test (i686)", - "No Std", - "Format", -] From 218aceea7856ba8a568ffead76867f877428f589 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 6 Feb 2024 11:41:37 -0800 Subject: [PATCH 2/2] ci: Add a registry cache for git protocol --- .github/workflows/ci.yaml | 5 +++++ .github/workflows/master.yaml | 5 +++++ .github/workflows/pr.yaml | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 74dea3df..62a84930 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,6 +20,11 @@ jobs: ] steps: - uses: actions/checkout@v4 + - uses: actions/cache@v4 + if: startsWith(matrix.rust, '1') + with: + path: ~/.cargo/registry/index + key: cargo-${{ matrix.rust }}-git-index - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust }} diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index c284d890..68c4900d 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -16,6 +16,11 @@ jobs: rust: [1.31.0, stable] steps: - uses: actions/checkout@v4 + - uses: actions/cache@v4 + if: startsWith(matrix.rust, '1') + with: + path: ~/.cargo/registry/index + key: cargo-${{ matrix.rust }}-git-index - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust }} diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index b06639f3..787f9081 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -12,6 +12,11 @@ jobs: rust: [1.31.0, stable] steps: - uses: actions/checkout@v4 + - uses: actions/cache@v4 + if: startsWith(matrix.rust, '1') + with: + path: ~/.cargo/registry/index + key: cargo-${{ matrix.rust }}-git-index - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust }}