From 5d7c11cee8f541229064e3921aeb44c5d7a83b59 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Wed, 22 Jul 2026 16:51:34 -0700 Subject: [PATCH 1/2] feat(ci): warm Next.js builds via Turbopack persistent cache on a sticky 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) --- .github/workflows/test-build.yml | 19 ++++++++++++------- apps/sim/next.config.ts | 6 ++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 285c7ec53f6..accce752074 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -242,15 +242,17 @@ jobs: # compiling against a cache stale since the last lockfile change. The # restore-keys prefix match picks the most recently saved cache for this # lockfile, falling back across lockfile changes. - - name: Restore Next.js build cache - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + # Turbopack's persistent build cache (NEXT_TURBOPACK_BUILD_CACHE below) + # writes ~5 GB into .next/cache — a sticky disk mounts it in ~1s where an + # actions/cache round-trip would eat the warm-build win. Same event/fork + # namespacing as the other mounts; the GitHub fallback inside cache-mount + # still uses actions/cache with a run_id-suffixed key. + - name: Mount Next.js build cache + uses: ./.github/actions/cache-mount with: + provider: ${{ vars.CI_PROVIDER }} + key: ${{ github.repository }}-nextjs-cache-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }} path: ./apps/sim/.next/cache - key: ${{ runner.os }}-nextjs-${{ hashFiles('bun.lock') }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }} - restore-keys: | - ${{ runner.os }}-nextjs-${{ hashFiles('bun.lock') }}-${{ github.sha }}- - ${{ runner.os }}-nextjs-${{ hashFiles('bun.lock') }}- - ${{ runner.os }}-nextjs- - name: Install dependencies run: bun install --frozen-lockfile @@ -266,4 +268,7 @@ jobs: AWS_REGION: 'us-west-2' ENCRYPTION_KEY: '7cf672e460e430c1fba707575c2b0e2ad5a99dddf9b7b7e3b5646e630861db1c' # dummy key for CI only TURBO_CACHE_DIR: .turbo + # Opt into Turbopack's persistent build cache (beta) for this CI + # check build only — measured 105s cold vs 22s warm locally. + NEXT_TURBOPACK_BUILD_CACHE: '1' run: bunx turbo run build --filter=sim \ No newline at end of file diff --git a/apps/sim/next.config.ts b/apps/sim/next.config.ts index 5cf26fbaeea..ebcb52775ea 100644 --- a/apps/sim/next.config.ts +++ b/apps/sim/next.config.ts @@ -144,6 +144,12 @@ const nextConfig: NextConfig = { experimental: { optimizeCss: !isDev, turbopackFileSystemCacheForDev: false, + /** + * Turbopack's persistent build cache (beta) — opt-in via env so only the + * CI check build uses it; production image builds stay on the default + * cold-build path until the feature stabilizes. + */ + turbopackFileSystemCacheForBuild: process.env.NEXT_TURBOPACK_BUILD_CACHE === '1', preloadEntriesOnStart: false, optimizePackageImports: [ 'lodash', From 4790a49c4f4feaf626504bdb28eee40d10616f8e Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Wed, 22 Jul 2026 17:03:29 -0700 Subject: [PATCH 2/2] chore(ci): drop the superseded actions/cache comment and restore trailing newline --- .github/workflows/test-build.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index accce752074..8e7ff3e9eab 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -236,12 +236,6 @@ jobs: key: ${{ github.repository }}-turbo-cache-build-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }} path: ./.turbo - # Keyed per commit so EVERY run saves its refreshed cache — a key without - # a unique suffix is written once and then frozen (GitHub caches are - # immutable per key; a primary-key hit skips the save), which left builds - # compiling against a cache stale since the last lockfile change. The - # restore-keys prefix match picks the most recently saved cache for this - # lockfile, falling back across lockfile changes. # Turbopack's persistent build cache (NEXT_TURBOPACK_BUILD_CACHE below) # writes ~5 GB into .next/cache — a sticky disk mounts it in ~1s where an # actions/cache round-trip would eat the warm-build win. Same event/fork @@ -271,4 +265,4 @@ jobs: # Opt into Turbopack's persistent build cache (beta) for this CI # check build only — measured 105s cold vs 22s warm locally. NEXT_TURBOPACK_BUILD_CACHE: '1' - run: bunx turbo run build --filter=sim \ No newline at end of file + run: bunx turbo run build --filter=sim