github actions: Use Cargo.toml and rust-toolchain.toml#85
Conversation
|
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. |
Signed-off-by: mulhern <amulhern@redhat.com>
aab8557 to
67f4426
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughThis PR updates Rust toolchain setup across CI/nightly workflows by introducing a centralized ChangesRust Toolchain Standardization Across CI/Nightly Workflows
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/nightly.yml (1)
53-55:⚠️ Potential issue | 🟠 MajorSet
rust-toolchaininput explicitly or tomanual.The
cargo-semver-checks-action@v2does not respectrust-toolchain.tomlwhen therust-toolchaininput is not provided. Instead, it installs and uses the latest stable Rust toolchain by default. Either specify the desired toolchain explicitly via therust-toolchaininput, or set it tomanualif a Rust setup step precedes this action.🤖 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/nightly.yml around lines 53 - 55, The workflow uses obi1kenobi/cargo-semver-checks-action@v2 without specifying the rust-toolchain input; update the action invocation to add a rust-toolchain input (either an explicit toolchain like "1.70.0" or "stable" or set rust-toolchain: manual if you run a prior Rust setup step) so the action uses the intended toolchain instead of installing latest stable by default.
🤖 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/ci.yml:
- Around line 86-88: In the actions-rust-lang/setup-rust-toolchain@v1 step, add
the rust-src-dir input set to loopdev-3 under the with: block so the action
looks for rust-toolchain.toml in the checked-out subdirectory and enables
correct caching; specifically update the setup-rust-toolchain step (uses:
actions-rust-lang/setup-rust-toolchain@v1) to include rust-src-dir: loopdev-3
alongside components: cargo with proper YAML indentation.
---
Outside diff comments:
In @.github/workflows/nightly.yml:
- Around line 53-55: The workflow uses obi1kenobi/cargo-semver-checks-action@v2
without specifying the rust-toolchain input; update the action invocation to add
a rust-toolchain input (either an explicit toolchain like "1.70.0" or "stable"
or set rust-toolchain: manual if you run a prior Rust setup step) so the action
uses the intended toolchain instead of installing latest stable by default.
🪄 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: 6b36b7c3-ca03-43fc-9dde-ae25cf521632
📒 Files selected for processing (3)
.github/workflows/ci.yml.github/workflows/nightly.ymlrust-toolchain.toml
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| with: | ||
| components: cargo |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if actions-rust-lang/setup-rust-toolchain@v1 documents container support and rust-toolchain.toml detection
# Search for documentation about container usage and rust-toolchain.toml behavior
gh api repos/actions-rust-lang/setup-rust-toolchain/readme --jq '.content' | base64 -d | grep -i -A5 -B5 "container\|rust-toolchain"Repository: stratis-storage/loopdev-3
Length of output: 1737
🏁 Script executed:
# Find rust-toolchain.toml location in the repo
find . -name "rust-toolchain.toml" -o -name "rust-toolchain"Repository: stratis-storage/loopdev-3
Length of output: 91
🏁 Script executed:
# Check the full context around the job to understand working-directory usage
sed -n '67,100p' .github/workflows/ci.ymlRepository: stratis-storage/loopdev-3
Length of output: 1569
🌐 Web query:
actions-rust-lang/setup-rust-toolchain working directory container Fedora support
💡 Result:
The actions-rust-lang/setup-rust-toolchain GitHub Action is designed primarily for GitHub-hosted runners but is compatible with self-hosted runners and containerized environments, provided the necessary dependencies (such as curl, tar, and a shell) are available in the container [1][2]. Regarding your specific requirements: 1. Working Directory Support: The action supports projects where the Rust source code and rust-toolchain.toml file are located in a subdirectory rather than the repository root [3]. You can use the rust-src-dir input to specify the path to the directory containing your Rust source code [1][2]. This input also sets a default value for cache-workspaces, enabling proper caching for that directory [2][3]. 2. Container and Fedora Support: The action does not have specific restrictions against Fedora or other Linux distributions, provided the environment meets the basic requirements for running GitHub Actions and rustup [1][2]. When running jobs in a container (e.g., a Fedora-based Docker image), ensure that the container has the required system dependencies installed to support the action's execution [4]. If you encounter issues with environment variables (like PATH) not persisting, you may need to ensure that the container's shell configuration (e.g.,.bashrc) correctly sources the cargo environment or that the action's environment modifications are respected by your container's entrypoint [5]. In summary, you can use the action in a Fedora container by specifying the rust-src-dir if your project is in a subdirectory, and ensuring the container image includes the standard utilities required by GitHub Actions [1][2][3].
Citations:
- 1: https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/README.md
- 2: https://github.com/actions-rust-lang/setup-rust-toolchain
- 3: https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/CHANGELOG.md
- 4: https://users.rust-lang.org/t/need-help-with-github-workflow-setup/122009
- 5: https://stackoverflow.com/questions/49676490/when-installing-rust-toolchain-in-docker-bash-source-command-doesnt-work
Add rust-src-dir input to setup-rust-toolchain action.
The action looks for rust-toolchain.toml in the repository root, but the code is checked out to the loopdev-3 subdirectory (line 72). Without specifying rust-src-dir: loopdev-3, the action won't locate the toolchain file. This input also ensures proper caching for the subdirectory project.
Suggested fix
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: cargo
rust-src-dir: loopdev-3🤖 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/ci.yml around lines 86 - 88, In the
actions-rust-lang/setup-rust-toolchain@v1 step, add the rust-src-dir input set
to loopdev-3 under the with: block so the action looks for rust-toolchain.toml
in the checked-out subdirectory and enables correct caching; specifically update
the setup-rust-toolchain step (uses: actions-rust-lang/setup-rust-toolchain@v1)
to include rust-src-dir: loopdev-3 alongside components: cargo with proper YAML
indentation.
Use the values specified in these files to set toolchain versions in CI. Do not do modifications to cross-compilation job. It is not clear what changes will make it work; it is outside the scope of this change. Signed-off-by: mulhern <amulhern@redhat.com>
67f4426 to
bd1b12f
Compare
Related stratis-storage/project#819