github: constrain triggers for longer builds

The previous trigger would start duplicate builds for each new
label added to a PR. This commit locks this down a bit more so
that builds only run when the trigger label is added or on other
triggers when the label is present.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
This commit is contained in:
Gerwin Klein 2021-07-19 10:27:52 +10:00 committed by Gerwin Klein
parent 52a89f9e0f
commit bd9a8b2ff7
2 changed files with 14 additions and 3 deletions

View file

@ -12,7 +12,11 @@ jobs:
cproof:
name: C Proofs
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'proof-test')
# run on any normal trigger when the label exists, and run when the label is added
# don't run again when other labels are added
if: ${{ github.event.action != 'labeled' &&
contains(github.event.pull_request.labels.*.name, 'proof-test') ||
github.event.action == 'labeled' && github.event.label == 'proof-test' }}
strategy:
fail-fast: false
matrix:

View file

@ -18,6 +18,8 @@ jobs:
sim:
name: Simulation
runs-on: ubuntu-latest
# do not re-run on PR labelling (already runs on other triggers):
if: ${{ github.event_name != 'pull_request' || github.event.action != 'labeled' }}
strategy:
matrix:
march: [armv6a, armv7a, armv8a, nehalem, rv32imac, rv64imac]
@ -36,8 +38,13 @@ jobs:
hw-build:
name: HW Build
runs-on: ubuntu-latest
if: ${{ github.event.name == 'push' ||
contains(github.event.pull_request.labels.*.name, 'hw-build') }}
if: ${{ github.event_name == 'push' ||
github.event_name == 'pull_request' &&
github.event.action != 'labeled' &&
contains(github.event.pull_request.labels.*.name, 'hw-build') ||
github.event_name == 'pull_request' &&
github.event.action == 'labeled' &&
github.event.label == 'hw-build' }}
strategy:
fail-fast: false
matrix: