Files
meshcore-analyzer/.github/workflows
efiten f4d15f8456 ci: run the server race detector in four shards beside go-test (#2432)
Refs #2424. The Go Build & Test job is the longest path of the pipeline:
23.5 min on #2410's last run, against 10 to 13 min for the E2E shards.
Of that, the server step (`go test -race -coverprofile`) took 21 min.

## Why it is slow

- The server package has 2,364 tests and none call `t.Parallel()`, so
they run one after another in one process.
- Natively, without `-race`, the whole package takes 101 s locally
(Windows, `go test -json`). Under `-race` with coverage on the hosted
runner it takes about 18 min.
- No single test explains it: 2,151 of the tests take under 0.1 s each.
The slowest one, `TestViewshedMatchesReference`, is trimmed separately
in #2431.

## What changes

- **`go-test`**: the server suite runs with coverage only, no `-race`.
Coverage badges and the e2etest step are unchanged.
- **New `server-race-shard` matrix, 4 runners.**
- Each shard builds the race test binary once (`go test -race -c`) and
lists the tests with `-test.list`, keeping `Test`, `Example` and `Fuzz`
names, which is what `go test` runs by default.
  - It runs every fourth name with `-test.run "^(A|B|...)$"`.
- Every test still runs under `-race`, in exactly one shard. A shard
with no tests fails.
- **New `server-race` gate**, built like `e2e-test`: it requires every
shard. `build-and-publish` requires the gate.
- **Tag runs**: the shards skip on a tag run with `images_published`,
the same condition as the E2E shards. The `:edge` commit was already
checked.
- **`tests/unit/test-issue-1956-release-routing.js`** routes both new
jobs. It asserts that a failed shard fails the gate rather than skipping
it, and that a failed shard or gate fails `build-and-publish`.

## Checked locally

Without `-race`, Windows, test binary from this branch:

- The four shard lists hold 591 tests each. Their union is the full list
of 2,364 names, with no duplicates.
- Each shard ran on its own and passed: 16 s, 25 s, 39 s and 33 s. This
shows no test depends on state left behind by a test in another shard,
at least without `-race`.
- Shard 2 run with `-v` reported exactly 591 top-level results.
- Each `-test.run` pattern is about 21 KB, well under Linux's 128 KB
per-argument limit.
- The routing test passes.

## Not checked

- The hosted wall time. The shard times will come from this PR's own
run. Each shard compiles the race build of cgo SQLite itself, because
the go-build cache that `go-test` saves holds non-race objects. I'll
post the measured times in a comment.
- Whether branch protection requires specific check names. The API
answers 404 for me. If "✅ Go Build & Test" is required, "🏁 Race detector
(server)" should be added next to it. Otherwise a race failure turns the
run red but does not block a merge.
2026-11-18 23:05:55 +01:00
..