diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a1349535..d189382fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,14 @@ on: permissions: {} +# A newer push to a pull request makes the run for its older commit pointless, so that run is +# cancelled (sonar.yml then marks the analysis of the older commit as skipped). A push to master +# gets a group of its own, its commit, so the runs on master are neither cancelled nor held back +# by one another. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.sha }} + cancel-in-progress: true + jobs: build: name: Build under Build Wrapper diff --git a/.github/workflows/build_bin.yml b/.github/workflows/build_bin.yml index 6eef3c7ed..0c5d65363 100644 --- a/.github/workflows/build_bin.yml +++ b/.github/workflows/build_bin.yml @@ -27,9 +27,17 @@ jobs: # Windows / MSVC # ============================================================ + # A newer push to the same branch or pull request cancels the build of the older commit. The + # groups are set on the build jobs rather than on the workflow, so a publish job that is already + # running is left to finish; with a build cancelled the publish job of that run is skipped. A push + # to master gets a group of its own, its commit, so the builds of master are never cancelled. + windows: name: Windows x64 / MSVC runs-on: windows-2022 + concurrency: + group: ${{ github.workflow }}-windows-${{ github.event_name }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + cancel-in-progress: true steps: - name: Checkout repository @@ -183,6 +191,9 @@ jobs: linux: name: Linux x64 / GCC runs-on: ubuntu-24.04 + concurrency: + group: ${{ github.workflow }}-linux-${{ github.event_name }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} + cancel-in-progress: true steps: - name: Checkout repository