CI: only use -race with -short, and in parallel

Given that the Linux test job is currently the slowest,
the added parallelism will help.
The full or "long" tests aren't needed to look for races,
as our short tests already cover almost all of our code.
This is a better compromise for CI speed.
This commit is contained in:
Daniel Martí
2026-04-14 11:07:49 +01:00
committed by Paul
parent 093f8688f8
commit a68444505d
+16 -8
View File
@@ -37,10 +37,7 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
cache: false
# linux already runs the tests with -race below, plus extra checks,
# so skip the regular tests to prevent it from taking the longest.
- if: matrix.os != 'ubuntu-latest'
run: go test -timeout=15m ./...
- run: go test -timeout=15m ./...
# macos and windows failures with bincmp can be hard to reproduce locally,
# so upload the binaries as artifacts.
- uses: actions/upload-artifact@v4
@@ -48,10 +45,6 @@ jobs:
with:
name: bincmp_output
path: bincmp_output/
# macos and windows tend to be a bit slower,
# and it's rare that a race in garble would be OS-specific.
- if: matrix.os == 'ubuntu-latest'
run: go test -race -timeout=20m ./...
# Static checks from this point forward. Only run on one Go version and on
# linux, since it's the fastest platform, and the tools behave the same.
@@ -87,3 +80,18 @@ jobs:
go-version: 1.26.x
cache: false
- run: go test -short ./...
# Only run the short tests with -race, because otherwise the overhead is too much.
# We only test on Linux, as races are unlikely to be OS-specific.
# We use GOAMD64=v3 because that significantly speeds up the race detector.
test-race:
runs-on: ubuntu-latest
env:
GOAMD64: v3
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v5
with:
go-version: 1.26.x
cache: false
- run: go test -short -race ./...