Skip to content

Move clippyand cargo-shear to separated jobs#7741

Merged
youknowone merged 1 commit into
RustPython:mainfrom
ShaharNaveh:cargo-clippy-once
May 5, 2026
Merged

Move clippyand cargo-shear to separated jobs#7741
youknowone merged 1 commit into
RustPython:mainfrom
ShaharNaveh:cargo-clippy-once

Conversation

@ShaharNaveh
Copy link
Copy Markdown
Contributor

@ShaharNaveh ShaharNaveh commented Apr 30, 2026

ATM we are running clippy 3 times (on Linux, macOS and Windows), it's better to run it once on Linux and give it the --all-targets --all-features flags

Move to a separate step so we will trigger it when rust related code changes

Summary by CodeRabbit

  • Chores
    • Restructured the continuous integration pipeline to isolate code quality checks and dependency validation into dedicated, independent jobs. These checks now run across macOS, Ubuntu, and Windows platforms in parallel, improving workflow efficiency and making it easier to identify build-related issues.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The pull request refactors CI workflow configuration by extracting cargo clippy and cargo-shear checks from multi-OS test and lint jobs into new standalone jobs. Clippy runs on a three-OS matrix, while cargo-shear runs on Ubuntu. Both new jobs are gated on Rust code changes.

Changes

CI Job Reorganization

Layer / File(s) Summary
Data Flow / Job Gating
.github/workflows/ci.yaml (lines 430–499)
Two new standalone jobs clippy and cargo_shear are added with conditional triggers gated on Rust code changes or main branch. Both inherit cache configuration and environment variables from existing patterns.
Core Job Configuration
.github/workflows/ci.yaml (lines 430–477, 478–499)
jobs.clippy runs on a 3-OS matrix with cargo clippy ... -Dwarnings for workspace and all targets. jobs.cargo_shear installs cargo-shear via cargo binstall and runs cargo shear on Ubuntu.
Test Flow Simplification
.github/workflows/ci.yaml (lines 94, 110–112)
The rust-toolchain step in jobs.rust_tests no longer requests the clippy component, and the dedicated cargo clippy run step is removed.
Lint Flow Simplification
.github/workflows/ci.yaml (lines 500–517)
The jobs.lint job no longer installs or runs cargo-shear, deferring that responsibility to the new standalone jobs.cargo_shear.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • fanninpm
  • youknowone

Poem

🐰 Clippy hops to its own stage,
Cargo-shear finds a dedicated page,
Tests run lighter, workflows bright,
Each tool now shines in its own light!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately describes the main change: moving clippy and cargo-shear from multi-OS jobs to separated dedicated jobs, which is the primary focus of the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ci.yaml:
- Around line 372-374: The new GitHub Actions job "clippy" was extracted from
the "rust_tests" job but lost the skip condition, so add the same guard to the
"clippy" job to preserve skip:ci behavior; update the "clippy" job definition
(job name: clippy) to include the if condition that checks the commit message
for "skip:ci" (the same boolean expression used on the original rust_tests job)
so the clippy job is skipped when that token is present.
- Around line 404-407: The ci workflow uses an invalid cargo clippy flag
`--all-target`; update the `cargo clippy` invocation to use the correct flag
`--all-targets` (replace `--all-target` with `--all-targets`) so the job runs
successfully; locate the block containing the `cargo clippy` command in the CI
YAML and make this single-word replacement.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 133f184a-876c-4521-b409-aefdd2c36147

📥 Commits

Reviewing files that changed from the base of the PR and between 88be7bb and 517f450.

📒 Files selected for processing (1)
  • .github/workflows/ci.yaml

Comment thread .github/workflows/ci.yaml Outdated
Comment on lines +372 to +374
clippy:
name: clippy
runs-on: ubuntu-latest
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Apr 30, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve skip:ci behavior on the new clippy job.

clippy was moved out of rust_tests (which had the skip:ci condition), but this new job has no equivalent guard, so it still runs when skip:ci is set.

Suggested fix
   clippy:
+    if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
     name: clippy
     runs-on: ubuntu-latest
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yaml around lines 372 - 374, The new GitHub Actions job
"clippy" was extracted from the "rust_tests" job but lost the skip condition, so
add the same guard to the "clippy" job to preserve skip:ci behavior; update the
"clippy" job definition (job name: clippy) to include the if condition that
checks the commit message for "skip:ci" (the same boolean expression used on the
original rust_tests job) so the clippy job is skipped when that token is
present.

Copy link
Copy Markdown
Contributor Author

@ShaharNaveh ShaharNaveh Apr 30, 2026

Choose a reason for hiding this comment

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

This is fine. we always want to run clippy if the rust code changed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ShaharNaveh, understood — the clippy job is intentionally always-on regardless of the skip:ci label. Apologies for the noise!


