Skip to content

github actions: Use Cargo.toml and rust-toolchain.toml - #243

Merged
mulkieran merged 2 commits into
stratis-storage:masterfrom
mulkieran:issue_project_819
May 18, 2026
Merged

mulkieran merged 2 commits into
stratis-storage:masterfrom
mulkieran:issue_project_819

Conversation

@mulkieran

@mulkieran mulkieran commented May 16, 2026 •

Copy link
Copy Markdown
Member

Signed-off-by: mulhern <amulhern@redhat.com>
@mulkieran mulkieran self-assigned this May 16, 2026
@packit-as-a-service

Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo dnf install -y 'dnf*-command(copr)'
  • dnf copr enable packit/stratis-storage-libblkid-rs-243
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@mulkieran
mulkieran force-pushed the issue_project_819 branch from ab7d313 to 0a2af9d Compare May 16, 2026 01:23
@mulkieran mulkieran moved this to In Progress in 2026May May 16, 2026
@mulkieran
mulkieran force-pushed the issue_project_819 branch from 0a2af9d to ce8611e Compare May 16, 2026 01:26
@mulkieran mulkieran added this to the libblkid-rs-0.4.3 milestone May 16, 2026
@mulkieran mulkieran changed the title Issue project 819 github actions: Use Cargo.toml and rust-toolchain.toml May 18, 2026
@mulkieran

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
✅ 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

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

Walkthrough

The PR consolidates the Rust toolchain configuration by centralizing the version to 1.95.0 in rust-toolchain.toml and migrating all GitHub Actions workflows to use actions-rust-lang/setup-rust-toolchain@v1. Ubuntu and macOS CI jobs switch from matrix-based version selection to a two-pass approach that tests on the current toolchain and then the MSRV via runtime override.

Changes

Rust toolchain and CI configuration update

Layer / File(s) Summary
Centralize toolchain version and migrate CI action globally
rust-toolchain.toml, .github/workflows/cargo.yml, .github/workflows/main.yml, .github/workflows/nightly.yml
Rust channel is set to 1.95.0 in rust-toolchain.toml. All workflows replace dtolnay/rust-toolchain@master with actions-rust-lang/setup-rust-toolchain@v1; the checks job matrix in main.yml is simplified to use task names without explicit Rust versions, and the semver-checks job in nightly.yml removes its explicit toolchain pin.
Update ubuntu and macos MSRV testing to runtime override pattern
.github/workflows/main.yml
The ubuntu-checks and macos-checks jobs run tests/builds on the current toolchain first, then extract the MSRV from Cargo.toml, apply it via rustup override set, and rerun the build/test on the MSRV, replacing the previous matrix-based version enumeration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

🚥 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 directly references the main changes: updating GitHub Actions workflows to use Cargo.toml and rust-toolchain.toml for Rust toolchain configuration instead of hardcoded versions.
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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 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 58-60: The workflow references an undefined matrix property `${{
matrix.components }}` in the actions-rust-lang/setup-rust-toolchain@v1 step,
causing an empty/invalid components value; fix by either adding a `components`
field to the `ubuntu-checks` matrix entries or replace `${{ matrix.components
}}` with a concrete component list (e.g., "rustfmt" or "clippy") in the setup
step so the `actions-rust-lang/setup-rust-toolchain@v1` call receives a valid
components value; update the matrix or the step consistently and ensure the
symbol `matrix.components` is defined wherever used.
- Around line 68-69: The MSRV extraction uses an inline PATH assignment and a
hardcoded user bin path which is brittle; update both occurrences to first
export PATH separately, and compute the user bin directory dynamically by
running python3 -m site --user-base and appending /bin (e.g.,
USER_BASE=$(python3 -m site --user-base); export PATH="$USER_BASE/bin:$PATH"),
then set MSRV via MSRV=$(toml get --toml-path Cargo.toml "package.rust-version")
and echo it to GITHUB_OUTPUT — replace the inline `PATH=... MSRV=$(toml ...)`
pattern and the hardcoded `/Users/runner/Library/Python/3.14/bin` usage
accordingly so both places use the exported PATH and the dynamically derived
user bin path.
- Around line 61-63: The ubuntu-checks job runs make (${ { matrix.task } })
without installing the system dependency libblkid-dev; update the ubuntu-checks
job to install libblkid-dev before the build step (mirror the installation step
used in the checks job) so that the build/test tasks that require libblkid-dev
succeed; locate the ubuntu-checks job and add the apt-get install (or
equivalent) of libblkid-dev prior to the "Run test on CURRENT DEVELOPMENT RUST
TOOLCHAIN" step.
🪄 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: 15dbb9f9-0338-42d1-8516-e7ba28e3a1c5

📥 Commits

Reviewing files that changed from the base of the PR and between dd0bfe1 and ce8611e.

📒 Files selected for processing (4)
  • .github/workflows/cargo.yml
  • .github/workflows/main.yml
  • .github/workflows/nightly.yml
  • rust-toolchain.toml

Comment thread .github/workflows/main.yml Outdated
Comment on lines +58 to +60
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: ${{ matrix.components }}

Copy link
Copy Markdown

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

🏁 Script executed:

head -70 .github/workflows/main.yml | tail -25

Repository: stratis-storage/libblkid-rs

Length of output: 879


🏁 Script executed:

sed -n '40,70p' .github/workflows/main.yml

Repository: stratis-storage/libblkid-rs

Length of output: 1182


Undefined matrix property in toolchain setup

The ubuntu-checks matrix defines only task but line 60 references the undefined ${{ matrix.components }}. This will cause the toolchain setup to receive an empty value, potentially breaking the job config. Either specify a concrete component or add components to the matrix.

Suggested fix
       - uses: actions-rust-lang/setup-rust-toolchain@v1
         with:
-          components: ${{ matrix.components }}
+          components: cargo
🧰 Tools
🪛 actionlint (1.7.12)

[error] 60-60: property "components" is not defined in object type {task: string}

(expression)

🤖 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 58 - 60, The workflow references an
undefined matrix property `${{ matrix.components }}` in the
actions-rust-lang/setup-rust-toolchain@v1 step, causing an empty/invalid
components value; fix by either adding a `components` field to the
`ubuntu-checks` matrix entries or replace `${{ matrix.components }}` with a
concrete component list (e.g., "rustfmt" or "clippy") in the setup step so the
`actions-rust-lang/setup-rust-toolchain@v1` call receives a valid components
value; update the matrix or the step consistently and ensure the symbol
`matrix.components` is defined wherever used.

Comment on lines +61 to +63
- name: Run test on CURRENT DEVELOPMENT RUST TOOLCHAIN
run: make ${{ matrix.task }}
- name: Install toml-cli

Copy link
Copy Markdown

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

🏁 Script executed:

# Find and read the main.yml workflow file
git ls-files | grep -E "workflows|main\.yml"

Repository: stratis-storage/libblkid-rs

Length of output: 184


🏁 Script executed:

# Read the main.yml workflow file
wc -l .github/workflows/main.yml

Repository: stratis-storage/libblkid-rs

Length of output: 102


🏁 Script executed:

# Read the entire main.yml file with line numbers
cat -n .github/workflows/main.yml

Repository: stratis-storage/libblkid-rs

Length of output: 4482


Ubuntu build/test runs without required system dependency setup

The ubuntu-checks job runs make at line 62 without first installing libblkid-dev, unlike the checks job (lines 39-42) and macos-checks job (lines 90-91) which both install the dependency before building. This can cause build/link failures for build and test tasks.

Suggested fix
       - uses: actions-rust-lang/setup-rust-toolchain@v1
         with:
           components: ${{ matrix.components }}
+      - name: Install dependencies
+        run: |
+          sudo apt-get -q update
+          sudo apt-get -y install libblkid-dev
       - name: Run test on CURRENT DEVELOPMENT RUST TOOLCHAIN
         run: make ${{ matrix.task }}
