Use shared actions for setup and coverage#126
Conversation
Reviewer's GuideThe CI workflow now leverages shared GitHub Actions for Rust environment setup and coverage generation, replacing several manual steps for toolchain provisioning, caching, and coverage collection. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary by CodeRabbit
WalkthroughUpdate the CI workflow to use shared GitHub Actions for Rust setup and coverage generation, replacing explicit Rust toolchain setup, cargo cache, and manual coverage steps. Switch formatting and linting commands to Makefile targets. Add a step to archive coverage files and refine coverage upload conditions. Retain existing CodeScene upload step. Changes
Sequence Diagram(s)sequenceDiagram
participant GitHubActions
participant SharedSetupRustAction
participant SharedGenerateCoverageAction
GitHubActions->>SharedSetupRustAction: Setup Rust environment
GitHubActions->>GitHubActions: Run format and lint via Makefile targets
GitHubActions->>GitHubActions: Run tests
GitHubActions->>SharedGenerateCoverageAction: Generate coverage (lcov)
GitHubActions->>GitHubActions: Archive coverage artifact (lcov.info)
GitHubActions->>GitHubActions: Upload coverage to CodeScene (conditional)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
✨ 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: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci.yml(1 hunks)
🔇 Additional comments (1)
.github/workflows/ci.yml (1)
12-12: Drop or use the BUILD_PROFILE variable.
BUILD_PROFILE: debugis set at job-level but none of the subsequent steps reference it. Dead environment variables create confusion and invite drift. Either remove the line or make the variable meaningful inside the shared actions or custom commands.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci.yml(1 hunks)
🔇 Additional comments (4)
.github/workflows/ci.yml (4)
12-12: Clarify whyBUILD_PROFILEis hard-wired todebug.Tarpaulin recompiles the crate with its own flags; forcing
BUILD_PROFILE=debugmay be redundant or even unexpected for downstream scripts. Document the need or drop the variable to avoid confusion.
17-17: Good practice: Action is pinned to an immutable commit.
19-23: Guarantee rustfmt / clippy availability before running Make targets.
make check-fmtandmake lintnormally require therustfmtandclippycomponents. Verify thatleynos/shared-actions/.../setup-rustinstalls those components; otherwise these steps will fail. If not, callrustup component add rustfmt clippyright after the setup action.
28-32: Artifact upload looks solid.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci.yml(1 hunks)
🔇 Additional comments (2)
.github/workflows/ci.yml (2)
16-16: Pinned shared action improves reproducibility
Good job pinningsetup-rustto an exact commit; this guards against silent changes in later versions.
17-20: Remove redundant Rustfmt setup – setup-rust action already installs Rustfmt
Theleynos/shared-actions/.github/actions/setup-rust@688ce00step (ci.yml line 16) specifiescomponents: rustfmt, clippy, llvm-tools-preview, sorustfmtis available formake check-fmt. No additionalrustup component add rustfmtstep needed.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci.yml(2 hunks)
🔇 Additional comments (4)
.github/workflows/ci.yml (4)
16-16: Good: action pinned by SHA ensures reproducible builds
Pinning the sharedsetup-rustaction to an exact commit locks the CI to a known state and protects against accidental breaking changes upstream.
17-20: Centralise quality gates in Make targets
Switching tomake check-fmtandmake lintremoves ad-hoc cargo invocations from the workflow and keeps the logic in one place. This improves maintainability and shortens the workflow file.
21-25: Verify coverage format expectations
The shared action outputs line-coverage in LCOV format only. Confirm that CodeScene (and any local dashboards) do not require branch or function coverage; otherwise pass the extracoverage-typesor equivalent input if the action supports it.
43-43: Coverage upload correctly gated on previous step outcome
Conditionsteps.generate-coverage.outcome == 'success'prevents spurious failures when coverage generation breaks—good job.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci.yml(2 hunks)
🔇 Additional comments (1)
.github/workflows/ci.yml (1)
16-20: Approve CI workflow: setup-rust installs rustfmt and clippyVerified that
setup-rust@98416700e0fe9b85f381b621b1703db6ccbd189c’s action.yml (line 39) declares
components: rustfmt, clippy, llvm-tools-preview.
make check-fmtandmake lintwill pass without explicit installs.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…ov.info is absent Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
b6777b9 to
d51a3db
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
.github/workflows/ci.yml (1)
21-25: Restore artefact upload to persistlcov.info
The previous review introduced anArchive lcovstep withif: always(),if-no-files-found: ignore, andretention-daysto keep the coverage report available for troubleshooting. That step is now missing, so any failure inupload-codescene-coveragediscards the evidence. Re-insert the artefact step.- id: generate-coverage uses: leynos/shared-actions/.github/actions/generate-coverage@732d248978b5d9b7521ce8a2b34b9f3eaf58a8e8 with: output-path: lcov.info format: lcov + - name: Archive lcov + if: always() + uses: actions/upload-artifact@v4 + with: + name: lcov + path: lcov.info + if-no-files-found: ignore + retention-days: 14
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci.yml(1 hunks)
🔇 Additional comments (1)
.github/workflows/ci.yml (1)
17-20: Verifymake check-fmt/make linthave required toolchain components
The sharedsetup-rustaction must installrustfmtandclippy; otherwise these Make targets will fail at runtime. Check the action’s implementation or add explicit component installation here.
| bash install-cs-coverage-tool.sh -y | ||
| rm install-cs-coverage-tool.sh | ||
| run: make lint | ||
| - id: generate-coverage |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Drop unused id: generate-coverage
No later step references ${{ steps.generate-coverage.* }}. Remove the id to keep the workflow tidy.
🤖 Prompt for AI Agents
In .github/workflows/ci.yml at line 21, the step has an unused id
"generate-coverage" which is not referenced by any later steps. Remove the "id:
generate-coverage" line from this step to clean up the workflow file and avoid
unnecessary identifiers.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
.github/workflows/ci.yml (2)
21-21: Drop unusedid: generate-coverage.No subsequent step references
${{ steps.generate-coverage.* }}. Remove the identifier to keep the workflow tidy.
22-25: Archivelcov.infoeven on failure.Retain the artefact to diagnose coverage issues offline. Insert an unconditional upload step after coverage generation.
- id: generate-coverage uses: leynos/shared-actions/.github/actions/generate-coverage@b2f82fdc94c8c9da67833f972a02814c9ef8cf16 with: output-path: lcov.info format: lcov + - name: Archive lcov + if: always() + uses: actions/upload-artifact@v4 + with: + name: lcov + path: lcov.info + if-no-files-found: ignore + retention-days: 14
| env: | ||
| CS_ACCESS_TOKEN: ${{ secrets.CS_ACCESS_TOKEN }} | ||
| if: ${{ env.CS_ACCESS_TOKEN != '' }} |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Remove redundant env: block.
CS_ACCESS_TOKEN is already set at job scope (line 11–13). Delete the step-local env: to avoid duplication and lower maintenance overhead.
- - name: Upload coverage data to CodeScene
- env:
- CS_ACCESS_TOKEN: ${{ secrets.CS_ACCESS_TOKEN }}
+ - name: Upload coverage data to CodeScene📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| env: | |
| CS_ACCESS_TOKEN: ${{ secrets.CS_ACCESS_TOKEN }} | |
| if: ${{ env.CS_ACCESS_TOKEN != '' }} | |
| - name: Upload coverage data to CodeScene | |
| if: ${{ env.CS_ACCESS_TOKEN != '' }} |
🤖 Prompt for AI Agents
In .github/workflows/ci.yml around lines 27 to 29, the step-local env block
setting CS_ACCESS_TOKEN is redundant because it is already defined at the job
scope on lines 11 to 13. Remove the env: block from this step to avoid
duplication and reduce maintenance overhead, relying on the job-level
environment variable instead.
Summary
setup-rustcomposite actionTesting
make fmtmake lintmake testhttps://chatgpt.com/codex/tasks/task_e_687f3b764bb88322b404d1572e3545ba
Summary by Sourcery
Update CI workflow to leverage shared GitHub actions for Rust setup and coverage, and configure the build profile
CI: