Skip to content

perf: monitor binary size change in PRs via cargo-bloat workflow#927

Merged
j178 merged 9 commits intoj178:masterfrom
lmmx:bloat-action
Oct 19, 2025
Merged

perf: monitor binary size change in PRs via cargo-bloat workflow#927
j178 merged 9 commits intoj178:masterfrom
lmmx:bloat-action

Conversation

@lmmx
Copy link
Copy Markdown
Collaborator

@lmmx lmmx commented Oct 18, 2025

Cargo bloat workflow to show the binary size change for PRs in the form of a "Checks" status line

I came up with a way that shows it in the PR via a check "status" line, see demo PR and workflow source

Image

Originally posted by @lmmx in #917

I tried it with a status like this, (to save you having to click through to read the result) but it looks like that won't be allowed to run on forks (i.e. only j178's own PRs to this repo would have it, everyone else's would error) so I removed that and now you have to click through to the step summary to see it:

(...)

To see the result you click through to the step summary where it shows up as an "annotation" at the top and a full report below

  • Added mold linker and caching so (initial run took 5m)
  • Removed check status line (fails for PRs from other repos)
  • Rewrote size change calculation in Python

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.02%. Comparing base (c8b69c6) to head (1a5d183).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #927   +/-   ##
=======================================
  Coverage   90.02%   90.02%           
=======================================
  Files          64       64           
  Lines       11999    11999           
=======================================
  Hits        10802    10802           
  Misses       1197     1197           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread .github/workflows/bloat.yml Outdated
Comment thread .github/workflows/bloat.yml Outdated
Comment thread .github/workflows/bloat.yml Outdated
@lmmx
Copy link
Copy Markdown
Collaborator Author

lmmx commented Oct 18, 2025

Rewrote the bloat check in Python as shell: python (i.e. in the CI workflow), let me know if you'd rather have it as a script

The check status line worked in my demo (because it was a PR from the same repo) but unfortunately failed when I tried it here (as it was coming from repo lmmx/prek to j178/prek, GitHub's security model only allows same-repo PRs to use that API)

@j178 j178 added the ci CI related label Oct 19, 2025
@j178
Copy link
Copy Markdown
Owner

j178 commented Oct 19, 2025

This looks great!

image

@j178 j178 merged commit 2d6cf9c into j178:master Oct 19, 2025
19 checks passed
@lmmx
Copy link
Copy Markdown
Collaborator Author

lmmx commented Oct 19, 2025

Thanks for the edits!

@lmmx lmmx deleted the bloat-action branch October 19, 2025 10:22
@lmmx
Copy link
Copy Markdown
Collaborator Author

lmmx commented Oct 19, 2025

I’ve gone and rebased the branches I had open and added their outputs (the annotation section at the bottom of the Summary page with the 🏠 icon)

IMG_4602

and pasted them into the PR description like this

Binary Size Change
+0.63% (.text: 16.0 MiB → 16.1 MiB)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants