Skip to content

Use shared actions for setup and coverage#126

Merged
leynos merged 20 commits intomainfrom
codex/update-ci-workflow-for-new-actions
Jul 29, 2025
Merged

Use shared actions for setup and coverage#126
leynos merged 20 commits intomainfrom
codex/update-ci-workflow-for-new-actions

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Jul 22, 2025

Summary

  • use setup-rust composite action
  • generate coverage with shared action

Testing

  • make fmt
  • make lint
  • make test

https://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:

  • Set BUILD_PROFILE environment variable to debug
  • Use shared setup-rust action in place of manual toolchain installation and cache steps
  • Use shared generate-coverage action to produce lcov report instead of manual tarpaulin commands

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jul 22, 2025

Reviewer's Guide

The 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

Change Details Files
Adopt shared setup-rust composite action
  • Removed explicit rust-toolchain step
  • Removed custom cargo registry cache step
  • Added leynos/shared-actions setup-rust action
  • Introduced BUILD_PROFILE environment variable
.github/workflows/ci.yml
Adopt shared generate-coverage action
  • Removed manual cargo-tarpaulin installation and invocation
  • Added leynos/shared-actions generate-coverage action with output-path and format inputs
.github/workflows/ci.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 22, 2025

Summary by CodeRabbit

  • Chores
    • Updated the continuous integration workflow to use shared GitHub Actions for setting up Rust, generating coverage reports, and uploading coverage data.
    • Replaced manual steps for formatting, linting, testing, and coverage with streamlined make targets and shared actions.
    • Improved environment variable handling for conditional coverage uploads.

Walkthrough

Update 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

Cohort / File(s) Change Summary
CI Workflow
.github/workflows/ci.yml
Replace explicit Rust setup, cargo cache, and tarpaulin steps with shared setup and coverage actions; switch formatting and linting commands to Makefile targets; add coverage artifact upload step; refine coverage upload conditions.

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)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

In the CI clouds, the scripts now fly,
Shared Actions handle Rust, oh my!
No more manual toil or cache,
Coverage reports in a flash.
Workflows simplified, so neat—
Let’s celebrate this tidy feat!
🚀

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/update-ci-workflow-for-new-actions

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @leynos - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7da91e2 and 9377a29.

📒 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: debug is 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.

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jul 24, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 24, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9377a29 and 5a7124c.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml (1 hunks)
🔇 Additional comments (4)
.github/workflows/ci.yml (4)

12-12: Clarify why BUILD_PROFILE is hard-wired to debug.

Tarpaulin recompiles the crate with its own flags; forcing BUILD_PROFILE=debug may 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-fmt and make lint normally require the rustfmt and clippy components. Verify that leynos/shared-actions/.../setup-rust installs those components; otherwise these steps will fail. If not, call rustup component add rustfmt clippy right after the setup action.


28-32: Artifact upload looks solid.

Comment thread .github/workflows/ci.yml Outdated
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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a7124c and 11e9d63.

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

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jul 25, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 25, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 11e9d63 and cd6703c.

📒 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 pinning setup-rust to an exact commit; this guards against silent changes in later versions.


17-20: Remove redundant Rustfmt setup – setup-rust action already installs Rustfmt
The leynos/shared-actions/.github/actions/setup-rust@688ce00 step (ci.yml line 16) specifies components: rustfmt, clippy, llvm-tools-preview, so rustfmt is available for make check-fmt. No additional rustup component add rustfmt step needed.

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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd6703c and b5f8f25.

📒 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 shared setup-rust action 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 to make check-fmt and make lint removes 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 extra coverage-types or equivalent input if the action supports it.


43-43: Coverage upload correctly gated on previous step outcome
Condition steps.generate-coverage.outcome == 'success' prevents spurious failures when coverage generation breaks—good job.

Comment thread .github/workflows/ci.yml Outdated
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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b5f8f25 and 80603d5.

📒 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 clippy

Verified that setup-rust@98416700e0fe9b85f381b621b1703db6ccbd189c’s action.yml (line 39) declares
components: rustfmt, clippy, llvm-tools-preview.
make check-fmt and make lint will pass without explicit installs.

Comment thread .github/workflows/ci.yml Outdated
@leynos leynos force-pushed the codex/update-ci-workflow-for-new-actions branch from b6777b9 to d51a3db Compare July 29, 2025 08:54
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: 1

♻️ Duplicate comments (1)
.github/workflows/ci.yml (1)

21-25: Restore artefact upload to persist lcov.info
The previous review introduced an Archive lcov step with if: always(), if-no-files-found: ignore, and retention-days to keep the coverage report available for troubleshooting. That step is now missing, so any failure in upload-codescene-coverage discards 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

📥 Commits

Reviewing files that changed from the base of the PR and between 17ae2a2 and d51a3db.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml (1 hunks)
🔇 Additional comments (1)
.github/workflows/ci.yml (1)

17-20: Verify make check-fmt / make lint have required toolchain components
The shared setup-rust action must install rustfmt and clippy; otherwise these Make targets will fail at runtime. Check the action’s implementation or add explicit component installation here.

Comment thread .github/workflows/ci.yml
bash install-cs-coverage-tool.sh -y
rm install-cs-coverage-tool.sh
run: make lint
- id: generate-coverage
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.

🧹 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.

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: 1

♻️ Duplicate comments (2)
.github/workflows/ci.yml (2)

21-21: Drop unused id: generate-coverage.

No subsequent step references ${{ steps.generate-coverage.* }}. Remove the identifier to keep the workflow tidy.


22-25: Archive lcov.info even 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
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d51a3db and eb5fbb4.

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

Comment thread .github/workflows/ci.yml
Comment on lines +27 to +29
env:
CS_ACCESS_TOKEN: ${{ secrets.CS_ACCESS_TOKEN }}
if: ${{ env.CS_ACCESS_TOKEN != '' }}
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.

🧹 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.

Suggested change
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.

@leynos leynos merged commit 35b50b8 into main Jul 29, 2025
2 checks passed
@leynos leynos deleted the codex/update-ci-workflow-for-new-actions branch July 29, 2025 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant