M8: keep the older build beside the CI cache and build it niced
CI built the older release on every run beside the other packages, and the load surfaced timing races elsewhere (the older checks sandbox's cancel, reproduced locally under that load). The Makefile keeps the build in $(GOCACHE)/equipo-m8 when GOCACHE is absolute, as it does for staticcheck, and the build runs niced with two jobs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+10
−1
Makefile+3 −0internal/headless/m8_test.go+7 −1
CI passed — run details
Intent
diff --git a/Makefile b/Makefile| index 528dab19..29980afa 100644 |
| --- a/Makefile |
| +++ b/Makefile |
| @@ -111,6 +111,9 @@ STATICCHECK := honnef.co/go/tools/cmd/staticcheck@v0.7.0 |
| # parent. |
| ifneq ($(filter /%,$(firstword $(GOCACHE))),) |
| export STATICCHECK_CACHE ?= $(GOCACHE)/staticcheck |
| +# The mixed-version test (M8) builds the older release once and keeps it |
| +# beside the build cache, so later runs do not compile it again. |
| +export EQUIPO_M8_CACHE ?= $(GOCACHE)/equipo-m8 |
| endif |
| staticcheck: |
diff --git a/internal/headless/m8_test.go b/internal/headless/m8_test.go| index dbb3ac3b..747a26f1 100644 |
| --- a/internal/headless/m8_test.go |
| +++ b/internal/headless/m8_test.go |
| @@ -109,7 +109,13 @@ func oldBinary(t *testing.T) string { |
| if err := os.WriteFile(overlay, raw, 0600); err != nil { |
| t.Fatal(err) |
| } |
| - build := exec.Command("go", "test", "-c", "-overlay", overlay, "-o", bin+".tmp", "./internal/headless") |
| + // Niced, two compile jobs: the build must not starve the packages |
| + // testing beside it. |
| + args := []string{"go", "test", "-c", "-p", "2", "-overlay", overlay, "-o", bin + ".tmp", "./internal/headless"} |
| + if nice, err := exec.LookPath("nice"); err == nil { |
| + args = append([]string{nice, "-n", "15"}, args...) |
| + } |
| + build := exec.Command(args[0], args[1:]...) |
| build.Dir = src |
| build.Env = append(os.Environ(), "CGO_ENABLED=0", "GOFLAGS=-mod=readonly") |
| if out, err := build.CombinedOutput(); err != nil { |