Merged
Conversation
The test-coverage task was running `go clean -cache` which wipes the entire Go build cache, forcing recompilation of all 197 packages plus dependencies from scratch on every run. This was added to prevent "inconsistent NumStmt" coverage errors from stale instrumented binaries. Switch to `go clean -testcache` which only clears cached test results while preserving compiled packages. This is sufficient to prevent the NumStmt errors since those are caused by stale test binaries, not the build cache itself. Local benchmarks show ~30% reduction in test time (1m28s -> 1m01s) with the build cache warm. On CI the improvement should be significant since the GitHub Actions cache restores the Go build cache between runs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Go test compilation is CPU-bound and parallelizes well across cores. Upgrading from the standard 4-core runner to 8-core should roughly halve compilation time. Larger runners are free for public repos. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Stacklok org runner is named ubuntu-8cores-32gb, not the GitHub standard ubuntu-latest-8-cores. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Codecov and Coveralls upload steps had `if: matrix.os == 'ubuntu-latest'` which doesn't match the new `ubuntu-8cores-32gb` runner. Use `startsWith(matrix.os, 'ubuntu')` so coverage uploads work regardless of which Ubuntu runner variant is used. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
reyortiz3
reviewed
Mar 11, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4081 +/- ##
==========================================
- Coverage 68.68% 68.61% -0.08%
==========================================
Files 453 453
Lines 46011 46011
==========================================
- Hits 31604 31569 -35
- Misses 11967 11999 +32
- Partials 2440 2443 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
JAORMX
approved these changes
Mar 11, 2026
rdimitrov
approved these changes
Mar 11, 2026
reyortiz3
approved these changes
Mar 11, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three changes to reduce CI unit test time from ~7.5 minutes to ~2 minutes:
1. Replace
go clean -cachewithgo clean -testcacheThe
test-coveragetask runsgo clean -cachebefore every test run to prevent "inconsistent NumStmt" coverage errors from stale instrumented binaries. This wipes the entire Go build cache, forcing recompilation of all 197 packages plus all dependencies from scratch — even when the GitHub Actions cache has a warm build cache available.go clean -testcacheonly clears cached test results while preserving compiled packages. This is sufficient to prevent the NumStmt errors since those are caused by stale coverage-instrumented test binaries, not the general build cache.2. Upgrade to 8-core runner
Go test compilation is CPU-bound and parallelizes well across cores. The standard
ubuntu-latestrunner has 4 vCPUs. Upgrading to the org'subuntu-8cores-32gbrunner (8 vCPUs, 32GB RAM) doubles available parallelism for compilation.3. Fix coverage upload conditions
The Codecov and Coveralls upload steps had
if: matrix.os == 'ubuntu-latest'which doesn't match the new runner name. Updated tostartsWith(matrix.os, 'ubuntu')so coverage uploads work regardless of which Ubuntu runner variant is used.CI evidence
ubuntu-8cores-32gbgo clean -testcacheubuntu-latest(4-core)go clean -cacheubuntu-latest(4-core)go clean -cacheubuntu-latest(4-core)go clean -cache~3.8x faster (7m24s average → 1m56s).
Type of change
Test plan
Ran full
task test-coveragelocally withgo clean -testcache— all tests pass, coverage report generates correctly, no "inconsistent NumStmt" errors. CI run on this PR confirms the 1m56s test step time on the 8-core runner.Generated with Claude Code