]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
CI/GHA: cancel outdated CI runs on new PR changes
authorMarc Hoersken <info@marc-hoersken.de>
Sat, 17 Sep 2022 21:45:32 +0000 (23:45 +0200)
committerMarc Hoersken <info@marc-hoersken.de>
Mon, 19 Sep 2022 19:21:04 +0000 (21:21 +0200)
Avoid letting outdated CI runs continue if a PR receives
new changes. Outside a PR we let them continue running
by tying the concurrency to the commit hash instead.

Also only let one CodeQL or Hacktoberfest job run at a time.

Other CI platforms we use have this build in, but GitHub
unfortunately neither by default nor with a simple option.

This saves CI resources and therefore a little energy.

Approved-by: Daniel Stenberg
Approved-by: Max Dymond
Closes #9533

14 files changed:
.github/workflows/codeql-analysis.yml
.github/workflows/fuzz.yml
.github/workflows/hacktoberfest-accepted.yml
.github/workflows/linkcheck.yml
.github/workflows/linux.yml
.github/workflows/macos.yml
.github/workflows/msh3.yml
.github/workflows/ngtcp2-gnutls.yml
.github/workflows/ngtcp2-wolfssl.yml
.github/workflows/openssl3.yml
.github/workflows/proselint.yml
.github/workflows/reuse.yml
.github/workflows/torture.yml
.github/workflows/wolfssl.yml

index 7309753bb6602b11c482bca5b4721c0b37cc9120..1d2792242af692046a0823c7de4ddd4c8f2d5124 100644 (file)
@@ -5,8 +5,6 @@
 name: CodeQL
 
 on:
-  # Trigger the workflow on push or pull requests, but only for the
-  # master branch
   push:
     branches:
     - master
@@ -17,6 +15,9 @@ on:
   schedule:
     - cron: '0 0 * * 4'
 
+concurrency:
+  group: ${{ github.workflow }}
+
 permissions:
   security-events: write
 
index c6512faf0a481c3149bcb7b743185a0c603425b2..ca07fa699b1fbba0fb2607331e671c8d052ce75c 100644 (file)
@@ -5,8 +5,6 @@
 name: Fuzzer
 
 on:
-  # Trigger the workflow on push or pull requests, but only for the
-  # master branch
   push:
     branches:
     - master
@@ -15,6 +13,10 @@ on:
     branches:
     - master
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
+  cancel-in-progress: true
+
 jobs:
   fuzzing:
     runs-on: ubuntu-latest
index cb84ed9892bbf4aacad99dc381c29ac9ece42739..59aca121888c959f0e089d4901c2c668f30ab12e 100644 (file)
@@ -5,11 +5,15 @@
 name: Hacktoberfest
 
 on:
-  # run for all pushes to master branch
+  # this must not ever run on any other branch than master
   push:
     branches:
     - master
 
+concurrency:
+  # this should not run in parallel, so just run one at a time
+  group: ${{ github.workflow }}
+
 permissions:
   # requires issues AND pull-requests write permissions to edit labels on PRs!
   issues: write
index 4517ef7c0497f97421693de6347d53ccfad895fe..9ee7f04e10da93928f5cab519da8f3db4a24b718 100644 (file)
@@ -19,6 +19,10 @@ on:
     - '.github/workflows/linkcheck.yml'
     - '**.md'
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
+  cancel-in-progress: true
+
 jobs:
   # Docs: https://github.com/marketplace/actions/markdown-link-check
   check:
index b2397f3cc235f9814f766c25a18f631f8751818f..959e2bc1be00d97f4873c8d5947e2c117c5c89df 100644 (file)
@@ -5,8 +5,6 @@
 name: Linux
 
 on:
-  # Trigger the workflow on push or pull requests, but only for the
-  # master branch
   push:
     branches:
     - master
@@ -15,6 +13,10 @@ on:
     branches:
     - master
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
+  cancel-in-progress: true
+
 jobs:
   autotools:
     name: ${{ matrix.build.name }}
index ea87b8425806c2e33efd3a5b0fd3a5d43c773534..6fa5bfbe8e0ccd2d5ac6848ec707c25c628c5ec8 100644 (file)
@@ -5,8 +5,6 @@
 name: macOS
 
 on:
-  # Trigger the workflow on push or pull requests, but only for the
-  # master branch
   push:
     branches:
     - master
@@ -15,6 +13,10 @@ on:
     branches:
     - master
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
+  cancel-in-progress: true
+
 jobs:
   autotools:
     name: ${{ matrix.build.name }}
index 6a061c701fdd9d5778d1a50ef724436d1d3e92d4..b58be815a8b6e3ff4c63aae47dbd8e42be610aa8 100644 (file)
@@ -5,8 +5,6 @@
 name: Linux
 
 on:
-  # Trigger the workflow on push or pull requests, but only for the
-  # master branch
   push:
     branches:
     - master
@@ -15,6 +13,11 @@ on:
     branches:
     - master
 
+concurrency:
+  # Hardcoded workflow filename as workflow name above is just Linux again
+  group: msh3-${{ github.event.pull_request.number || github.sha }}
+  cancel-in-progress: true
+
 jobs:
   autotools:
     name: ${{ matrix.build.name }}
index fcd209f4b809984f9b4e46cb0af81df7ac2afc0e..41a414981fd3cc9c7d041e9d3a194557b28a719b 100644 (file)
@@ -5,8 +5,6 @@
 name: ngtcp2
 
 on:
-  # Trigger the workflow on push or pull requests, but only for the
-  # master branch
   push:
     branches:
     - master
@@ -15,6 +13,11 @@ on:
     branches:
     - master
 
+concurrency:
+  # Hardcoded workflow filename as workflow name above is just Linux again
+  group: ngtcp2-gnutls-${{ github.event.pull_request.number || github.sha }}
+  cancel-in-progress: true
+
 jobs:
   autotools:
     name: ${{ matrix.build.name }}
index 1c25283bbad53847a55f483c0eb506b67deee0d8..da6594aa2a7e4cd3fcdcd790d81c23af13af44cb 100644 (file)
@@ -5,8 +5,6 @@
 name: ngtcp2
 
 on:
-  # Trigger the workflow on push or pull requests, but only for the
-  # master branch
   push:
     branches:
     - master
@@ -15,6 +13,11 @@ on:
     branches:
     - master
 
+concurrency:
+  # Hardcoded workflow filename as workflow name above is just Linux again
+  group: ngtcp2-wolfssl-${{ github.event.pull_request.number || github.sha }}
+  cancel-in-progress: true
+
 jobs:
   autotools:
     name: ${{ matrix.build.name }}
index 783810407451d441fdbd5d679cbb4d777079ba08..a0881722d052948bb30a2cc5a50d2b5590e8c793 100644 (file)
@@ -5,8 +5,6 @@
 name: Linux
 
 on:
-  # Trigger the workflow on push or pull requests, but only for the
-  # master branch
   push:
     branches:
     - master
@@ -15,6 +13,11 @@ on:
     branches:
     - master
 
+concurrency:
+  # Hardcoded workflow filename as workflow name above is just Linux again
+  group: openssl3-${{ github.event.pull_request.number || github.sha }}
+  cancel-in-progress: true
+
 jobs:
   autotools:
     name: ${{ matrix.build.name }}
index 3152a48d064b6d625c0f100b8cd19ddd5556833c..c7b32ccae046634dbe5df30596c9da7ce7872f46 100644 (file)
@@ -19,6 +19,10 @@ on:
     - '.github/workflows/proselint.yml'
     - '**.md'
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
+  cancel-in-progress: true
+
 jobs:
   check:
     runs-on: ubuntu-latest
index 23e019fc8234f4480d65974a7ffe05ca748d215f..c9fb48ca66931b458320486afb699aa1b57a08a7 100644 (file)
@@ -6,8 +6,6 @@
 name: REUSE compliance
 
 on:
-  # Trigger the workflow on push or pull requests, but only for the
-  # master branch
   push:
     branches:
     - master
@@ -16,6 +14,10 @@ on:
     branches:
     - master
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
+  cancel-in-progress: true
+
 jobs:
   check:
     runs-on: ubuntu-latest
index c73a4aee5c9311bd31addd3436276fa0e8805907..706f5530e3a3d3afd1e4719036b39c666f0cdd74 100644 (file)
@@ -5,8 +5,6 @@
 name: Linux
 
 on:
-  # Trigger the workflow on push or pull requests, but only for the
-  # master branch
   push:
     branches:
     - master
@@ -15,6 +13,11 @@ on:
     branches:
     - master
 
+concurrency:
+  # Hardcoded workflow filename as workflow name above is just Linux again
+  group: torture-${{ github.event.pull_request.number || github.sha }}
+  cancel-in-progress: true
+
 jobs:
   autotools:
     name: ${{ matrix.build.name }}
index aa08a79018aa8b7b27b4f959351eb6e323a2eb22..d6bd0aded3afa1ab4df8db1521dc8072fea6b61b 100644 (file)
@@ -5,8 +5,6 @@
 name: Linux
 
 on:
-  # Trigger the workflow on push or pull requests, but only for the
-  # master branch
   push:
     branches:
     - master
@@ -15,6 +13,11 @@ on:
     branches:
     - master
 
+concurrency:
+  # Hardcoded workflow filename as workflow name above is just Linux again
+  group: wolfssl-${{ github.event.pull_request.number || github.sha }}
+  cancel-in-progress: true
+
 jobs:
   autotools:
     name: ${{ matrix.build.name }}