Skip to content

Conversation

@avivkeller
Copy link
Member

@avivkeller avivkeller commented Oct 19, 2025

Adds a new workflow_run workflow which compares the bundle size of the current PR and the base branch.

See #8245 (comment), which shows the diff between a previous commit of this PR and the current commit (which, since no Next.js code changed, is nothing).

Note

If this workflow fails, it will not display 🔴 on the PR. If it succeeds, it won't display 🟢 either.

Note

This workflow will fail for PRs open up unto this point, but should succeed for PRs opened after this is merged.

@vercel
Copy link

vercel bot commented Oct 19, 2025

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

Project Deployment Preview Updated (UTC)
nodejs-org Ready Ready Preview Oct 20, 2025 1:37pm

💡 Enable Vercel Agent with $100 free credit for automated AI reviews

@codecov
Copy link

codecov bot commented Oct 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.45%. Comparing base (7015095) to head (608ef29).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8245   +/-   ##
=======================================
  Coverage   76.45%   76.45%           
=======================================
  Files         115      115           
  Lines        9643     9643           
  Branches      317      317           
=======================================
  Hits         7373     7373           
  Misses       2269     2269           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AugustinMauroy
Copy link
Member

WOW look soo cool ! I'm surprised there are any tool like that on Vercel

@github-actions
Copy link
Contributor

Bundle Stats

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
27 2.61 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

Asset File Size % Changed
.next/static/chunks/8ec9a8b8281103e0.js 0 B → 202.45 kB (+202.45 kB) -

Removed

Asset File Size % Changed
.next/static/chunks/a4b7bbc597f6d97b.js 202.45 kB → 0 B (-202.45 kB) -100%

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
.next/static/chunks/3702f33810660bc3.js 13.58 kB 0%
.next/static/chunks/a6afeba20fdcf503.js 38.48 kB 0%
.next/static/chunks/a9d028b25a130731.js 184.12 kB 0%
.next/static/chunks/73b8b852d483aaf0.js 64.45 kB 0%
.next/static/chunks/b87b961db7376771.js 45.32 kB 0%
.next/static/chunks/191843c6caa55163.js 282 B 0%
.next/static/chunks/08d5f3e0b2432594.js 31.78 kB 0%
.next/static/chunks/7085e26edf6181f8.js 7.39 kB 0%
.next/static/chunks/4afb45e7fb47b7f0.js 19.02 kB 0%
.next/static/chunks/27f6d4436e73ac76.js 33.25 kB 0%
.next/static/chunks/5e109b7e2c8df7e0.js 37.92 kB 0%
.next/static/chunks/339ca6a45c4a307a.js 47.36 kB 0%
.next/static/chunks/06821c29fae47e48.js 57.94 kB 0%
.next/static/chunks/ed216a47cebb261f.js 51.77 kB 0%
.next/static/chunks/9372c22956f6b20c.js 24.39 kB 0%
.next/static/chunks/dcc940ecaa28e617.js 19.02 kB 0%
.next/static/chunks/8df2bb083f40bc43.js 24 kB 0%
.next/static/chunks/aafe622e36d4c9a6.js 10.15 kB 0%
.next/static/chunks/0d94628576cc16d2.js 37.92 kB 0%
.next/static/chunks/c342b201296b002d.js 19.29 kB 0%
.next/static/chunks/d20113a9e5f8f644.js 792.32 kB 0%
.next/static/chunks/99c42f33f0b4a041.js 51.77 kB 0%
.next/static/chunks/45b092695b5d4f15.js 29.33 kB 0%
.next/static/chunks/02e322153f39cbe9.js 6.16 kB 0%
.next/static/chunks/520528ebf0c5948e.js 792.32 kB 0%
.next/static/chunks/8fa3f2763d038de6.js 33.09 kB 0%

@avivkeller avivkeller changed the title [wip] bundle stats feat(cicd): add bundle stats comparison Oct 19, 2025
@avivkeller avivkeller linked an issue Oct 19, 2025 that may be closed by this pull request
@avivkeller avivkeller marked this pull request as ready for review October 19, 2025 21:05
@avivkeller avivkeller requested a review from a team as a code owner October 19, 2025 21:05
@Copilot Copilot AI review requested due to automatic review settings October 19, 2025 21:05
@avivkeller avivkeller requested a review from a team as a code owner October 19, 2025 21:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a workflow to compare bundle sizes between a PR and the base branch using build artifacts, and updates the build pipeline to emit and upload stats.

  • Introduces a workflow_run-triggered job that pulls artifacts from the PR’s Build run and the latest main run, then compares stats.
  • Updates the Build workflow to generate webpack stats (via TURBOPACK_STATS) and upload them as an artifact on ubuntu-latest.
  • Plumbs TURBOPACK_STATS through Turbo tasks in apps/site.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
apps/site/turbo.json Allows TURBOPACK_STATS to pass through for dev/build/start/deploy tasks so stats can be generated in CI.
.github/workflows/build.yml Exposes TURBOPACK_STATS on ubuntu-latest and uploads webpack-stats.json as an artifact.
.github/workflows/bundle-compare.yml New workflow to fetch artifacts from the PR run and latest main run and compare bundle stats, posting results to the PR.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@avivkeller
Copy link
Member Author

You can also download the stats file, as it's an artifact.

image

@bmuenzenmeyer
Copy link
Collaborator

This is cool. I am probably naive to some inner working here - but surprised it works with the chunks being generated hash filenames

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Aviv Keller <[email protected]>
- name: Download PR artifact (head)
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please move these scripts to our scripts folder and make them actual scripts and run them via node? Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are pretty simple scripts used in many many workflows, I don't think it's worth it to make new script files, and require this workflow perform a checkout, when we can just inline them

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I just don't feel happy approving a PR with JavaScript being inlined this way. Not even sure our security checks with CodeQL can detect these. Plus all our prettier and lint rules don't work here. Please eject this into proper files under a scripts folder (could even be under .github/workflows/scripts), that said, I think there are other workflows doing this, so I'd also ask to change that. Wdyt @bmuenzenmeyer

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use inline bash syntax in several workflows, why is inline JS such a big risk?

This practice of inlineing GitHub Actions Script is quite common. https://github.com/actions/github-script

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bump @ovflowd

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm not +1 with this solution and won't approve it :/

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.

Build Size Difference

4 participants