-
Notifications
You must be signed in to change notification settings - Fork 195
Closed
Description
Can we compute this on CI (I know CodeCov can do that automatically for JavaScript bundles or something? But not sure about Rust)
Will open an issue about that, but relative size like you did is fine 👍
Originally posted by @lmmx in #915 (comment)
I'll take a look at this later, but wanted to open an issue now
I built master branch as 12MB, Felix got 8 (I presume in release mode)
Sketch
We would want a GitHub Action workflow that writes a comment on the PR comparing size diff vs trunk (master branch)
Something like
name: Binary size check
on:
pull_request:
jobs:
size-diff:
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build PR binary
run: cargo build --release
- name: Get PR binary size
id: prsize
run: |
SIZE=$(stat -c%s "target/release/your-crate-name")
echo "size=$SIZE" >> $GITHUB_OUTPUT
- name: Checkout master branch
uses: actions/checkout@v4
with:
ref: master
- name: Build master binary
run: cargo build --release
- name: Get master binary size
id: mastersize
run: |
SIZE=$(stat -c%s "target/release/your-crate-name")
echo "size=$SIZE" >> $GITHUB_OUTPUT
- name: Post size comparison comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: binary-size
message: |
📦 **Binary size comparison**
- `master`: **${{ steps.mastersize.outputs.size }} bytes**
- `PR`: **${{ steps.prsize.outputs.size }} bytes**
🔀 Difference: **${{ steps.prsize.outputs.size }} - ${{ steps.mastersize.outputs.size }} = ${{ steps.prsize.outputs.size && steps.mastersize.outputs.size && (steps.prsize.outputs.size - steps.mastersize.outputs.size) }} bytes**If we can get that in Rust itself it might be simpler? Would need to look up the crates that can do that
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels