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 Nov 11, 2025 10:03pm

@codecov
Copy link

codecov bot commented Oct 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.72%. Comparing base (7015095) to head (18af32a).
⚠️ Report is 57 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.72%   +0.26%     
==========================================
  Files         115      118       +3     
  Lines        9643     9822     +179     
  Branches      317      336      +19     
==========================================
+ Hits         7373     7536     +163     
- Misses       2269     2284      +15     
- Partials        1        2       +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

This comment was marked as outdated.

@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 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
Contributor

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

@avivkeller
Copy link
Member Author

Bump @nodejs/web-infra

@avivkeller
Copy link
Member Author

avivkeller commented Oct 28, 2025

So apparently the action doesn't support workflow_run internally (it's a needless check, as the action would support the trigger).

So, I need to write a little custom action to do all of our special logic

@MattIPv4
Copy link
Member

Can we not just open a PR upstream to add support, rather than rolling our own?

@avivkeller
Copy link
Member Author

Can we not just open a PR upstream to add support, rather than rolling our own?

I'm planning to do both. I'll open a Pr upstream, and in the meantime, have a simple script here, unless we'd rather wait for the upstream PR to land?

@MattIPv4
Copy link
Member

I'm personally fine with waiting until upstream support is landed, unless others have a strong need for this urgently.

@ovflowd
Copy link
Member

ovflowd commented Oct 30, 2025

I'm fine merging this without workflow_run for now. @avivkeller can you mark the PR as ready and open a follow-up issue?

@avivkeller
Copy link
Member Author

@ovflowd we need workflow_run for this, otherwise, it's useless to have as an extra file

@ovflowd
Copy link
Member

ovflowd commented Nov 2, 2025

Ack, any issue created upstream?

@avivkeller
Copy link
Member Author

Yea, I opened a PR

@avivkeller
Copy link
Member Author

It seems nothing is happening upstream, so I'm implementing something here

@github-actions
Copy link
Contributor

📦 Build Size Comparison

Summary

Metric Value
Old Total Size 2.66 MB
New Total Size 2.66 MB
Delta 0 B (0.00%)

Changes

➕ Added Assets (1)
Name Size
.next/static/chunks/8c72443efb8ad7a4.js 202.62 KB
➖ Removed Assets (1)
Name Size
.next/static/chunks/4eb86f5ac65905ca.js 202.62 KB

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

6 participants