🤖 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 61 - 63, The ubuntu-checks job runs
make (${ { matrix.task } }) without installing the system dependency
libblkid-dev; update the ubuntu-checks job to install libblkid-dev before the
build step (mirror the installation step used in the checks job) so that the
build/test tasks that require libblkid-dev succeed; locate the ubuntu-checks job
and add the apt-get install (or equivalent) of libblkid-dev prior to the "Run
test on CURRENT DEVELOPMENT RUST TOOLCHAIN" step.

Comment thread .github/workflows/main.yml Outdated
Comment on lines +68 to +69
PATH=${PATH}:/github/home/.local/bin MSRV=$(toml get --toml-path Cargo.toml "package.rust-version")
echo "MSRV=$MSRV" >> "$GITHUB_OUTPUT"

Copy link
Copy Markdown

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

🏁 Script executed:

find . -name "main.yml" -path "*/.github/workflows/*"

Repository: stratis-storage/libblkid-rs

Length of output: 100


🏁 Script executed:

cat -n .github/workflows/main.yml | sed -n '60,110p'

Repository: stratis-storage/libblkid-rs

Length of output: 2317


MSRV extraction path handling is brittle

Lines 68 and 99 use PATH=... MSRV=$(toml ...) as an inline pattern, which is fragile. Line 99 additionally hardcodes a Python version-specific path (/Users/runner/Library/Python/3.14/bin). When GitHub Actions updates Python or users run on different systems, these paths will break. Export PATH on a separate line and derive the user bin path dynamically using python3 -m site --user-base.

Suggested fix
       - name: Get package MSRV
         id: msrv
         run: |
-          PATH=${PATH}:/github/home/.local/bin MSRV=$(toml get --toml-path Cargo.toml "package.rust-version")
+          PATH="$PATH:$(python3 -m site --user-base)/bin"
+          MSRV=$(toml get --toml-path Cargo.toml "package.rust-version")
           echo "MSRV=$MSRV" >> "$GITHUB_OUTPUT"
       - name: Get package MSRV
         id: msrv
         run: |
-          PATH=${PATH}:/Users/runner/Library/Python/3.14/bin MSRV=$(toml get --toml-path Cargo.toml "package.rust-version")
+          PATH="$PATH:$(python3 -m site --user-base)/bin"
+          MSRV=$(toml get --toml-path Cargo.toml "package.rust-version")
           echo "MSRV=$MSRV" >> "$GITHUB_OUTPUT"

Also applies to: 99-100

🤖 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 68 - 69, The MSRV extraction uses an
inline PATH assignment and a hardcoded user bin path which is brittle; update
both occurrences to first export PATH separately, and compute the user bin
directory dynamically by running python3 -m site --user-base and appending /bin
(e.g., USER_BASE=$(python3 -m site --user-base); export
PATH="$USER_BASE/bin:$PATH"), then set MSRV via MSRV=$(toml get --toml-path
Cargo.toml "package.rust-version") and echo it to GITHUB_OUTPUT — replace the
inline `PATH=... MSRV=$(toml ...)` pattern and the hardcoded
`/Users/runner/Library/Python/3.14/bin` usage accordingly so both places use the
exported PATH and the dynamically derived user bin path.

@mulkieran
mulkieran force-pushed the issue_project_819 branch 2 times, most recently from 28d7983 to 6fc7c2a Compare May 18, 2026 16:18
Use the values specified in these files to set toolchain versions in CI.

Signed-off-by: mulhern <amulhern@redhat.com>
@mulkieran
mulkieran force-pushed the issue_project_819 branch from 6fc7c2a to d2a098b Compare May 18, 2026 16:25
@mulkieran mulkieran moved this from In Progress to In Review in 2026May May 18, 2026
@mulkieran
mulkieran merged commit d3b58f1 into stratis-storage:master May 18, 2026
17 checks passed
@mulkieran
mulkieran deleted the issue_project_819 branch May 18, 2026 16:40
@github-project-automation github-project-automation Bot moved this from In Review 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

No open projects
Status: Done(3)

Development

Successfully merging this pull request may close these issues.

1 participant