Repository navigation
github actions: Use Cargo.toml and rust-toolchain.toml - #243
Conversation
Signed-off-by: mulhern <amulhern@redhat.com>
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
ab7d313 to
0a2af9d
Compare
0a2af9d to
ce8611e
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughThe PR consolidates the Rust toolchain configuration by centralizing the version to ChangesRust toolchain and CI configuration update
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
.github/workflows/cargo.yml.github/workflows/main.yml.github/workflows/nightly.ymlrust-toolchain.toml
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| with: | ||
| components: ${{ matrix.components }} |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
head -70 .github/workflows/main.yml | tail -25Repository: stratis-storage/libblkid-rs
Length of output: 879
🏁 Script executed:
sed -n '40,70p' .github/workflows/main.ymlRepository: 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.
| - name: Run test on CURRENT DEVELOPMENT RUST TOOLCHAIN | ||
| run: make ${{ matrix.task }} | ||
| - name: Install toml-cli |
There was a problem hiding this comment.
🧩 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.ymlRepository: stratis-storage/libblkid-rs
Length of output: 102
🏁 Script executed:
# Read the entire main.yml file with line numbers
cat -n .github/workflows/main.ymlRepository: 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.
| PATH=${PATH}:/github/home/.local/bin MSRV=$(toml get --toml-path Cargo.toml "package.rust-version") | ||
| echo "MSRV=$MSRV" >> "$GITHUB_OUTPUT" |
There was a problem hiding this comment.
🧩 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.
28d7983 to
6fc7c2a
Compare
Use the values specified in these files to set toolchain versions in CI. Signed-off-by: mulhern <amulhern@redhat.com>
6fc7c2a to
d2a098b
Compare
Related stratis-storage/project#819