Feature/msdk 3826 binary size measurement#213
Conversation
actions/setup-java@v1 sets JAVA_HOME to a path that no longer exists on macOS-14 runners (/Users/runner/hostedtoolcache/jdk/...), causing Gradle to fail with "JAVA_HOME is set to an invalid directory". Upgrading to v4 + temurin fixes the JAVA_HOME resolution. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds scripts/measure_binary_sizes.sh that packs the npm tarball after publish, measures compressed and uncompressed bytes, compares against the previous published version via the npm registry, and emits binary-sizes-rn.json as a CI artifact. Wires the script into .github/workflows/release.yml after npm publish. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
📝 WalkthroughWalkthroughRelease workflow is enhanced with npm authentication token setup and a new binary size measurement step. A companion Bash script builds npm tarballs, measures compressed and uncompressed byte sizes, optionally compares against the previously published version, and outputs results in both human-readable and JSON formats. ChangesRelease automation with binary size tracking
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review Summary by QodoAdd binary size measurement to release pipeline
WalkthroughsDescription• Add binary size measurement script to track npm tarball sizes • Integrate size measurement into release pipeline after npm publish • Compare current version sizes against previously published version • Upgrade GitHub Actions setup-java to v4 with temurin distribution Diagramflowchart LR
A["npm publish"] --> B["measure_binary_sizes.sh"]
B --> C["Fetch published sizes<br/>from npm registry"]
C --> D["Compare & generate<br/>binary-sizes-rn.json"]
D --> E["Upload artifact"]
File Changes1. scripts/measure_binary_sizes.sh
|
Code Review by Qodo
1. COMPARE option misapplied
|
|
PR Summary: Add binary-size measurement to release workflow and a new script that packs the npm tarball, records compressed/uncompressed sizes, optionally compares to the previously published version, and uploads a JSON artifact.
|
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/release.yml:
- Line 27: Replace the mutable action tag "uses: actions/upload-artifact@v4"
with an immutable full commit SHA pin: locate the line containing uses:
actions/upload-artifact@v4 and update it to uses:
actions/upload-artifact@<full-commit-sha> (obtain the exact SHA from the
actions/upload-artifact repository and paste it in place of `@v4`).
In `@scripts/measure_binary_sizes.sh`:
- Line 108: The curl call that populates REGISTRY_DATA for
"https://registry.npmjs.org/${ENCODED_NAME}" has no network timeouts and can
hang; update the invocation that sets REGISTRY_DATA to include appropriate curl
timeout flags (e.g., --connect-timeout and --max-time, and optionally --retry
and --retry-delay) so the fetch for ENCODED_NAME fails fast on network issues
and doesn't stall the pipeline.
- Around line 163-164: The compare columns are being passed because
${COMPARE:+"$PUB_COMPRESSED"} and ${COMPARE:+"$PUB_UNCOMPRESSED"} expand when
COMPARE is non-empty (even "false"); change the conditional to only pass the
published values when COMPARE is explicitly true (e.g., test [ "$COMPARE" =
"true" ] or use a COMPARE_ENABLED boolean that is empty when disabled) so calls
to print_row "compressed (.tgz)" "$COMPRESSED_BYTES" and print_row
"uncompressed (tar)" "$UNCOMPRESSED_BYTES" only include "$PUB_COMPRESSED" /
"$PUB_UNCOMPRESSED" when comparison is enabled; update occurrences referencing
COMPARE, PUB_COMPRESSED, PUB_UNCOMPRESSED, and print_row accordingly.
- Line 116: The current sorting line (versions = sorted(d.get('versions',
{}).keys(), key=lambda v: [int(x) for x in v.split('.')[:3]])) fails for
prerelease/semver strings like "1.2.3-rc.1"; replace the ad‑hoc int-splitting
key with a proper semver/PEP 440 parser (e.g. use packaging.version.parse or a
semver library) and sort using key=lambda v: parse(v) so prereleases and build
metadata are compared correctly; update imports to bring in the chosen parser
and adjust the sorted call that assigns versions accordingly.
- Line 24: The --output case currently unconditionally reads the next token
(OUTPUT_FILE="$2") and will trigger an unbound-variable error under set -u when
no value is provided; update the '--output)' branch in the option parsing to
first check that a next argument exists and is not another option (e.g., not
empty and not starting with '-') and if missing print a clear error/usage
message and exit nonzero, otherwise assign OUTPUT_FILE and shift 2; reference
the '--output)' case and the OUTPUT_FILE variable when making the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 250acd13-12aa-44a4-a624-71a82de62786
📒 Files selected for processing (2)
.github/workflows/release.ymlscripts/measure_binary_sizes.sh
|
CodeAnt AI finished reviewing your PR. |
User description
Summary by CodeRabbit
CodeAnt-AI Description
Add release-time binary size reporting for the React Native SDK
What Changed
Impact
✅ Visible package size tracking after each release✅ Easier release checks for size increases✅ Faster review of binary growth in CI💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.