From f0c41b6135acef81415e1fdf39c559935d336b74 Mon Sep 17 00:00:00 2001 From: Lee-Orr Date: Wed, 28 Feb 2024 11:07:29 -0500 Subject: [PATCH] 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. --- .github/workflows/ci.yml | 4 ++++ .github/workflows/dependencies.yml | 4 ++++ .github/workflows/docs.yml | 1 - .github/workflows/validation-jobs.yml | 5 +++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1eaa00abbd..58685510ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 424f2354c7..ceb0f42b05 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -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 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e8b8282f3c..63de216762 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -4,7 +4,6 @@ on: push: branches: - 'main' - # Allows running the action manually. workflow_dispatch: diff --git a/.github/workflows/validation-jobs.yml b/.github/workflows/validation-jobs.yml index 948435dd60..7e7d2029ac 100644 --- a/.github/workflows/validation-jobs.yml +++ b/.github/workflows/validation-jobs.yml @@ -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