refactor(build): scope size tuning to a dedicated dist profile#720
Merged
Conversation
The workspace-wide [profile.release] added in #286/#690 kept the shipped stibbons binaries under the 15 MB budget, but its size tuning (strip, lto = "thin", codegen-units = 1, opt-level = "s") silently applied to every crate's release build — including CI-only binaries (luggage, record-evidence, containers-common) that are never distributed and that pay the codegen-units=1 / thin-LTO build-time cost and lose debug symbols for no benefit. Move the tuning to a dedicated [profile.dist] (inherits = "release") and build the distribution binaries with `cargo build --profile dist` in release-binaries.yml, updating the packaging paths from target/<triple>/release/ to target/<triple>/dist/. The default release profile returns to Cargo defaults for the rest of the workspace. A dedicated profile is used rather than a [profile.release.package.stibbons] override because Cargo per-package overrides cannot express `lto` (a profile-root-only setting). Verified: `cargo build --profile dist -p stibbons` yields a 3.5 MB stripped binary in target/dist/ (well under the 15 MB gate); just build/test, clippy, fmt, and actionlint all pass. Closes #700
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[profile.release]block was added purely to keep the shipped stibbons binaries under the 15 MB
budget, but its size tuning (
strip,lto = "thin",codegen-units = 1,opt-level = "s") silently applied to every crate's release build.[profile.dist](inherits = "release") soonly the distributed stibbons binaries get it. The default
[profile.release]returns to Cargo defaults for the CI-only crates (
luggage,record-evidence,containers-common) — restoring fast release builds anddebug symbols for binaries that are never distributed.
release-binaries.ymlnow builds withcargo build --profile distand readsartifacts from
target/<triple>/dist/instead oftarget/<triple>/release/.A dedicated profile is used rather than a
[profile.release.package.stibbons]override because Cargo per-package overrides cannot express
lto(aprofile-root-only setting) — the issue calls this out.
Test plan
cargo build --profile dist -p stibbons→ 3.5 MB stripped binary intarget/dist/stibbons, well under the 15 MB gate.just build(default release path) compiles the full workspace.just test→ 3143 passed, 0 failed;cargo clippy --workspaceandcargo fmt --all --checkclean.just lint-workflows(actionlint) passes; no lingeringtarget/<triple>/release/stibbonsreferences remain in the workflow.Closes #700