Skip to content

Track Linux binary sizes in CI - #2730

Draft
zaniebot wants to merge 13 commits into
mainfrom
zb/track-binary-size
Draft

zaniebot wants to merge 13 commits into
mainfrom
zb/track-binary-size

Conversation

@zaniebot

@zaniebot zaniebot commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Track native Linux x86-64 sizes for uv, uvx, and uv-build on main and on CI runs for pull requests labeled build:binary-size. Compare each PR's merge commit with its first parent. Size changes are informational.

Build uv and uvx with release and uv-build with minimal-size. Reuse compiled workspace crates and dependencies using the same caching approach as the test workflow, and skip baseline builds when an exact measurement is available. These native builds omit release PGO, SBOM embedding, and manylinux packaging.

Same-repository PRs receive a size-only comment through a pinned publisher using STS. The publisher stores the comment ID in aghs-kv with pull-request scope and verifies the comment's author, PR, and marker before updating it. Missing or expired IDs and deleted comments create a new report. KV read failures prevent publication; write failures fail the job after publication and can lead to a duplicate on a later run. There is no comment scan.

The KV and STS grants are supplied by astral-sh#22822. The automations environment must also provide KV_API_URL.

@zaniebot zaniebot added the build:binary-size Measure Linux binary sizes for a pull request label Oct 14, 2026
@astral-automations-bot astral-automations-bot Bot added internal A refactor or improvement that is not user-facing internal:ci Related to continuous integration workflows and infrastructure labels Oct 14, 2026
@zaniebot
zaniebot deployed to automations October 14, 2026 18:18 — with GitHub Actions Active
@zaniebot
zaniebot deployed to automations October 14, 2026 18:23 — with GitHub Actions Active
Comment thread .github/workflows/binary-size.yml Outdated
if [[ "$EVENT_NAME" == "pull_request" ]]; then
args+=(--base measurements/binary-size-base/measurement.json)
fi
python3 scripts/binary_size.py report measurements/binary-size-current/measurement.json "${args[@]}" | tee "$GITHUB_STEP_SUMMARY"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Preserve report failures through the tee pipeline

If report fails while reading or validating a measurement, this step still succeeds: GitHub’s default Linux shell uses bash -e without pipefail, so the pipeline returns tee’s successful exit status. I reproduced an invalid-target measurement yielding exit code 0 and an empty summary. Add shell: bash to this step or explicitly enable pipefail so reporting failures remain visible while size increases stay informational.

@zaniebot

zaniebot commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator Author

Binary size

Binary Base (bytes) Current (bytes) Change (bytes) Change (%)
uv 44,042,288 44,042,832 +544 +0.00%
uvx 319,912 319,912 +0 +0.00%
uv-build 3,288,896 3,288,896 +0 +0.00%
Build details

Target: x86_64-unknown-linux-gnu.

Current revision: d79b229c.
Baseline revision: 761aba44.

Incremental native Cargo builds with release for uv and uvx, and minimal-size for uv-build. Sizes are uncompressed bytes. These builds exclude the release pipeline's PGO, SBOM embedding, and manylinux packaging.

CI run.

@zaniebot
zaniebot changed the base branch from main to zb/allow-binary-size-report-token October 14, 2026 19:07
@zaniebot
zaniebot force-pushed the zb/track-binary-size branch from 8d7e3e3 to e070521 Compare October 14, 2026 19:07
@zaniebot
zaniebot deployed to automations October 14, 2026 19:08 — with GitHub Actions Active
@zaniebot
zaniebot deployed to automations October 15, 2026 15:05 — with GitHub Actions Active
@zaniebot
zaniebot changed the base branch from zb/allow-binary-size-report-token to main October 15, 2026 15:10
@zaniebot
zaniebot force-pushed the zb/track-binary-size branch from a197a0e to 8a69411 Compare October 15, 2026 15:10
@zaniebot
zaniebot deployed to automations October 15, 2026 15:12 — with GitHub Actions Active
@zaniebot
zaniebot deployed to automations October 15, 2026 15:24 — with GitHub Actions Active
@astral-automations-bot

astral-automations-bot Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Binary size

Binary Base (bytes) Current (bytes) Change (bytes) Change (%)
uv 44,002,192 44,002,192 +0 +0.00%
uvx 319,912 319,912 +0 +0.00%
uv-build 2,990,352 2,990,352 +0 +0.00%
Build details

Target: x86_64-unknown-linux-gnu.

Current revision: 3650df7c.
Baseline revision: dd596126.

Native Cargo builds with release for uv and uvx, and minimal-size for uv-build. Sizes are uncompressed bytes. These builds exclude the release pipeline's PGO, SBOM embedding, and manylinux packaging.

CI run.

@zaniebot
zaniebot deployed to automations October 15, 2026 15:26 — with GitHub Actions Active
@zaniebot
zaniebot deployed to automations October 15, 2026 16:13 — with GitHub Actions Active
@zaniebot
zaniebot deployed to automations October 15, 2026 16:18 — with GitHub Actions Active
Comment on lines +73 to +75
with:
ref: ${{ matrix.sha }}
path: source

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Isolate the measured revision from the tooling checkout

On a baseline cache miss, source sits beneath the PR merge checkout. Cargo also reads ancestor .cargo/config.toml files, so a PR adding Linux rustflags, such as a size-reducing linker option, applies those settings to the baseline too. A nested-directory Cargo configuration probe confirmed this inheritance. The comparison can therefore hide the intended size change and produce different results depending on baseline cache availability. Put the tooling and measured checkouts in sibling directories so the PR's configuration cannot affect the baseline build.

@zaniebot
zaniebot force-pushed the zb/track-binary-size branch from 97a483f to 610bb32 Compare October 22, 2026 05:11
astral-automations-bot Bot added a commit to astral-sh/uv that referenced this pull request Oct 22, 2026
Binary-size reports need persistent comment IDs so later runs can update
reports without listing pull request comments. Grant `read` and `write`
access to `pull-request` KV state for the pinned
`publish-binary-size.yml` revision, and move the existing STS comment
grants from `binary-size.yml` to that revision. The grants apply to
`ci.yml` pull-request runs on `refs/pull/*/merge` in the `automations`
environment for `astral-sh/uv` and `astral-sh/uv-dev`.

This policy can merge before the workflows in astral-sh#2730; it
does not enable reporting by itself.

---------

Co-authored-by: zaniebot <[email protected]>
@zaniebot
zaniebot force-pushed the zb/track-binary-size branch from 610bb32 to 65b1d89 Compare October 22, 2026 05:18
@zaniebot
zaniebot deployed to automations October 22, 2026 05:19 — with GitHub Actions Active
@astral-automations-bot

Copy link
Copy Markdown

Binary size

Binary Base (bytes) Current (bytes) Change (bytes) Change (%)
uv 43,576,144 43,576,144 +0 +0.00%
uvx 318,392 318,392 +0 +0.00%
uv-build 3,000,464 3,000,464 +0 +0.00%
Build details

Target: x86_64-unknown-linux-gnu.

Current revision: 1acdcbf4.
Baseline revision: ba34aa9d.

Native Cargo builds with release for uv and uvx, and minimal-size for uv-build. Sizes are uncompressed bytes. These builds exclude the release pipeline's PGO, SBOM embedding, and manylinux packaging.

CI run.

This branch was successfully deployed

1 active deployment
automations — 31823db9 Deployed Oct 22, 2026 by zaniebot via build-binary-size / publish / publish #11366
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build:binary-size Measure Linux binary sizes for a pull request internal:ci Related to continuous integration workflows and infrastructure internal A refactor or improvement that is not user-facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants