Skip to content

Commit

Permalink
Add concurrency cancellation for test/build GitHub Actions (#2710)
Browse files Browse the repository at this point in the history
The GitHub Actions build queue can get 'stacked up' if there are a few smaller commits in quick succession. Since the actions take some time, some small commits can cause the GHA build queue to get congested.

This adds a 'concurrency' check for GitHub actions. It means that if a newer trigger comes in (for example, if you make two commits in a row on a PR), then the first job will be cancelled, allowing for the new job to run.

This helps save energy, and for faster feedback in PRs.

Reference docs: https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
  • Loading branch information
aSemy authored and atyrin committed Feb 6, 2023
1 parent dd5eadb commit c18df6f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/check.yml
Expand Up @@ -2,6 +2,10 @@ name: Check

on: pull_request

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
validate-wrapper:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/dokka-examples.yml
Expand Up @@ -2,6 +2,10 @@ name: Build examples

on: pull_request

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
build:
strategy:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/gradle-test.pr.yml
Expand Up @@ -2,6 +2,10 @@ name: Test

on: pull_request

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
test-ubuntu:
strategy:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/qodana.yml
Expand Up @@ -7,6 +7,10 @@ on:
branches:
- master

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
inspection:
runs-on: ubuntu-latest
Expand Down

0 comments on commit c18df6f

Please sign in to comment.