CI: compile-check the webp helper bins - #3
Merged
Conversation
libwebp-sys2 was a hard dependency of the whole crate, but only the screenshot and stillimage helper bins use it. That forced `cargo test` and `cargo bench` to link the system libwebp for no reason. Make it optional behind an off-by-default `webp` feature and gate those two bins on it. Ordinary builds, tests, and benchmarks now build without libwebp installed; generate the screenshot with `cargo run --features webp --bin screenshot`.
The old text claimed cost was dominated by per-frame rendering. Sampling the running app showed it is >99% idle between frames, so frame count is the first-order battery lever. Of the per-frame on-CPU work, ~83% is the Rust renderer, ~15% the setImage handoff, and CGImage construction is negligible. Split the section by tool (Criterion for the renderer in isolation, `sample` for on-CPU hotspots, powermetrics for energy and wakeups), and note the traps each has: `sample` undercounts blocking IPC, and the WindowServer cost of compositing our icon is charged to its process, not ours.
The screenshot and stillimage helper bins are gated behind the off-by-default `webp` feature, so plain `cargo build`/`cargo test` no longer compile them at all. Install libwebp-dev on the runner and build with `--all-targets --all-features` so CI compile-checks everything: the lib, both helper bins, tests, and benches.
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.
The
screenshotandstillimagehelper bins are gated behind the off-by-defaultwebpfeature (which links the system libwebp), so plaincargo build/cargo testno longer compile them at all — previously they compiled in CI only by luck, because GitHub's Ubuntu image happens to ship libwebp.This installs
libwebp-devon the runner and builds with--all-targets --all-featuresso CI compile-checks everything: the lib, both helper bins, tests, and benches.--all-features(rather than--features webp) stays correct if more features are added later.Trade-off: the apt step is now a hard dependency, so CI fails at install if the package mirror hiccups — the intended cost of declaring the libwebp dependency instead of relying on the preinstalled image.
🤖 Generated with Claude Code (Opus 4.8)