add cancel in progress support to automated CI checks (#11130)

# Objective

When working on PRs, I'll often find that one of the early CI checks
fails, and work on fixing the result, but when I push the earlier
commits are still being processed by the CI. This would mean that if a
new commit is pushed while another CI process is already running on that
branch, the first set of jobs will be cancelled - reducing wasted
resources and wait time for CI on the latest commits.

## Solution

The solution is simply adding Github's concurrency groups to every
relevant workflow.
This commit is contained in:
Lee-Orr 2024-02-28 11:07:29 -05:00 committed by GitHub
parent 557e582ec5
commit f0c41b6135
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 1 deletions

View file

@ -11,6 +11,10 @@ env:
CARGO_TERM_COLOR: always
NIGHTLY_TOOLCHAIN: nightly
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: ${{github.event_name == 'pull_request'}}
jobs:
build:
strategy:

View file

@ -12,6 +12,10 @@ on:
branches:
- main
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: ${{github.event_name == 'pull_request'}}
env:
CARGO_TERM_COLOR: always

View file

@ -4,7 +4,6 @@ on:
push:
branches:
- 'main'
# Allows running the action manually.
workflow_dispatch:

View file

@ -7,6 +7,11 @@ on:
branches:
- main
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: ${{github.event_name == 'pull_request'}}
env:
CARGO_TERM_COLOR: always
NIGHTLY_TOOLCHAIN: nightly