Skip to content

feat(ci): warm Next.js builds via Turbopack persistent cache on a sticky disk#5869

Merged
waleedlatif1 merged 2 commits into
stagingfrom
ci/turbopack-warm-build
Jul 23, 2026
Merged

feat(ci): warm Next.js builds via Turbopack persistent cache on a sticky disk#5869
waleedlatif1 merged 2 commits into
stagingfrom
ci/turbopack-warm-build

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Enable Next 16's Turbopack persistent build cache (experimental.turbopackFileSystemCacheForBuild, beta) behind a NEXT_TURBOPACK_BUILD_CACHE env gate — only the CI check build opts in; production image builds keep the default cold path until the feature stabilizes
  • Mount ./apps/sim/.next/cache as a Blacksmith sticky disk via the existing cache-mount action (same event/fork namespacing as the other mounts) — the Turbopack cache is ~5 GB, which sticky disks mount in ~1s while an actions/cache round-trip would eat the warm-build win; the GitHub-fallback path inside cache-mount still works
  • Measured locally on this repo: 105s cold compile → 22s warm (4.8×). The Build App check is the merge gate (~3m40s, compile is ~80% of it), so this is direct merge-wait reduction; expect the effect from the second run onward as the disk warms
  • Follow-up to fix(ci): save the Next.js build cache every run instead of freezing it at the lockfile key #5859 (which fixed the frozen actions/cache keying but revealed the cache carried almost nothing without the Turbopack flag)

Type of Change

  • Improvement

Testing

Local A/B: cold build 105s (cache written, 4.8 GB), immediate rebuild 22.1s, byte-identical route table. This PR's own Build App run is cold (first sticky-disk fill); subsequent runs on the branch/staging show the warm number.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…cky disk

- enable experimental.turbopackFileSystemCacheForBuild behind
  NEXT_TURBOPACK_BUILD_CACHE so only the CI check build opts in; production
  image builds stay on the default cold path until the feature stabilizes
- mount ./apps/sim/.next/cache as a Blacksmith sticky disk (cache-mount)
  instead of actions/cache: the turbopack cache is ~5 GB, which a sticky disk
  mounts in ~1s while an actions/cache round-trip would eat the win
- measured locally: 105s cold compile vs 22s warm (4.8x)
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jul 23, 2026 12:08am

Request Review

@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
CI and opt-in Next experimental build caching only; production builds are unchanged and there is no auth or data-path impact.

Overview
Speeds up the Build App merge gate by turning on Turbopack’s persistent build cache for that CI job only, and persisting the large .next/cache output on a sticky disk instead of actions/cache.

The Build App workflow now mounts ./apps/sim/.next/cache through the same cache-mount action as other caches (event/fork namespacing unchanged), replacing the per-run actions/cache restore that was costly for a ~5 GB Turbopack cache. The build step sets NEXT_TURBOPACK_BUILD_CACHE=1, which gates experimental.turbopackFileSystemCacheForBuild in next.config.ts. Production/image builds keep the default cold path because they do not set that env var.

Reviewed by Cursor Bugbot for commit 4790a49. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR speeds up CI builds with Next.js Turbopack’s persistent filesystem cache. The main changes are:

  • Mount the Next.js build cache on the existing provider-aware sticky disk.
  • Enable the persistent Turbopack cache only for the CI build check.
  • Keep production image builds on the default cold-build path.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
.github/workflows/test-build.yml Moves the Next.js build cache to the shared cache-mount action and opts the CI build into persistent Turbopack caching.
apps/sim/next.config.ts Adds an environment-controlled switch for Turbopack’s persistent build cache.

Reviews (2): Last reviewed commit: "chore(ci): drop the superseded actions/c..." | Re-trigger Greptile

Comment thread .github/workflows/test-build.yml
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 4790a49. Configure here.

@waleedlatif1
waleedlatif1 merged commit 02bc8f1 into staging Jul 23, 2026
20 checks passed
@waleedlatif1
waleedlatif1 deleted the ci/turbopack-warm-build branch July 23, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant