CI/GHA: cancel outdated CI runs on new PR changes

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
This commit is contained in:
Marc Hoersken 2022-09-17 23:45:32 +02:00
parent fda897f5a1
commit 4e6893307b
No known key found for this signature in database
GPG Key ID: 61E03CBED7BC859E
14 changed files with 62 additions and 23 deletions

View File

@ -5,8 +5,6 @@
name: CodeQL name: CodeQL
on: on:
# Trigger the workflow on push or pull requests, but only for the
# master branch
push: push:
branches: branches:
- master - master
@ -17,6 +15,9 @@ on:
schedule: schedule:
- cron: '0 0 * * 4' - cron: '0 0 * * 4'
concurrency:
group: ${{ github.workflow }}
permissions: permissions:
security-events: write security-events: write

View File

@ -5,8 +5,6 @@
name: Fuzzer name: Fuzzer
on: on:
# Trigger the workflow on push or pull requests, but only for the
# master branch
push: push:
branches: branches:
- master - master
@ -15,6 +13,10 @@ on:
branches: branches:
- master - master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs: jobs:
fuzzing: fuzzing:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -5,11 +5,15 @@
name: Hacktoberfest name: Hacktoberfest
on: on:
# run for all pushes to master branch # this must not ever run on any other branch than master
push: push:
branches: branches:
- master - master
concurrency:
# this should not run in parallel, so just run one at a time
group: ${{ github.workflow }}
permissions: permissions:
# requires issues AND pull-requests write permissions to edit labels on PRs! # requires issues AND pull-requests write permissions to edit labels on PRs!
issues: write issues: write

View File

@ -19,6 +19,10 @@ on:
- '.github/workflows/linkcheck.yml' - '.github/workflows/linkcheck.yml'
- '**.md' - '**.md'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs: jobs:
# Docs: https://github.com/marketplace/actions/markdown-link-check # Docs: https://github.com/marketplace/actions/markdown-link-check
check: check:

View File

@ -5,8 +5,6 @@
name: Linux name: Linux
on: on:
# Trigger the workflow on push or pull requests, but only for the
# master branch
push: push:
branches: branches:
- master - master
@ -15,6 +13,10 @@ on:
branches: branches:
- master - master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs: jobs:
autotools: autotools:
name: ${{ matrix.build.name }} name: ${{ matrix.build.name }}

View File

@ -5,8 +5,6 @@
name: macOS name: macOS
on: on:
# Trigger the workflow on push or pull requests, but only for the
# master branch
push: push:
branches: branches:
- master - master
@ -15,6 +13,10 @@ on:
branches: branches:
- master - master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs: jobs:
autotools: autotools:
name: ${{ matrix.build.name }} name: ${{ matrix.build.name }}

View File

@ -5,8 +5,6 @@
name: Linux name: Linux
on: on:
# Trigger the workflow on push or pull requests, but only for the
# master branch
push: push:
branches: branches:
- master - master
@ -15,6 +13,11 @@ on:
branches: branches:
- master - 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: jobs:
autotools: autotools:
name: ${{ matrix.build.name }} name: ${{ matrix.build.name }}

View File

@ -5,8 +5,6 @@
name: ngtcp2 name: ngtcp2
on: on:
# Trigger the workflow on push or pull requests, but only for the
# master branch
push: push:
branches: branches:
- master - master
@ -15,6 +13,11 @@ on:
branches: branches:
- master - 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: jobs:
autotools: autotools:
name: ${{ matrix.build.name }} name: ${{ matrix.build.name }}

View File

@ -5,8 +5,6 @@
name: ngtcp2 name: ngtcp2
on: on:
# Trigger the workflow on push or pull requests, but only for the
# master branch
push: push:
branches: branches:
- master - master
@ -15,6 +13,11 @@ on:
branches: branches:
- master - 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: jobs:
autotools: autotools:
name: ${{ matrix.build.name }} name: ${{ matrix.build.name }}

View File

@ -5,8 +5,6 @@
name: Linux name: Linux
on: on:
# Trigger the workflow on push or pull requests, but only for the
# master branch
push: push:
branches: branches:
- master - master
@ -15,6 +13,11 @@ on:
branches: branches:
- master - 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: jobs:
autotools: autotools:
name: ${{ matrix.build.name }} name: ${{ matrix.build.name }}

View File

@ -19,6 +19,10 @@ on:
- '.github/workflows/proselint.yml' - '.github/workflows/proselint.yml'
- '**.md' - '**.md'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs: jobs:
check: check:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -6,8 +6,6 @@
name: REUSE compliance name: REUSE compliance
on: on:
# Trigger the workflow on push or pull requests, but only for the
# master branch
push: push:
branches: branches:
- master - master
@ -16,6 +14,10 @@ on:
branches: branches:
- master - master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs: jobs:
check: check:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -5,8 +5,6 @@
name: Linux name: Linux
on: on:
# Trigger the workflow on push or pull requests, but only for the
# master branch
push: push:
branches: branches:
- master - master
@ -15,6 +13,11 @@ on:
branches: branches:
- master - 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: jobs:
autotools: autotools:
name: ${{ matrix.build.name }} name: ${{ matrix.build.name }}

View File

@ -5,8 +5,6 @@
name: Linux name: Linux
on: on:
# Trigger the workflow on push or pull requests, but only for the
# master branch
push: push:
branches: branches:
- master - master
@ -15,6 +13,11 @@ on:
branches: branches:
- master - 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: jobs:
autotools: autotools:
name: ${{ matrix.build.name }} name: ${{ matrix.build.name }}