-
Notifications
You must be signed in to change notification settings - Fork 24
feat(ci): compare builds #517
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #517 +/- ##
==========================================
- Coverage 80.76% 79.58% -1.19%
==========================================
Files 119 120 +1
Lines 11877 12056 +179
Branches 841 841
==========================================
+ Hits 9593 9595 +2
- Misses 2281 2458 +177
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Web GeneratorPages (66)
|
6ea1dc1 to
cc0905f
Compare
7f6e980 to
6e95ec1
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
This PR introduces a build comparison system to automatically analyze and report size changes in generated artifacts for pull requests. The system dynamically discovers comparator scripts and generates markdown reports showing file size differences between base and head branches.
Key Changes:
- Adds a new GitHub Actions workflow that runs after the Generate Docs workflow completes, comparing build outputs between PR head and base
- Implements a web comparator script that analyzes file sizes and generates a formatted comparison report
- Refactors SPECULATION_RULES constant to be pre-stringified, improving performance by eliminating redundant JSON.stringify calls per page
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/compare-builds.yml |
New workflow that orchestrates build comparison by discovering comparators, downloading artifacts from both branches, running comparisons, and posting results to PRs |
scripts/compare-builds/web.mjs |
New comparator script that analyzes web generator output, calculates size differences, and formats results into markdown tables with collapsible sections |
.github/workflows/generate.yml |
Updates artifact naming to remove run ID suffix, enabling consistent artifact names across workflow runs for comparison |
src/generators/web/constants.mjs |
Moves JSON.stringify of SPECULATION_RULES from usage site to definition, improving performance |
src/generators/web/utils/processing.mjs |
Removes redundant JSON.stringify call now that SPECULATION_RULES is pre-stringified |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…to compare-builds
| * @see https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API | ||
| */ | ||
| export const SPECULATION_RULES = { | ||
| export const SPECULATION_RULES = JSON.stringify({ |
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.
| export const SPECULATION_RULES = JSON.stringify({ | |
| export const SPECULATION_RULES_STRING = JSON.stringify({ |
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.
IDK why you made this unrelated change tho... Any reason why calling JSON.stringify right on definition? Not sure we do that with constants.
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.
IDK why you made this unrelated change tho... Any reason why calling JSON.stringify right on definition? Not sure we do that with constants.
As I mentioned in the comments, I made this change to slightly reduce the build size, showcasing the comparison.
It's on the constant just so that the same stringify isn't called on every page.
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.
As I mentioned in the comments, I made this change to slightly reduce the build size, showcasing the comparison.
Hmm, how does this reduce build size? Hmmm
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.
(Also apologies for not notidcing on the comments, I just quickly jumped to the PR)
This PR adds a system for adding a series of comparators to our codebase.
At the moment, only a
webcomparison is implemented. To add more comparators, add[generator-name].mjsto thescripts/compare-buildsdirectory. These comparators will run on incoming PRs.Example output: #517 (comment)