✏️ Learnings added
Learnt from: ShaharNaveh
Repo: RustPython/RustPython PR: 7741
File: .github/workflows/ci.yaml:372-374
Timestamp: 2026-04-30T10:24:04.038Z
Learning: In RustPython/.github/workflows/ci.yaml, the `clippy` job intentionally does NOT have the `skip:ci` guard (`if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}`). Clippy (and the `lint` job) are always meant to run, even when the `skip:ci` label is applied to a PR. Do not flag the missing guard on these jobs.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-06T05:30:53.056Z
Learning: Applies to **/*.rs : Always run clippy to lint Rust code (`cargo clippy`) before completing tasks and fix any warnings or lints that are introduced by your changes

Learnt from: reactive-firewall
Repo: RustPython/RustPython PR: 0
File: :0-0
Timestamp: 2026-01-19T20:10:58.864Z
Learning: In the RustPython project's CI/CD workflows (PR `#6176`), bash scripts are preferred over Python or Rust for test orchestration and result aggregation to maintain hermetic testing—avoiding circular dependencies where Python tools would depend on the RustPython interpreter being tested, and avoiding visibility loss into Rust runtime issues when using Rust tooling.

Learnt from: ShaharNaveh
Repo: RustPython/RustPython PR: 5932
File: .github/workflows/comment-commands.yml:18-24
Timestamp: 2025-07-10T10:08:43.330Z
Learning: In GitHub Actions workflows for the RustPython project, the maintainer ShaharNaveh prefers to keep workflows simple and doesn't mind if steps fail when the desired state is already achieved (e.g., user already assigned to an issue). Avoid suggesting complex error handling for edge cases they don't consider problematic.

Comment thread .github/workflows/ci.yaml Outdated
@fanninpm
Copy link
Copy Markdown
Contributor

I'm wondering under what circumstances is it possible that Clippy would fail on non-Ubuntu but pass on Ubuntu.

@ShaharNaveh
Copy link
Copy Markdown
Contributor Author

I'm wondering under what circumstances is it possible that Clippy would fail on non-Ubuntu but pass on Ubuntu.

I don't think there's. All the big rust projects that I saw are using --all-targets --all-features on an ubuntu runner 🤷

I still haven't seen clippy pass on one platform and fails on the other

@fanninpm
Copy link
Copy Markdown
Contributor

I'm wondering under what circumstances is it possible that Clippy would fail on non-Ubuntu but pass on Ubuntu.

I don't think there's. All the big rust projects that I saw are using --all-targets --all-features on an ubuntu runner 🤷

I still haven't seen clippy pass on one platform and fails on the other

In that case, we might not need to run Clippy specifically on WASM.

@ShaharNaveh ShaharNaveh force-pushed the cargo-clippy-once branch 2 times, most recently from 84e001d to 025f9c9 Compare May 4, 2026 10:18
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ci.yaml:
- Around line 468-476: The Clippy step using a multi-line "cargo clippy \"
invocation will fail on windows-latest because PowerShell uses backtick for
continuation; update the "Clippy" job step to ensure it runs under Bash by
adding "shell: bash" to the step (or alternatively collapse the cargo clippy
flags onto a single line) so the "${{ env.CARGO_ARGS }} ... -- -Dwarnings"
continuation is interpreted correctly across runners.
- Around line 478-485: The cargo_shear job references
needs.determine_changes.outputs.rust_code in its if: conditional but does not
declare a needs dependency, so the job will never evaluate that output; update
the cargo_shear job (job name: cargo_shear) to include needs:
[determine_changes] so it can access determine_changes outputs (same fix applied
earlier to clippy): add the needs entry under the cargo_shear job definition to
ensure the conditional runs on PRs and main branch as intended.
- Around line 430-437: The clippy job is missing a needs declaration so its if
expression referencing needs.determine_changes.outputs.rust_code is always
empty; add needs: [determine_changes] to the clippy job (same as cargo_check) so
the needs context exists and the if condition
(needs.determine_changes.outputs.rust_code == 'true' || github.ref ==
'refs/heads/main') evaluates correctly for PRs and main pushes; update the job
block named clippy to include needs: [determine_changes].
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: d0eddefa-3618-4697-b758-4f1b2235eed5

📥 Commits

Reviewing files that changed from the base of the PR and between 158c0c2 and 2a74b46.

📒 Files selected for processing (2)
  • .github/workflows/ci.yaml
  • crates/stdlib/src/openssl.rs
✅ Files skipped from review due to trivial changes (1)
  • crates/stdlib/src/openssl.rs

Comment thread .github/workflows/ci.yaml
Comment thread .github/workflows/ci.yaml Outdated
Comment thread .github/workflows/ci.yaml
@ShaharNaveh ShaharNaveh force-pushed the cargo-clippy-once branch from 025f9c9 to 731dc2a Compare May 4, 2026 10:20
@ShaharNaveh ShaharNaveh changed the title Move clippy to a dedicated job Move clippyand cargo-shear to separated jobs May 4, 2026
@ShaharNaveh
Copy link
Copy Markdown
Contributor Author

I'm wondering under what circumstances is it possible that Clippy would fail on non-Ubuntu but pass on Ubuntu.

After messing with clippy recently, I've saw it happend multiple times. So, I've made it to a dedicated step that will run conditionally if any rust related code was changed

@ShaharNaveh ShaharNaveh force-pushed the cargo-clippy-once branch from 7d6ebcd to bde4b06 Compare May 4, 2026 10:31
@ShaharNaveh ShaharNaveh force-pushed the cargo-clippy-once branch from bde4b06 to 2024fd9 Compare May 4, 2026 12:12
@youknowone youknowone merged commit dc12bff into RustPython:main May 5, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants