Skip to content

ci: refresh the Go cache every night and drop the pnpm store cache - #3275

Merged
fforootd merged 2 commits into
mainfrom
claude/ci-performance-analysis-b7aae7
Nov 24, 2026
Merged

fforootd merged 2 commits into
mainfrom
claude/ci-performance-analysis-b7aae7

Conversation

@fforootd

@fforootd fforootd commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Two caching changes in ci.yml, from a review of all 996 full-pr runs and 835 turbo run summaries since the turbo cutover (Nov 12–24).

Go cache: a fresh entry every night. setup-go's cache keys on the go.sum hash, and a key keeps its first save. So main's entry has not changed since Nov 16; the Nov 24 nightly logged Cache hit occurred on the primary key … not saving cache. As main moved on, every run recompiled more:

Median, PR runs where the journeys ran Nov 16 (entry saved that night) Nov 23 (7 days old)
A server cross-compile (build-binary) 17 s 82 s
Journeys can start 15 s 127 s
PR job, all passing PRs 4.45 min 6.0 min

When go.sum does change, pull requests restore nothing until the nightly saves the new key. Each one then saves its own ~1.5 GB entry. On Nov 13, 129 jobs compiled Go from empty caches.

Now:

  • setup-go runs with cache: false.
  • Pull requests and merge groups restore the newest ci-go-<os>-<arch>-<go version>-… entry through the restore-keys prefix.
  • Only the nightly saves, under a key holding its run id. It skips the restore, so each entry is one full build of main (about 2 GB), at most a day old.
  • The restore stays before anything runs turbo, which fills the module cache.

