From 6ddd978e44134febffc857e9cd871982b4c6d36b Mon Sep 17 00:00:00 2001 From: aSemy <897017+aSemy@users.noreply.github.com> Date: Mon, 30 Jan 2023 22:18:43 +0100 Subject: Add concurrency cancellation for test/build GitHub Actions (#2710) 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 --- .github/workflows/check.yml | 4 ++++ .github/workflows/dokka-examples.yml | 4 ++++ .github/workflows/gradle-test.pr.yml | 4 ++++ .github/workflows/qodana.yml | 4 ++++ 4 files changed, 16 insertions(+) (limited to '.github/workflows') diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c6f169dc..a6475749 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -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 diff --git a/.github/workflows/dokka-examples.yml b/.github/workflows/dokka-examples.yml index f1167771..e8782c1c 100644 --- a/.github/workflows/dokka-examples.yml +++ b/.github/workflows/dokka-examples.yml @@ -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: diff --git a/.github/workflows/gradle-test.pr.yml b/.github/workflows/gradle-test.pr.yml index 1a40239c..6a732dfc 100644 --- a/.github/workflows/gradle-test.pr.yml +++ b/.github/workflows/gradle-test.pr.yml @@ -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: diff --git a/.github/workflows/qodana.yml b/.github/workflows/qodana.yml index b77719ea..2975c504 100644 --- a/.github/workflows/qodana.yml +++ b/.github/workflows/qodana.yml @@ -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 -- cgit