From 4c906e0c7b08bc21acf1ca15dbafccaeff2e5ae1 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 6 Feb 2024 11:52:05 -0800 Subject: [PATCH] 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 3b66850..699c13b 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: @@ -48,3 +44,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, 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 d221a73..eb013bb 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 b017e3f..39de2df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ name = "num-complex" repository = "https://github.com/rust-num/num-complex" version = "0.4.4" 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 67d134f..0000000 --- a/bors.toml +++ /dev/null @@ -1,10 +0,0 @@ -status = [ - "Test (1.31.0)", - "Test (1.36.0)", - "Test (1.54.0)", - "Test (stable)", - "Test (beta)", - "Test (nightly)", - "No Std", - "Format", -]