Skip to content

ci: report minified bundle size changes on PRs#8922

Merged
mvaligursky merged 4 commits into
mainfrom
mv-build-size-report
Jun 18, 2026
Merged

ci: report minified bundle size changes on PRs#8922
mvaligursky merged 4 commits into
mainfrom
mv-build-size-report

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

Summary

Adds a Build Size GitHub Actions workflow (.github/workflows/build-size.yml) that reports how a PR affects the size of the minified engine bundles. It mirrors the existing API Report workflow's mechanism — same trigger, same sticky-comment pattern — but for bundle size.

How it works

  • Triggers on pull_request to main (opened, synchronize, reopened), so it refreshes on every commit.
  • No persistent baseline. It checks out both the PR head and pull_request.base.sha, builds each, and compares them in the same run — so the report is always "this PR vs the main it targets".
  • Builds only the minified bundles (build:min:umd + build:min:esm), not the rel/dbg/prf/types variants, to keep the run fast.
  • A small dependency-free measurer (utils/build-size.mjs) records raw, gzip and brotli sizes of playcanvas.min.js (UMD) and playcanvas.min.mjs (ESM) using Node's built-in zlib.
  • Posts/updates one sticky comment (deduped via a hidden <!-- build-size-bot --> marker — listComments → find → create/update), showing each bundle's PR size and its delta vs main.
  • Informative only — never fails the build; the comment step is continue-on-error so fork PRs (read-only token) stay green.

Notes / things to decide in review

  • The comment is always posted (even when sizes are unchanged, where it reports "does not change the size"), unlike the API report which deletes its comment when there's no change. Easy to switch to delete-on-no-change if preferred.
  • This PR itself touches no engine source, so its own Build Size comment should report no change — a useful first check that the report renders correctly.
  • Build cost is two npm ci + four minified esbuild builds; well within the 20-min timeout.

🤖 Generated with Claude Code

Adds a Build Size workflow that, on each PR, builds only the minified
UMD + ESM bundles for both the PR head and its base commit (no stored
baseline — the base is rebuilt in the same run), measures their raw,
gzip and brotli sizes, and posts/updates a single sticky PR comment with
the deltas. Informative only; never fails the build, and tolerates the
read-only token on fork PRs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

Build size report

This PR does not change the size of the minified bundles.

Bundle Minified Gzip Brotli
playcanvas.min.js 2284.4 KB — 585.4 KB — 455.7 KB —
playcanvas.min.mjs 2281.8 KB — 584.4 KB — 454.9 KB —

The minified bundles embed the git short-hash (via _CURRENT_SDK_REVISION
and the license banner), which differs between the base and PR commits
and showed up as a phantom compressed-size delta even when no code
changed. Let utils/rollup-version-revision.mjs honour an
ENGINE_BUILD_REVISION env var and pin it to a constant for both builds,
so the report reflects only real code-size changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fold the table explanation into the headline as a single line above the
table and drop the "never fails the build" note.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mvaligursky mvaligursky merged commit a1f22f6 into main Jun 18, 2026
10 checks passed
@mvaligursky mvaligursky deleted the mv-build-size-report branch June 18, 2026 12:50
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