-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
feat(cicd): add bundle stats comparison #8245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
💡 Enable Vercel Agent with $100 free credit for automated AI reviews |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. |
|
WOW look soo cool ! I'm surprised there are any tool like that on Vercel |
Bundle StatsHey 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
Changeset No files were changed View detailed bundle breakdownAdded
Removed
Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
53e8bac to
cfe260e
Compare
There was a problem hiding this 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.
|
You can also download the stats file, as it's an artifact.
|
|
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: | |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump @ovflowd
There was a problem hiding this comment.
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 :/

Adds a new
workflow_runworkflow 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.