pnpm: no store cache. On the 32-core arm runner a cold pnpm install --frozen-lockfile logs downloaded 2622 … Done in 7.6s. Restoring the 1.2 GB store takes 14 s, plus 8 s for the install, and a miss adds a 10 s save. That is about 10 s per job, and it frees the 68 store entries (78 GB of the repo's 107 GB Actions cache).

Measured on one replayed pull request (below): the job took 410 s instead of 464 s. For the median pull request, the Nov 16–17 numbers suggest about 4.5 min instead of 6; that part is an estimate, not a measurement.

Measurement

Three runs of each side, started with workflow_dispatch on two scratch branches (no pull request, no Vercel preview):

  • Before: this PR's base (8c89cd3) with main's caching. Each run restored main's setup-go entry from Nov 16 and the pnpm store.
  • After: this branch. A first run did what the nightly will do: every task forced, no Go cache restored, then saved ci-go-Linux-ARM64-1.26.9-45451147310-1 (1.98 GB). Each measured run restored it.
  • The change under test: feat: cancel expired invitations through the API and the CLI #3246 (Go service and storage code, the CLI, the mock API, the Go client), re-applied on a commit that reverts it. A warm run on that commit filled turbo's remote cache for each side's ci.yml. The measured runs compared --affected with it and read the remote cache without writing, so all six executed the same 175 of 181 tasks.
Seconds, median of 3 (range) Before After
Setup before turbo 73 (72–81) 58 (52–62)
Go cache restore 26 (inside setup-go) 24 (22–24)
pnpm store restore and install 24 12
@zitadel/server#build 120 (115–121) 65 (64–69)
A cross-compile (build-binary) 120 (115–130) 64 (62–64)
Journeys can start 217 (208–223) 163 (152–166)
test:unit / test:postgres / test:sqlite 169 / 157 / 164 123 / 109 / 117
turbo run 385 (374–396) 343 (328–344)
Whole job 464 (451–485) 410 (388–413)
  • How much a pull request saves depends on what it changes. feat: cancel expired invitations through the API and the CLI #3246 changes internal/service, which much of the server imports, so even with a fresh cache a cross-compile took 64 s. For the median pull request on Nov 16, it took 17 s.
  • The after side is slightly optimistic: its entry was built from the exact commit under the change, while the real nightly can be up to a day behind a pull request's base.
  • Restoring the new 1.98 GB entry takes about as long as setup-go's restore of its 1.97 GB entry. The setup saving is the pnpm store.
  • In the warm runs, which force every task, the 8-day-old entry built the server in 115 s, and no Go cache at all in 114 s.
  • Runs: before 1, 2, 3; after 1, 2, 3; warm runs before (its test:pow failed; the measured runs do not include that task) and after.

Validation

  • The workflow parses (Ruby's YAML), and the step order and if: conditions were checked. No workflow linter was run (none installed).
  • setup-go v7 sets go-version, GOCACHE and GOMODCACHE before and regardless of its own cache (src/main.ts, setGoEnvOutputs). The steps take the cache paths from those outputs.
  • node scripts/check-pr-title.mjs passes.
  • This PR's own run: ci.yml is a global dependency, so every task runs. No ci-go- entry exists yet, so Go compiles without a cache.
  • Only a scheduled run saves. The measurement ran the save and restore steps through a dispatch input instead: the warm run logged Cache saved with key: ci-go-Linux-ARM64-1.26.9-45451147310-1, and each measured run Cache restored from key: that key. To check after the merge:
    • The next nightly logs Cache saved with key: ci-go-Linux-ARM64-<version>-<run id>-1.
    • The next pull request logs Cache restored from key: ci-go-….

Release notes / changeset

No changeset required — no shipped behavior changed.

Notes

  • Until the first nightly after the merge, pull requests compile Go without a cache. That costs about what the 8-day-old entry costs now: about 80 s for a cross-compile either way.
  • GitHub evicts an entry after 7 days without a restore, so about a week of nightly entries (about 2 GB each) exists at a time.
  • artifacts.yml, scaffold-advisories.yml, spanner.yml and release-publish.yml still use setup-go's go.sum-keyed cache and are untouched here.

setup-go's cache keys on go.sum and a key keeps its first save, so
main's Go cache stayed at its Nov 16 save and every pull request
recompiled more each day main moved on: the server cross-compiles went
from 17 s to 82 s (median) and pull requests from 4.45 to 6.0 minutes.
Pull requests and merge groups now restore the newest entry the nightly
saves under a key of its own each night, from a build that starts with
empty caches.

A cold pnpm install takes about 8 s on the arm runner, less than
restoring the 1.2 GB store (14 s), and a miss added a 10 s save, so the
pnpm store is no longer cached.
Copilot AI balanced review requested due to automatic review settings November 24, 2026 07:32
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloud Ready Ready Preview Nov 24, 2026 7:43am UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-11-24T07:36:12.327407Z f00ed0e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ No Changeset found

Latest commit: f741075

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A documentation nit remains in docs/design/build/turborepo.md where the described nightly cache behavior is ambiguous/self-contradictory and needs clarification to avoid confusion.

1 open issue
What changed in this PR

Updates CI caching to keep Go builds fast over time by restoring a fresh nightly Go cache for PR/merge-group runs, while removing pnpm store caching that is slower to restore than a cold install on the ARM runner.

Changes:

  • Rework Go caching in ci.yml to restore the newest nightly cache for PR/merge-group runs and save only on scheduled nightly runs.
  • Drop pnpm store caching from setup-node to reduce restore/save overhead and cache storage pressure.
  • Update Turborepo CI documentation to match the new caching behavior.
File Description
docs/​design/​build/​turborepo.md Updates Turborepo/CI documentation to describe the revised Go cache restore behavior and the decision to stop caching the pnpm store.
.github/​workflows/​ci.yml Adjusts the CI workflow to disable setup-go’s built-in caching in favor of nightly-saved Go caches restored for PR/merge-group runs, and removes pnpm store caching.

Review effort: Balanced
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

Comment thread docs/design/build/turborepo.md Resolved
@fforootd
fforootd added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit 5304574 Nov 24, 2026
18 checks passed
@fforootd
fforootd deleted the claude/ci-performance-analysis-b7aae7 branch November 24, 2026 18:40
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Nov 24, 2026

This branch was successfully deployed

1 active deployment
Preview — f7410759 Deployed Nov 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants