Skip to content

perf(ci): trim redundant install and unneeded build scripts from CF builds#248

Merged
jamesdabbs merged 1 commit into
mainfrom
perf/lean-cf-builds
Jun 28, 2026
Merged

perf(ci): trim redundant install and unneeded build scripts from CF builds#248
jamesdabbs merged 1 commit into
mainfrom
perf/lean-cf-builds

Conversation

@jamesdabbs

Copy link
Copy Markdown
Member

Why

Each Cloudflare Workers build was doing substantially more work than needed, and this multiplies across the two git-connected Workers (pi-base-topology + pi-base-graphs) that build on every push.

Two issues, both visible in the build logs:

  1. Dependencies were installed twice. Workers Builds auto-runs pnpm install --frozen-lockfile before the build command, but bin/build then ran a second pnpm install --store=node_modules/.pnpm-store. The relocated store forced node_modules to be recreated (Recreating /opt/buildhome/repo/node_modules) and fragmented it from the auto-install's store, so even warm builds re-downloaded every package (reused 0).

  2. Install ran build scripts the deploy doesn't need. allowBuilds approved Cypress (binary download, ~20s), keytar and @vscode/vsce-sign (native builds) — none of which the viewer build or runtime touches.

What changed

  • bin/build: only install when node_modules is genuinely missing (clean local checkout); drop the --store relocation so the CI dependency cache is actually reused.
  • pnpm-workspace.yaml: remove cypress, keytar, @vscode/vsce-sign from allowBuilds. Kept @sveltejs/kit, esbuild, svelte-preprocess, which the viewer build needs.

Safety / blast radius

  • CF-only + install-script changes; the GitHub test and e2e workflows are unaffected.
  • The e2e workflow already installs the Cypress binary explicitly (pnpm --filter viewer exec cypress install) and notes the postinstall is skipped on warm cache.
  • keytar/vsce-sign are vscode vsce publish deps — nothing in vscode/src imports keytar, and the unit-test workflow (--recursive test:cov) skips vscode (no test:cov script).

Expected impact

Removes the redundant ~23s install and lets the remaining install hit the warm cache instead of re-downloading — roughly ~1 min off each build, on both Workers, every push.

Verifying

On the next build, the log should show: no second pnpm install; cypress/keytar/vsce-sign in the "Ignored build scripts" line; and the auto-install reporting a meaningful reused N.

Not included (intentionally deferred)

  • Restricting builds to production branch + PRs.
  • Deduplicating the two Workers building identical output (dashboard/API config).
  • Runtime SSR cost reduction.

…uilds

Workers Builds runs `pnpm install` before the build command, but bin/build
ran a second `pnpm install --store=node_modules/.pnpm-store`. That relocated
store forced node_modules to be recreated and fragmented it from the
auto-install's store, so the cached install re-downloaded every package
(logs showed `reused 0`). Only install in bin/build when node_modules is
actually missing (clean local checkout), without `--store`.

Also drop cypress, keytar, and @vscode/vsce-sign from allowBuilds — their
install/build scripts (Cypress binary download, vscode native builds) aren't
needed by the viewer build or runtime. The e2e workflow already installs the
Cypress binary explicitly; vscode publishing deps are unused in CI.

Cuts roughly a minute off each Worker build, on both the topology and graphs
Workers.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
pi-base-topology 9dbe57f Commit Preview URL

Branch Preview URL
Jun 28 2026, 02:41 AM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying topology with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9dbe57f
Status: ✅  Deploy successful!
Preview URL: https://4b93f93a.topology.pages.dev
Branch Preview URL: https://perf-lean-cf-builds.topology.pages.dev

View logs

@jamesdabbs jamesdabbs merged commit 1b945c1 into main Jun 28, 2026
4 checks passed
@jamesdabbs jamesdabbs deleted the perf/lean-cf-builds branch June 28, 2026 02:44
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