From f35839fe018aac50a87dea8e8480fc8db2dec2ac Mon Sep 17 00:00:00 2001 From: Diego Rodrigues de Sa e Souza <8016841+diegosouzapw@users.noreply.github.com> Date: Sun, 5 Jul 2026 11:14:16 -0300 Subject: [PATCH] ci(build): switch Next.js production build to Turbopack (1.9x faster) (#6273) Next 16 ships Turbopack as the stable production bundler. Benchmarked on a 32-core box against the same tree: webpack 1035s -> Turbopack 539s (1.92x). The build script already supports the switch via OMNIROUTE_USE_TURBOPACK=1 (scripts/build/build-next-isolated.mjs) and next.config.mjs already mirrors the resolveAlias stubs in the turbopack block, so this only flips the CI env. The webpack .build/next/cache actions/cache step is removed in the same commit: Turbopack does not use the webpack cache dir (its persistent FS cache is experimental and NOT enabled), so restoring ~0.5 GB per run would be pure wasted download. Revert restores webpack + its cache together. Validation: standalone output smoke-tested (server.js boots, health 200, dashboard 307); the 428 build warnings are the known benign 'overly broad file pattern' static-analysis notices for dynamic fs usage (covered at runtime by outputFileTracingIncludes). Downstream e2e x9, package-artifact and electron-package-smoke consume this artifact, so a green CI run here validates the Turbopack artifact end-to-end. nightly-compat and npm-publish stay on webpack until this PR proves out. --- .github/workflows/ci.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7361b91a8a..21db33deae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -519,14 +519,21 @@ jobs: cache: npm - uses: ./.github/actions/npm-ci-retry - run: npm run check:node-runtime - - name: Cache Next.js build cache - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 - with: - path: .build/next/cache - key: nextjs-${{ runner.os }}-node-${{ env.CI_NODE_VERSION }}-${{ hashFiles('package-lock.json') }}-${{ hashFiles('src/**/*', 'open-sse/**/*', 'db/**/*', 'next.config.mjs', 'tsconfig*.json', 'postcss.config.*', 'tailwind.config.*') }} - restore-keys: | - nextjs-${{ runner.os }}-node-${{ env.CI_NODE_VERSION }}-${{ hashFiles('package-lock.json') }}- + # NOTE: the webpack `.build/next/cache` actions/cache step was removed with the + # Turbopack switch below — Turbopack does not read/write the webpack cache dir + # (its persistent FS cache is still experimental and intentionally NOT enabled), + # so restoring the old ~0.5 GB webpack cache would only waste download time. + # Rolling back to webpack = revert this commit (cache step comes back with it). + # + # Turbopack production build (Next 16, stable): benchmarked 1.9× faster than the + # webpack pass (9min0s vs 17min15s on a 32-core box; multi-core Rust vs webpack's + # single-threaded compile). Standalone output smoke-validated (server boots, + # /api/monitoring/health 200). Downstream jobs (e2e ×9, package-artifact, + # electron-package-smoke) consume this artifact, so a green run here validates + # the Turbopack artifact end-to-end. - run: npm run build + env: + OMNIROUTE_USE_TURBOPACK: "1" - name: Archive Next.js build for downstream jobs # Use tar so the archive preserves paths relative to CWD (.build/next/...). # upload-artifact path-stripping is ambiguous when exclude patterns are used;