ci: split lint into parallel jobs and remove redundant checks#3366
Open
bryantbiggs wants to merge 1 commit into
Open
ci: split lint into parallel jobs and remove redundant checks#3366bryantbiggs wants to merge 1 commit into
bryantbiggs wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3366 +/- ##
=====================================
Coverage 82.8% 82.8%
=====================================
Files 130 130
Lines 27289 27289
=====================================
Hits 22622 22622
Misses 4667 4667 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
10157b4 to
958b8bb
Compare
6dc1f76 to
9d8401c
Compare
1601a97 to
1342870
Compare
Split the monolithic lint job into two parallel CI jobs for faster feedback: - `lint`: format check, workspace-wide clippy, and multi-feature combination checks (~1-2 min) - `lint-feature-matrix`: per-feature clippy via cargo hack (~5-6 min) Previously, all 150 clippy invocations ran sequentially in a single job. The most common CI failure on PRs is the per-feature matrix catching dead code or unused warnings that only surface when individual features are tested in isolation. By splitting these into parallel jobs, contributors get fast feedback on the common checks while the thorough feature matrix runs alongside. Also removes 6 redundant cargo_feature checks from lint.sh that are already covered by `cargo hack --each-feature`: - opentelemetry-otlp "default", "http-proto", "metrics" - opentelemetry-jaeger-propagator "default" - opentelemetry-proto "default", "full" Updates CONTRIBUTING.md to document the cargo hack lint command so contributors can catch per-feature issues locally before pushing.
1342870 to
8941537
Compare
|
|
||
| if rustup component add clippy && \ | ||
| ((cargo --list | grep -q hack) || cargo install cargo-hack); then | ||
| cargo hack --each-feature --no-dev-deps clippy -- -Dwarnings |
Member
There was a problem hiding this comment.
I think we need --all-targets ?
Suggested change
| cargo hack --each-feature --no-dev-deps clippy -- -Dwarnings | |
| cargo hack --each-feature --no-dev-deps clippy --all-targets -- -Dwarnings |
cargo-hack still checks each feature combination, but unlike cargo_feature calls it does not pass --all-targets, so clippy coverage for tests/examples/benches under those feature combinations is reduced.
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
The CI
lintjob is the most frequent source of PR failures. After investigating ~20 recent failures, every single one was a legitimate clippy error (dead code, unused variables, etc.) caught bycargo hack --each-feature— not resource exhaustion or flakiness.The root cause: PRs introduce code that compiles fine with
--all-featuresbut triggers warnings when individual features are tested in isolation (e.g., a function only used withgrpc-tonicenabled but missing#[cfg(feature = "grpc-tonic")]). Contributors don't know to runcargo hacklocally, so they only discover the issue after pushing.This PR improves the situation by:
Splitting lint into two parallel CI jobs for faster feedback:
lint: format, workspace clippy, and multi-feature combo checks (~1-2 min)lint-feature-matrix: per-feature clippy viacargo hack --each-feature(~5-6 min)Previously all ~150 clippy invocations ran sequentially in a single job. Now the quick checks give immediate feedback while the thorough feature matrix runs in parallel.
Removing 6 redundant
cargo_featurechecks fromlint.shthat are already covered bycargo hack --each-feature:opentelemetry-otlp "default","http-proto","metrics"(single-feature, already tested individually by cargo hack)opentelemetry-jaeger-propagator "default"(same)opentelemetry-proto "default","full"(same)Updating CONTRIBUTING.md to document the
cargo hacklint command so contributors can catch per-feature issues locally before pushing.Updating
scripts/precommit.shto include the feature matrix check.Test plan
lintjob passes (format + workspace clippy + multi-feature combos)lint-feature-matrixjob passes (cargo hack per-feature checks)