Conversation
Reviewer's GuideThis PR enhances the generate-coverage action to detect and handle mixed Python/Rust repositories: it replaces the strict single-language detection with flag-based logic, adjusts the Rust and Python coverage steps to emit separate reports, introduces a merge step for Cobertura outputs in mixed mode, and updates documentation and the changelog accordingly. Flow diagram for mixed Python/Rust coverage supportflowchart TD
A[Start] --> B{Project type?}
B -- Both present --> C[Set lang=mixed]
B -- Cargo.toml only --> D[Set lang=rust]
B -- pyproject.toml only --> E[Set lang=python]
B -- Neither --> F[Exit with error]
C --> G{lang}
D --> G
E --> G
G -- rust --> H[Run cargo llvm-cov]
G -- python --> I[Run slipcover with pytest]
G -- mixed --> J[Run both & merge]
H --> K[Set outputs]
I --> K
J --> K
K --> L[End]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary by CodeRabbit
Summary by CodeRabbit
WalkthroughThe changes introduce support for projects containing both Python and Rust codebases in the GitHub Action for coverage generation. The action now detects mixed-language projects, runs coverage for both languages, and merges their Cobertura reports. Documentation and workflow descriptions have been updated to reflect these enhancements. Changes
Sequence Diagram(s)sequenceDiagram
participant Workflow
participant Action
participant RustCov
participant PyCov
participant UvxMerge
Workflow->>Action: Start coverage action
Action->>Action: Detect project language(s)
alt Rust only
Action->>RustCov: Run Rust coverage
RustCov-->>Action: Rust coverage report
Action->>Workflow: Output Rust coverage
else Python only
Action->>PyCov: Run Python coverage
PyCov-->>Action: Python coverage report
Action->>Workflow: Output Python coverage
else Mixed (Rust + Python)
Action->>RustCov: Run Rust coverage (rust.cobertura.xml)
RustCov-->>Action: Rust coverage report
Action->>PyCov: Run Python coverage (python.cobertura.xml)
PyCov-->>Action: Python coverage report
Action->>UvxMerge: Merge rust.cobertura.xml + python.cobertura.xml
UvxMerge-->>Action: Merged cobertura.xml
Action->>Workflow: Output merged coverage
end
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)`.github/actions/*/action.yml`: Each action must have an action.yml file containing all inputs and outputs, with required ones clearly marked.
📄 Source: CodeRabbit Inference Engine (AGENTS.md) List of files the instruction was applied to:
🔇 Additional comments (9)
✨ Finishing Touches🧪 Generate Unit Tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 3
🔭 Outside diff range comments (1)
.github/actions/generate-coverage/action.yml (1)
4-19: Explicitly declare input types for stronger schema validation.
features,output-path, andformatimplicitly default tostring.
Addingtype: stringmakes intent clear and prevents future drift.features: description: Cargo features to enable required: false + type: string … output-path: description: Output file path required: true + type: string … format: description: Coverage format required: false + type: string default: cobertura
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
.github/actions/generate-coverage/CHANGELOG.md(1 hunks).github/actions/generate-coverage/README.md(2 hunks).github/actions/generate-coverage/action.yml(5 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`.github/actions/*/CHANGELOG.md`: Each action must have a CHANGELOG.md tracking SemVer-based changes for that action only.
.github/actions/*/CHANGELOG.md: Each action must have a CHANGELOG.md tracking SemVer-based changes for that action only.
📄 Source: CodeRabbit Inference Engine (AGENTS.md)
List of files the instruction was applied to:
.github/actions/generate-coverage/CHANGELOG.md
`.github/actions/*/action.yml`: Each action must have an action.yml file containing all inputs and outputs, with required ones clearly marked.
.github/actions/*/action.yml: Each action must have an action.yml file containing all inputs and outputs, with required ones clearly marked.
📄 Source: CodeRabbit Inference Engine (AGENTS.md)
List of files the instruction was applied to:
.github/actions/generate-coverage/action.yml
`.github/actions/*/README.md`: Each action must have a README.md containing a on...
.github/actions/*/README.md: Each action must have a README.md containing a one-liner summary, table of inputs (name, type, default, description, required?), table of outputs, usage example with 'uses: ./.github/actions/@', and a release history link to CHANGELOG.
📄 Source: CodeRabbit Inference Engine (AGENTS.md)
List of files the instruction was applied to:
.github/actions/generate-coverage/README.md
🔇 Additional comments (2)
.github/actions/generate-coverage/CHANGELOG.md (1)
3-6: Changelog entry looks good.Version bump, date stamp, and concise summary meet the repo’s semver-driven CHANGELOG requirements.
.github/actions/generate-coverage/action.yml (1)
74-82: Echoingfiletwice can confuse consumers.
rust(andpython) emit afileoutput, but the finaloutstep overwrites the composite’sfilewith the user-suppliedoutput-path.
Down-stream workflows expecting the real artefact may read the wrong value whenoutput-pathis overridden in mixed mode (*.rust.xml). Consider:
- Dropping the
fileecho from the language-specific steps, or- Using a distinct key (e.g.
partial-file) in those steps and keeping the merged path for the finalfile.Also applies to: 90-93
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (2)
.github/actions/generate-coverage/action.yml (2)
79-98:ruststep may fail when output is nested – ensure the directory exists.
Unlike the Python step, the Rust block does notmkdir -p "$(dirname "$out")".
Passing a path such asreports/coverage.xmlwill causecargo llvm-covto error with “No such file or directory”.out="${{ inputs.output-path }}" if [[ "${{ steps.detect.outputs.lang }}" == 'mixed' ]]; then out="${{ inputs.output-path }}.rust.xml" fi + mkdir -p "$(dirname "$out")"
50-56: Accept format names case-insensitively to reduce user friction.
Users occasionally passCoberturaorLCOV. Normalising to lowercase before validation avoids surprising failures.- case "${{ inputs.format }}" in + fmt="${{ inputs.format,, }}" # bash lowercase + case "$fmt" in(and replace subsequent
${{ inputs.format }}references with$fmt)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
.github/actions/generate-coverage/README.md(2 hunks).github/actions/generate-coverage/action.yml(6 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`.github/actions/*/README.md`: Each action must have a README.md containing a on...
.github/actions/*/README.md: Each action must have a README.md containing a one-liner summary, table of inputs (name, type, default, description, required?), table of outputs, usage example with 'uses: ./.github/actions/@', and a release history link to CHANGELOG.
📄 Source: CodeRabbit Inference Engine (AGENTS.md)
List of files the instruction was applied to:
.github/actions/generate-coverage/README.md
`.github/actions/*/action.yml`: Each action must have an action.yml file containing all inputs and outputs, with required ones clearly marked.
.github/actions/*/action.yml: Each action must have an action.yml file containing all inputs and outputs, with required ones clearly marked.
📄 Source: CodeRabbit Inference Engine (AGENTS.md)
List of files the instruction was applied to:
.github/actions/generate-coverage/action.yml
🔇 Additional comments (1)
.github/actions/generate-coverage/README.md (1)
3-8: Opening sentence now clearly covers mixed projects – looks good.
The wording fully resolves the previous feedback and accurately reflects the new capability.
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
.github/actions/generate-coverage/README.md(2 hunks).github/actions/generate-coverage/action.yml(4 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`.github/actions/*/README.md`: Each action must have a README.md containing a on...
.github/actions/*/README.md: Each action must have a README.md containing a one-liner summary, table of inputs (name, type, default, description, required?), table of outputs, usage example with 'uses: ./.github/actions/@', and a release history link to CHANGELOG.
📄 Source: CodeRabbit Inference Engine (AGENTS.md)
List of files the instruction was applied to:
.github/actions/generate-coverage/README.md
`.github/actions/*/action.yml`: Each action must have an action.yml file containing all inputs and outputs, with required ones clearly marked.
.github/actions/*/action.yml: Each action must have an action.yml file containing all inputs and outputs, with required ones clearly marked.
📄 Source: CodeRabbit Inference Engine (AGENTS.md)
List of files the instruction was applied to:
.github/actions/generate-coverage/action.yml
🔇 Additional comments (5)
.github/actions/generate-coverage/README.md (4)
3-8: Opening sentence is clear – good update.The new wording explicitly mentions mixed projects and resolves the past review comment.
No further action required.
15-28: Mermaid branch labels align with new logic.The flowchart now visualises the mixed branch correctly; naming is consistent with the code (
lang=mixed).
Looks good.
40-41: Foot-note clarifies format limitations – nice touch.The asterisk note prevents mis-configuration for mixed projects.
All good.
48-48: Outputs table updated – LGTM.Including
mixedin thelangoutput keeps docs and action contract in sync..github/actions/generate-coverage/action.yml (1)
145-155: Nice fail-fast guard before merging.The explicit file-existence check addresses the earlier review concern – well done.
There was a problem hiding this comment.
Actionable comments posted: 5
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.github/actions/generate-coverage/action.yml(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`.github/actions/*/action.yml`: Each action must have an action.yml file containing all inputs and outputs, with required ones clearly marked.
.github/actions/*/action.yml: Each action must have an action.yml file containing all inputs and outputs, with required ones clearly marked.
📄 Source: CodeRabbit Inference Engine (AGENTS.md)
List of files the instruction was applied to:
.github/actions/generate-coverage/action.yml
🔇 Additional comments (5)
.github/actions/generate-coverage/action.yml (5)
39-45: Robust mixed-project detection – looks goodCleanly distinguishes
rust,python, and mixed projects instead of erroring out. This unblocks mixed-language repositories without complicating the logic.
50-58: Lower-case normalisation bug resolvedMoving the
,,expansion into the shell eliminates the earlier syntax issue—nice catch.
74-78: ConsistentlangmappingMapping
both → mixedkeeps external outputs clean.
132-147: Slipcover invocation looks correctBranch coverage and XML generation wired appropriately.
161-163: Final outputs wired correctlyThe composite step exposes the merged file path and normalised format as expected.
Summary
uvx merge-coberturaTesting
npm test(fails: could not find package.json)https://chatgpt.com/codex/tasks/task_e_685beca3efbc83228c330b6019daae9d
Summary by Sourcery
Add mixed Python/Rust coverage support to the Generate coverage action
New Features:
uvx merge-coberturaEnhancements:
Documentation: