From 33bd355db24de0d80f7d55139d899bd1426186cb Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 6 Feb 2024 12:42:50 -0800 Subject: [PATCH 1/3] 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 | 10 ---------- 4 files changed, 32 insertions(+), 16 deletions(-) delete mode 100644 bors.toml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 005509db0..72b510429 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: @@ -59,3 +55,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, no_std_131, no_std_stable, 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 d221a73db..eb013bbcc 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 08f5f156e..a5fb1bd05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/rust-num/num" name = "num" version = "0.4.1" readme = "README.md" -exclude = ["/bors.toml", "/ci/*", "/.github/*"] +exclude = ["/ci/*", "/.github/*"] edition = "2018" [package.metadata.docs.rs] diff --git a/bors.toml b/bors.toml deleted file mode 100644 index 82e9ad2ce..000000000 --- a/bors.toml +++ /dev/null @@ -1,10 +0,0 @@ -status = [ - "Test (1.31.0)", - "Test (1.36.0)", - "Test (stable)", - "Test (beta)", - "Test (nightly)", - "No Std (1.31.0)", - "No Std (stable)", - "Format", -] From d0c41bd5bc3830ab42135ecd2f6300ed1cc06aae Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 6 Feb 2024 12:44:15 -0800 Subject: [PATCH 2/3] ci: Add a registry cache for git protocol --- .github/workflows/ci.yaml | 9 +++++++++ .github/workflows/master.yaml | 5 +++++ .github/workflows/pr.yaml | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 72b510429..890399522 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,6 +17,11 @@ jobs: ] steps: - uses: actions/checkout@v3 + - 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 }} @@ -40,6 +45,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/cache@v4 + with: + path: ~/.cargo/registry/index + key: cargo-1.31.0-git-index - uses: dtolnay/rust-toolchain@1.31.0 with: target: thumbv6m-none-eabi diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index 98e8f8e09..6b7a4cb80 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@v3 + - 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 eb013bbcc..303e5039c 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@v3 + - 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 }} From 877388888bc788b2541a88bbf2764d6721e65e6e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 6 Feb 2024 12:44:31 -0800 Subject: [PATCH 3/3] ci: upgrade to actions/checkout@v4 --- .github/workflows/ci.yaml | 8 ++++---- .github/workflows/master.yaml | 2 +- .github/workflows/pr.yaml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 890399522..a948577b9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,7 +16,7 @@ jobs: nightly ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/cache@v4 if: startsWith(matrix.rust, '1') with: @@ -33,7 +33,7 @@ jobs: name: No Std (stable) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: target: thumbv6m-none-eabi @@ -44,7 +44,7 @@ jobs: name: No Std (1.31.0) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/cache@v4 with: path: ~/.cargo/registry/index @@ -59,7 +59,7 @@ jobs: name: Format runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@1.62.0 with: components: rustfmt diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index 6b7a4cb80..68c4900de 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -15,7 +15,7 @@ jobs: matrix: rust: [1.31.0, stable] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/cache@v4 if: startsWith(matrix.rust, '1') with: diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 303e5039c..787f90816 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -11,7 +11,7 @@ jobs: matrix: rust: [1.31.0, stable] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/cache@v4 if: startsWith(matrix.rust, '1') with: @@ -27,7 +27,7 @@ jobs: name: Format runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@1.62.0 with: components: rustfmt