Refactor "code check" GitHub workflow for execution speed#809
Refactor "code check" GitHub workflow for execution speed#809forstmeier merged 8 commits intomasterfrom
Conversation
📝 WalkthroughWalkthroughAdded a change-detection job to conditionally run language-specific CI checks, rewrote coverage upload to use parallel Coveralls uploads and a parallel-finished finalizer, and added a verification job plus workflow permissions to fail the run when required checks neither succeeded nor were skipped. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis PR refactors the Key changes:
Confidence Score: 5/5Safe to merge — logic is correct across all conditional execution paths, coverage finalization, and the verify gate. The workflow change is well-reasoned and internally consistent. The conditional || in finish_coverage_upload correctly handles the case where only one language job ran. The carryforward setting handles skipped jobs gracefully. The verify job correctly treats both success and skipped as acceptable states. No P0 or P1 issues were identified. No files require special attention.
|
| Filename | Overview |
|---|---|
| .github/workflows/run_code_checks.yaml | Refactors CI to add path-based change detection, per-language conditional execution, direct parallel Coveralls uploads, and a final verification job — logic is sound with no critical issues. |
Reviews (7): Last reviewed commit: "Merge branch 'master' into language-spec..." | Re-trigger Greptile
There was a problem hiding this comment.
Warning
CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.
Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.
Actionable comments posted: 1
🤖 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/run_code_checks.yaml:
- Around line 11-39: Add a workflow-level permissions block to restrict
GITHUB_TOKEN to least privilege: in the workflow that defines the detect_changes
job (and the dorny/paths-filter step) add a top-level permissions: entry
granting only pull-requests: read (required by dorny/paths-filter) plus any
other minimal permissions needed by downstream steps (e.g., statuses: write if
Coveralls needs it); ensure no broad permissions like write-all are used and
GITHUB_TOKEN is not implicitly allowed beyond these explicit permissions.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: c9e0e742-6dbc-4f82-b3a3-dca34316d988
📒 Files selected for processing (1)
.github/workflows/run_code_checks.yaml
There was a problem hiding this comment.
Pull request overview
Refactors the run_code_checks GitHub Actions workflow to reduce CI runtime by only running language-specific checks when relevant files change, and updates coverage reporting to Coveralls using parallel uploads.
Changes:
- Add a
detect_changesjob (viadorny/paths-filter) and gate Rust/Python/Markdown/YAML jobs based on detected file changes. - Switch Rust/Python coverage handling from artifact upload/download to per-job Coveralls uploads with a final “parallel-finished” step.
- Add a final
verify_all_checks_passedjob to fail the workflow if any required job fails/cancels (while allowing skipped jobs).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…kflow gaps - Add workflow-level permissions block (contents: read, pull-requests: read, statuses: write) to restrict GITHUB_TOKEN scope per GitHub Advanced Security and CodeRabbit recommendations - Add maskfile.md, .flox/**, devenv.* to rust and python paths-filter rules so shared CI entrypoint changes trigger the appropriate language checks - Add detect_changes to verify_all_checks_passed needs so a failure in detect_changes is caught rather than silently skipped Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Warning
CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.
Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.
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/run_code_checks.yaml:
- Around line 30-49: The workflow filters currently won't match the workflow
file itself or the shared CI inputs; update the filter sets so the
Rust/Python/Markdown/YAML groups include the workflow and shared inputs patterns
(e.g., add a pattern matching the workflows directory or this file such as
'.github/**' or specifically the workflow filename) and ensure '.flox/**' and
'devenv.*' are present in the Markdown and YAML filter blocks as well so the
refactored job paths and Flox/devenv inputs are exercised; adjust the keys shown
(rust, python, markdown, yaml) to include those additional patterns so
run_code_checks.yaml and shared CI files are detected.
- Around line 151-164: The Coveralls finalization step currently runs when
either language job succeeds (using OR) which allows publishing stale coverage
via the carryforward parameter even if the other job failed; update the workflow
`if` condition for the "Finalize coverage upload" step to require both
`needs.run_rust_code_checks.result == 'success'` AND
`needs.run_python_code_checks.result == 'success'` (so the step only runs when
both language checks succeeded) and keep `parallel-finished`/`carryforward`
as-is for true skipped jobs.
- Around line 90-96: Guard the Coveralls upload step by checking
.coverage_output/rust.xml exists before running it: add a preliminary step (id:
check-rust-coverage) that runs a shell test like [ -f .coverage_output/rust.xml
] and sets an output (rust_exists) to "true" or "false", and then add an if:
condition on the Coveralls step (the step using coverallsapp/github-action@v2)
such as if: steps.check-rust-coverage.outputs.rust_exists == 'true' so the
upload (file: .coverage_output/rust.xml, flag-name: rust) only runs when the
rust.xml file is present.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: be848c89-f25e-4c8d-ade6-dcd691db6a4d
📒 Files selected for processing (1)
.github/workflows/run_code_checks.yaml
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Warning
CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.
Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.
Actionable comments posted: 1
♻️ Duplicate comments (1)
.github/workflows/run_code_checks.yaml (1)
168-173:⚠️ Potential issue | 🟡 MinorCoveralls finalization may still mask failed jobs with stale coverage.
The current condition allows
parallel-finishedto run when one job succeeds and the other fails. Withcarryforward: rust,python, a failed Python job would still publish the last known Python coverage from a previous build, masking the failure in coverage metrics.Consider strengthening the condition to ensure neither job failed:
🧭 Suggested condition to prevent stale coverage on failure
if: | always() && + ( + needs.run_rust_code_checks.result == 'success' || + needs.run_rust_code_checks.result == 'skipped' + ) && + ( + needs.run_python_code_checks.result == 'success' || + needs.run_python_code_checks.result == 'skipped' + ) && ( needs.run_rust_code_checks.result == 'success' || needs.run_python_code_checks.result == 'success' )This ensures coverage is only finalized when all language jobs either passed or were intentionally skipped (no changes detected), preventing stale carryforward data from masking actual test failures.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/run_code_checks.yaml around lines 168 - 173, The parallel-finished job currently runs when either run_rust_code_checks OR run_python_code_checks succeeded, allowing carryforward to publish stale coverage; update the job's if condition (the expression under the if: for the parallel-finished step) to only proceed when neither needs.run_rust_code_checks.result nor needs.run_python_code_checks.result is 'failure' (e.g., require both results != 'failure' or explicitly require each is one of success/skipped/neutral), so that a failed language job prevents finalizing Coveralls when using carryforward: rust,python.
🤖 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/run_code_checks.yaml:
- Around line 128-134: Add the same file-existence guard used for Rust: create a
prior step (e.g., "Check Python coverage file") that checks for
.coverage_output/python.xml and sets an output like coverage_exists, then add an
if condition to the "Upload coverage to Coveralls" step so it only runs when
that output is true; reference the step name "Upload coverage to Coveralls" and
the target file ".coverage_output/python.xml" when making the change.
---
Duplicate comments:
In @.github/workflows/run_code_checks.yaml:
- Around line 168-173: The parallel-finished job currently runs when either
run_rust_code_checks OR run_python_code_checks succeeded, allowing carryforward
to publish stale coverage; update the job's if condition (the expression under
the if: for the parallel-finished step) to only proceed when neither
needs.run_rust_code_checks.result nor needs.run_python_code_checks.result is
'failure' (e.g., require both results != 'failure' or explicitly require each is
one of success/skipped/neutral), so that a failed language job prevents
finalizing Coveralls when using carryforward: rust,python.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: e3cd527d-3399-466f-b210-e100d418d435
📒 Files selected for processing (1)
.github/workflows/run_code_checks.yaml
There was a problem hiding this comment.
Warning
CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.
Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.
Actionable comments posted: 1
🤖 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/run_code_checks.yaml:
- Around line 111-115: The workflow job run_python_code_checks lacks a timeout
and can hang indefinitely; add a timeout-minutes setting to the job definition
(e.g., timeout-minutes: 60) under the run_python_code_checks job to mirror the
Rust job and prevent hung CI runs, ensuring the timeout is placed alongside
runs-on and other job-level keys in the job block.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 370d3000-87ad-455a-9dfc-73fca4a10ec0
📒 Files selected for processing (1)
.github/workflows/run_code_checks.yaml
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Overview
Changes
Context
Minor update because I'm tired of Rust running on every single run even with the cache.
Summary by CodeRabbit