ci: warm test-bench cache on push to main#19968
Merged
AskAlexSharov merged 1 commit intomainfrom Mar 18, 2026
Merged
Conversation
test-bench previously only triggered on pull_request, so there was never a base-branch cache on main. Every new PR and merge-queue run started cold, because GitHub's cache isolation only allows fallback to the base branch — not to other PRs or branches. Add push triggers for main and release/** so that after each merge a cache-warming run compiles all test binaries (GOCACHE + GOMODCACHE) and saves them under the main branch scope. PR first-pushes and merge-queue runs can then restore from that warm cache instead of starting cold. On non-pull_request events the benchmark step is skipped and replaced with `go test -run=^$ ./...`, which compiles every test binary but runs nothing. Correctness is already guaranteed by the merge queue before commits land on main, so re-running benchmarks there is unnecessary. Also add workflow_dispatch for manual triggering (required by project guidelines), and document the cache isolation model and the compile-only warming pattern in .github/README.md.
AskAlexSharov
approved these changes
Mar 18, 2026
mh0lt
pushed a commit
that referenced
this pull request
Mar 18, 2026
## Problem `test-bench` only triggered on `pull_request`, so there was never a base-branch cache on `main`. GitHub's cache isolation allows workflow runs to fall back to the base branch — but not to other PRs or branches. Without a `main` cache: - Every new PR's first push starts completely cold (full module download + recompile) - Merge-queue runs (`merge_group`) also start cold — they can read from `main` but not from other PRs - Caches saved during merge-group runs are stored under the temporary `gh-readonly-queue/...` branch and become inaccessible once the merge group completes; they never contribute to `main` ## Fix Add `push` triggers for `main` and `release/**`. After each merge, a cache-warming run compiles all test binaries and saves them under the `main` branch scope. Future PR first-pushes and merge-queue runs restore from that warm cache. On non-`pull_request` events, the benchmark execution step is replaced with `go test -run=^$ ./...` — this compiles every test binary (producing identical GOCACHE entries) but runs nothing. The job always succeeds on `main` because correctness is already guaranteed by the merge queue before the commit lands. Also adds `workflow_dispatch` (required by project guidelines) and documents the cache isolation model and compile-only warming pattern in `.github/README.md`.
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.
Problem
test-benchonly triggered onpull_request, so there was never a base-branch cache onmain. GitHub's cache isolation allows workflow runs to fall back to the base branch — but not to other PRs or branches. Without amaincache:merge_group) also start cold — they can read frommainbut not from other PRsgh-readonly-queue/...branch and become inaccessible once the merge group completes; they never contribute tomainFix
Add
pushtriggers formainandrelease/**. After each merge, a cache-warming run compiles all test binaries and saves them under themainbranch scope. Future PR first-pushes and merge-queue runs restore from that warm cache.On non-
pull_requestevents, the benchmark execution step is replaced withgo test -run=^$ ./...— this compiles every test binary (producing identical GOCACHE entries) but runs nothing. The job always succeeds onmainbecause correctness is already guaranteed by the merge queue before the commit lands.Also adds
workflow_dispatch(required by project guidelines) and documents the cache isolation model and compile-only warming pattern in.github/README.md.