Skip to content

github actions: use actions-rust-lang/setup-rust-toolchain#1282

Merged
mulkieran merged 1 commit into
stratis-storage:masterfrom
mulkieran:issue_project_819
May 18, 2026
Merged

github actions: use actions-rust-lang/setup-rust-toolchain#1282
mulkieran merged 1 commit into
stratis-storage:masterfrom
mulkieran:issue_project_819

Conversation

@mulkieran
Copy link
Copy Markdown
Member

@mulkieran mulkieran commented May 15, 2026

Signed-off-by: mulhern <amulhern@redhat.com>
@mulkieran mulkieran self-assigned this May 15, 2026
@mulkieran mulkieran moved this to Todo in 2026May May 15, 2026
@mulkieran mulkieran moved this from Todo to In Progress in 2026May May 15, 2026
@mulkieran
Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

Walkthrough

This PR updates .github/workflows/main.yml to modernize Rust toolchain setup across three CI jobs. The workflow replaces hardcoded toolchain configurations with a unified action and dynamic MSRV-based selection read directly from the workspace configuration.

Changes

Rust toolchain CI modernization

Layer / File(s) Summary
Check-typos toolchain action update
.github/workflows/main.yml
check-typos replaces dtolnay/rust-toolchain@master with actions-rust-lang/setup-rust-toolchain@v1 configured to install the cargo component.
Test-runs dynamic MSRV setup
.github/workflows/main.yml
test-runs removes the fixed toolchain: 1.85.0 setup, installs toml-cli, dynamically reads workspace.package.rust-version from stratisd/Cargo.toml, and sets up actions-rust-lang/setup-rust-toolchain@v1 with that computed MSRV.
Coverage-runs dynamic MSRV setup
.github/workflows/main.yml
coverage-runs adopts the same dynamic MSRV pattern: reads workspace.package.rust-version from stratisd/Cargo.toml, outputs it, and configures actions-rust-lang/setup-rust-toolchain@v1 to use that toolchain.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • stratis-storage/stratis-cli#1235: Both PRs modify .github/workflows/main.yml's Rust toolchain setup for CI (toolchain/action/version configuration), with the main PR expanding it to a dynamic MSRV and the retrieved PR updating the Rust version used.
  • stratis-storage/stratis-cli#1256: Both PRs modify the GitHub Actions Rust toolchain setup in .github/workflows/main.yml, specifically the configured "lowest supported" Rust toolchain version/installation method.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change—updating GitHub Actions workflows to use the actions-rust-lang/setup-rust-toolchain action instead of hardcoded dtolnay/rust-toolchain.
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.

✏️ 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

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/main.yml:
- Around line 149-150: The workflow extracts MSRV with toml CLI but omits the
--raw flag, so MSRV becomes a quoted JSON string (e.g., "\"1.xx\"") which can
break setup-rust-toolchain; update the invocations that call toml get (the lines
that set MSRV using toml get --toml-path Cargo.toml
"workspace.package.rust-version") to add the --raw flag (toml get --raw ...) so
the value is emitted unquoted, and apply the same change to the other toml get
occurrences noted (the blocks that set MSRV and other Rust version variables
used by setup-rust-toolchain).
🪄 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: CHILL

Plan: Pro

Run ID: 80e8100d-1b93-48ec-a3b5-0d18305730d3

📥 Commits

Reviewing files that changed from the base of the PR and between dc1711a and cf4156b.

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

Comment on lines +149 to +150
MSRV=$(toml get --toml-path Cargo.toml "workspace.package.rust-version")
echo "MSRV=$MSRV" >> "$GITHUB_OUTPUT"
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot May 16, 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

🧩 Analysis chain

🌐 Web query:

For toml-cli, does toml get --toml-path Cargo.toml "workspace.package.rust-version"return quoted strings by default, and is--raw the correct way to emit an unquoted value for CI outputs?

💡 Result:

Yes, for the toml-cli tool (by gnprice), the toml get command emits data as JSON by default [1]. When the target data is a string, this default JSON output includes quotes [1]. Using the --raw (or -r) flag is the correct way to emit the value as a raw string without quotes, which is specifically designed for use in shell scripts and CI/CD pipelines [1]. Example usage: toml get --toml-path Cargo.toml "workspace.package.rust-version" --raw [1]

Citations:


Use --raw flag with toml get to extract unquoted MSRV values.

By default, toml-cli emits JSON-formatted output, which wraps string values in quotes. Without the --raw flag, MSRV will contain "1.xx" instead of 1.xx. Passing quoted strings to setup-rust-toolchain risks breaking toolchain resolution and failing CI jobs.

✅ Proposed fix
       - name: Get package MSRV
         id: msrv
         run: |
-          MSRV=$(toml get --toml-path Cargo.toml "workspace.package.rust-version")
+          MSRV=$(toml get --raw --toml-path Cargo.toml "workspace.package.rust-version")
+          test -n "$MSRV"
           echo "MSRV=$MSRV" >> "$GITHUB_OUTPUT"
         working-directory: stratisd

Also applies to: lines 152-155, 219-220, 222-225

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/main.yml around lines 149 - 150, The workflow extracts
MSRV with toml CLI but omits the --raw flag, so MSRV becomes a quoted JSON
string (e.g., "\"1.xx\"") which can break setup-rust-toolchain; update the
invocations that call toml get (the lines that set MSRV using toml get
--toml-path Cargo.toml "workspace.package.rust-version") to add the --raw flag
(toml get --raw ...) so the value is emitted unquoted, and apply the same change
to the other toml get occurrences noted (the blocks that set MSRV and other Rust
version variables used by setup-rust-toolchain).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

toml-cli get has no --raw flag and its output without that non-existent --raw flag is plain text.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@mulkieran, you are correct — I apologize for the confusion. My review comment was based on the gnprice/toml-cli Rust crate, which outputs JSON by default and requires --raw/-r to print strings directly. However, the workflow uses --toml-path syntax, which identifies it as the Python toml-cli from PyPI — a completely different tool that outputs plain text by default and does not have a --raw flag. The review comment was incorrect and the existing code is fine. Sorry for the noise!


✏️ Learnings added
Learnt from: mulkieran
Repo: stratis-storage/stratis-cli PR: 1282
File: .github/workflows/main.yml:149-150
Timestamp: 2026-05-18T15:18:25.754Z
Learning: In stratis-cli's GitHub Actions workflows (.github/workflows/main.yml), the `toml-cli` package installed via `dnf install -y toml-cli` is the Python toml-cli from PyPI (not gnprice's Rust toml-cli). It uses `--toml-path` flag syntax (e.g., `toml get --toml-path Cargo.toml "workspace.package.rust-version"`) and outputs plain text (unquoted strings) by default. It does NOT have a `--raw` flag and does NOT require one to get unquoted output.

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.

@mulkieran mulkieran marked this pull request as ready for review May 18, 2026 15:20
@mulkieran mulkieran merged commit 4fd4992 into stratis-storage:master May 18, 2026
9 checks passed
@mulkieran mulkieran deleted the issue_project_819 branch May 18, 2026 18:54
@github-project-automation github-project-automation Bot moved this from In Progress to Done in 2026May May 18, 2026
@mulkieran mulkieran moved this from Done to Done(3) in 2026May May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done(3)

Development

Successfully merging this pull request may close these issues.

1 participant