Cancel in progress builds when pushing new commits to the same PR #59
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
pull_request: | |
branches: | |
- main | |
- release-** | |
env: | |
GOPROXY: https://proxy.golang.org | |
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-group: | |
strategy: | |
matrix: | |
label: | |
- "group:1" | |
- "group:2" | |
- "group:3" | |
- "group:4" | |
- "group:5" | |
runs-on: ubuntu-latest | |
env: | |
PLATFORMS: linux/amd64 | |
TEST_LABEL: ${{ matrix.label }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
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 |