Skip to content

perf(ci): build sandbox preview in parallel with storybook - #3811

Merged
cixzhang merged 1 commit into
facebook:mainfrom
Han5991:ci/parallel-preview-builds
Jul 12, 2026
Merged

perf(ci): build sandbox preview in parallel with storybook#3811
cixzhang merged 1 commit into
facebook:mainfrom
Han5991:ci/parallel-preview-builds

Conversation

@Han5991

@Han5991 Han5991 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

The PR build job is a single ~6.5min pipeline, and one step dominates it: the sandbox Next.js export (4m15s of it, per recent run timings). Everything else in the job — core build, four typechecks, storybook build, PR analysis — fits in ~2min. This PR moves the sandbox export into its own job so it runs in parallel instead of serializing after everything else.

PR CI wall time for component PRs drops from ~8–9min to ~6.5min, and the a11y audit starts ~4min earlier. Cost: one extra runner spin-up plus a duplicated ~40s core build.

Changes

  • build-storybook (renamed from build): core build + typechecks + storybook + PR analysis (~2min). Uploads the storybook + analysis artifacts and carries the preview-URL outputs, as before.
  • build-sandbox (new): core build + sandbox export with the pinned Next.js cache, PR-only, parallel from t0 (~5min). The no-restore-keys cache rationale (feat: XDS un-prefix migration — bare names canonical, XDS* compat aliases #2941) is unchanged.
  • build (new join gate): keeps the historical check name so anything keyed on "build" being green — branch protection, tooling, habit — keeps working. Fails if either parallel build fails; passes when build-sandbox is legitimately skipped (docsite-only PRs); skips when build-storybook skips (merge_group), matching the old cascade behavior.
  • pr-a11y now depends only on build-storybook, so it starts as soon as the storybook artifact exists (~2min) instead of waiting for the sandbox too.
  • pr-comment now also waits for deploy-preview pr-comment-update gained an explicit needs: pr-commentcorrection (post-review): these two jobs live in pr-comment.yml (a separate workflow_run workflow this PR does not touch); the bullets described a considered change that didn't ship. The shipped diff is ci.yml only.

Behavior parity

Scenario Before After
Normal PR, sandbox build fails build red build red (via join)
Docsite-only PR build green (steps skipped) build green (sandbox skipped, join passes)
Fork PR previews/comments skipped unchanged (builds still run, deploy/comment jobs skip)
merge_group build skipped (cascade from check-scope) join skipped the same way

Test plan

  • YAML parses; full needs-graph reviewed; no leftover needs.build.* references (grep-verified)
  • Scenario walkthrough above (normal / docsite-only / fork / merge_group / partial failure)
  • This PR's own CI run executes the modified ci.yml — the Checks tab shows the new graph and timings live

@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 12, 2026 1:41am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 11, 2026
@Han5991
Han5991 force-pushed the ci/parallel-preview-builds branch from 25f1e06 to 28d3b2c Compare July 11, 2026 12:28
@github-actions github-actions Bot added the community Authored by a community contributor (not on the eng/design team) label Jul 11, 2026
The PR `build` job was a single 6.5min pipeline dominated by one step:
the sandbox Next.js export (~4min15s of it). Everything else — core
build, four typechecks, storybook, analysis — fits in ~2min. Splitting
the sandbox build into its own job removes it from everything else's
critical path:

- build-storybook: core build + typechecks + storybook + PR analysis
  (~2min). pr-a11y now starts when this finishes instead of waiting for
  the sandbox too, so the a11y comment update lands ~2-3min earlier.
- build-sandbox: core build + sandbox export with the pinned Next.js
  cache (~5min), PR-only, in parallel from t0.
- build: a join gate that keeps the historical check name — anything
  keyed on "build" (branch protection, tooling) keeps working, and it
  still fails when either side fails and passes on docsite-only PRs
  where the sandbox build is legitimately skipped.

pr-comment now also waits for deploy-preview: the analysis is ready at
~2min, but posting preview links ~4min before the preview exists would
leave them 404ing. Net effect it posts at the same time as before, and
pr-comment-update gained an explicit needs on pr-comment so the final
a11y body can never be overwritten by the initial pending one.

PR wall time drops from ~8-9min to ~6.5min for component PRs; the cost
is one extra runner spin-up and a duplicated ~40s core build.

� Conflicts:
�	.github/workflows/ci.yml
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.6KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | View full report

@github-actions github-actions Bot added the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Jul 12, 2026

@cixzhang cixzhang 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.

🟢 No review blockers found — CI-only change, verified clean within what I can check.

Initial review pass (community contributor) — findings are a triage map for maintainers, not a verdict.

This splits the ~4min sandbox export out of the build job into a parallel build-sandbox job and folds both back through a build join gate that keeps the historical check name.

Verified:

  • build-storybook (renamed from build) retains all four consumed outputs (pr_number, short_hash, storybook_url, sandbox_url); no downstream job references a now-removed needs.build.* output.
  • The build join gate handles the edge cases correctly: docsite-only PRs skip build-sandbox and the gate still passes (success|skipped), and a skipped build-storybook (merge_group) skips the gate — matching the previous single-job cascade.
  • pr-a11y and deploy-preview now point at the right upstream jobs for their artifacts.

Minor (non-blocking): the PR description mentions pr-comment/pr-comment-update reordering, but those jobs live in a separate workflow_run file that isn't touched here — the description slightly overstates the diff. No code impact.


Recap#3811 · perf(ci): build sandbox preview in parallel with storybook · @Han5991
What it does: runs the slow sandbox export in its own job so PR CI wall time drops from ~8–9min to ~6.5min, with a join gate preserving the build check name.
Recommendation: Approve.

@cixzhang cixzhang removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Jul 12, 2026
@cixzhang
cixzhang merged commit 7455108 into facebook:main Jul 12, 2026
22 checks passed
@Han5991
Han5991 deleted the ci/parallel-preview-builds branch July 12, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants