18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 22:44:59 +01:00

ci: cancel the builds of a commit superseded by a newer push

A push to a pull request or to a branch started new runs of the Build and Build binaries workflows while the runs for the older commit went on to the end, holding the runners for results nobody needs.

The Build workflow now has a concurrency group per pull request, and the build jobs of Build binaries one per branch or pull request, with cancel-in-progress: the run for the older commit is cancelled when a newer one starts. Pushes to master get a group of their own (the commit), so the runs on master are neither cancelled nor held back by one another. In Build binaries the groups are on the build jobs, not on the workflow, so a publish job already running is left to finish.

sonar.yml needs no change: it already posts an error status (analysis skipped) on the commit of a cancelled Build run, and the newer commit gets its own pending status and analysis.
This commit is contained in:
jerrrrycho
2026-11-11 10:16:23 +01:00
parent 5bac4e1cf1
commit 963791e3f3
2 changed files with 19 additions and 0 deletions

View File

@@ -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