about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-14 11:21:27 +0000
committerbors <bors@rust-lang.org>2024-03-14 11:21:27 +0000
commite77d7a3f378be6ca894081eff5ed0379425f8d28 (patch)
tree0f8623eec839014884093900fbf6ebf285d85c8e
parenta75e271a65ff36a71dd4372551653ea3aca6e85d (diff)
parent11c2bad059ace0c61611fdf93c2426c2dafca039 (diff)
downloadrust-e77d7a3f378be6ca894081eff5ed0379425f8d28.tar.gz
rust-e77d7a3f378be6ca894081eff5ed0379425f8d28.zip
Auto merge of #12477 - Kobzol:ci-concurrency-group, r=flip1995
CI: replace `cancel-outdated-builds` with `concurrency` group

This is the last remaining [usage](https://github.com/search?q=org%3Arust-lang%20cancel-outdated-builds&type=code) of the [cancel-outdated-builds](https://github.com/rust-lang/simpleinfra/tree/master/github-actions/cancel-outdated-builds) CI action. Which means that if we remove its usage, we can remove the code of the action :)

This action was replaced in `rust-lang/rust` with the native Github Actions `concurrency` group [last year](https://github.com/rust-lang/rust/pull/112955).

Note that unlike `rust-lang/rust`, which explicitly allows parallel try builds, `clippy` did not allow them, as all steps of the `clippy_bors.yaml` workflow used the `cancel-outdated-builds` action, regardless of the branch. So the new `concurrency` group mirrors that, which makes it a bit simpler than on `rust-lang/rust`.

changelog: none

r? `@Mark-Simulacrum`
-rw-r--r--.github/workflows/clippy.yml10
-rw-r--r--.github/workflows/clippy_bors.yml25
2 files changed, 11 insertions, 24 deletions
diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml
index 603f91a910b..8179e3e65b5 100644
--- a/.github/workflows/clippy.yml
+++ b/.github/workflows/clippy.yml
@@ -26,6 +26,12 @@ env:
   NO_FMT_TEST: 1
   CARGO_INCREMENTAL: 0
 
+concurrency:
+  # For a given workflow, if we push to the same PR, cancel all previous builds on that PR.
+  # If the push is not attached to a PR, we will cancel all builds on the same branch.
+  group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
+  cancel-in-progress: true
+
 jobs:
   base:
     # NOTE: If you modify this job, make sure you copy the changes to clippy_bors.yml
@@ -33,10 +39,6 @@ jobs:
 
     steps:
     # Setup
-    - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
-      with:
-        github_token: "${{ secrets.github_token }}"
-
     - name: Checkout
       uses: actions/checkout@v4
 
diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml
index 0bc28c1f9d9..94515987eba 100644
--- a/.github/workflows/clippy_bors.yml
+++ b/.github/workflows/clippy_bors.yml
@@ -12,6 +12,11 @@ env:
   NO_FMT_TEST: 1
   CARGO_INCREMENTAL: 0
 
+concurrency:
+  # For a given workflow, if we push to the same branch, cancel all previous builds on that branch.
+  group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
+  cancel-in-progress: true
+
 defaults:
   run:
     shell: bash
@@ -21,10 +26,6 @@ jobs:
     runs-on: ubuntu-latest
 
     steps:
-    - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
-      with:
-        github_token: "${{ secrets.github_token }}"
-
     - name: Checkout
       uses: actions/checkout@v4
       with:
@@ -67,10 +68,6 @@ jobs:
     # NOTE: If you modify this job, make sure you copy the changes to clippy.yml
     steps:
     # Setup
-    - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
-      with:
-        github_token: "${{ secrets.github_token }}"
-
     - name: Checkout
       uses: actions/checkout@v4
 
@@ -131,10 +128,6 @@ jobs:
 
     steps:
      # Setup
-    - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
-      with:
-        github_token: "${{ secrets.github_token }}"
-
     - name: Checkout
       uses: actions/checkout@v4
 
@@ -155,10 +148,6 @@ jobs:
 
     steps:
     # Setup
-    - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
-      with:
-        github_token: "${{ secrets.github_token }}"
-
     - name: Checkout
       uses: actions/checkout@v4
 
@@ -211,10 +200,6 @@ jobs:
 
     steps:
     # Setup
-    - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
-      with:
-        github_token: "${{ secrets.github_token }}"
-
     - name: Checkout
       uses: actions/checkout@v4