From e4ab226d874e64bd746ebcfcb72b38d76a98bdc2 Mon Sep 17 00:00:00 2001 From: Axel Heider Date: Tue, 5 Mar 2024 16:43:43 +0100 Subject: [PATCH] CI: cancel older concurrent PR runs - Remove the space in the workflow name to ensure there are no side effects when using it as an identifier. - Act on PRs only, not on upstreaming. Signed-off-by: Axel Heider --- .github/workflows/sel4test-hw.yml | 15 ++++++++++++++- .github/workflows/sel4test-sim.yml | 13 ++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sel4test-hw.yml b/.github/workflows/sel4test-hw.yml index 0723bfb1b..76699f1b1 100644 --- a/.github/workflows/sel4test-hw.yml +++ b/.github/workflows/sel4test-hw.yml @@ -6,7 +6,7 @@ # # See sel4test-hw/builds.yml in the repo seL4/ci-actions for configs. -name: seL4Test HW +name: seL4Test-HW on: # needs PR target for secrets access; guard by requiring label @@ -17,6 +17,19 @@ on: permissions: contents: read +# To reduce the load (especially on the machine queue) we cancel any older runs +# of this workflow for the current PR. Such runs exist, if there were new pushes +# to the PR's branch without waiting for the workflow to finish. As a side +# effect, pushing new commits now becomes a convenient way to cancel all the +# older runs, e.g. if they are stuck and would only be stopped by the timeout +# eventually. +# Note that we could do the concurrency handling at a finer level, and only wrap +# the actual run on the hardware. But there seems not much gain in letting the +# older builds run, as these are usually obsolete with new pushes also. +concurrency: + group: ${{ github.workflow }}-pr-${{ github.event.number }} + cancel-in-progress: true + jobs: hw-build: name: HW Build diff --git a/.github/workflows/sel4test-sim.yml b/.github/workflows/sel4test-sim.yml index 194661929..0198ba8a4 100644 --- a/.github/workflows/sel4test-sim.yml +++ b/.github/workflows/sel4test-sim.yml @@ -6,13 +6,24 @@ # # See sel4test-sim/builds.yml in the repo seL4/ci-actions for configs. -name: seL4Test Sim +name: seL4Test-Sim on: push: branches: [master] pull_request: +# To reduce the load we cancel any older runs of this workflow for the current +# PR. Such runs exist, if there were new pushes to the PR's branch without +# waiting for the workflow to finish. As a side effect, pushing new commits now +# becomes a convenient way to cancel all the older runs, e.g. if they are stuck +# and would only be stopped by the timeout eventually. +# For deployment to the master branch, the workflow will run on each push, no +# skipping or cancellation will practically happen. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || format('run-{0}', github.run_id) }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: simulation: name: Simulation