Skip to content

Commit

Permalink
Cancel in progress builds when pushing new commits to the same PR (#28)
Browse files Browse the repository at this point in the history
It also adds a final test job to be able to make it `required`
regardless the values of the matrix
  • Loading branch information
sergicastro authored Nov 11, 2024
1 parent 959f0ce commit bf96217
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Build

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
push:
tags: [ 'v[0-9]+.[0-9]+-tetrate-v[0-9]+' ] # v1.16-tetrate-v7
Expand All @@ -14,7 +18,7 @@ env:
jobs:
# All test running sequentially take around ~2h.
# Sppliting them in groups that take more or less the same time makes PR's readiness faster
test:
test-group:
strategy:
matrix:
label:
Expand All @@ -33,3 +37,20 @@ jobs:
with:
go-version-file: go.mod
- run: make test

# Have a fixed test to run once matrix tests are completed so we can make this required
test:
runs-on: ubuntu-latest
# We need this to run always to force-fail (and not skip) if any needed
# job has failed. Otherwise, a skipped job will not fail the workflow.
if: always()
steps:
- run: |
echo "tests completed"
[ "${{
contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'cancelled') ||
contains(needs.*.result, 'skipped')
}}" == "false" ] || exit 1
needs:
- test-group

0 comments on commit bf96217

Please sign in to comment.