Skip to content

Commit d354e1d

Browse files
committed
ci: set Rust toolchain version dynamically in coverage workflow
Update the coverage-improvement GitHub Actions workflow to read the Rust toolchain version from rust-toolchain.toml and use it for the Rust setup step. This ensures the workflow uses the exact Rust version specified in the project configuration, improving consistency and reducing maintenance overhead. Signed-off-by: Peng Tao <bergwolf@hyper.sh>
1 parent ae8cc1b commit d354e1d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/workflows/coverage-improvement.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,18 @@ jobs:
4545
with:
4646
fetch-depth: 0
4747

48+
- name: Read Rust toolchain version
49+
id: set_toolchain_version
50+
run: |
51+
RUST_TOOLCHAIN_VERSION=$(grep -oP '(?<=channel = ")[^"]*' rust-toolchain.toml)
52+
echo "Rust toolchain version: $RUST_TOOLCHAIN_VERSION"
53+
echo "rust-version=$RUST_TOOLCHAIN_VERSION" >> $GITHUB_OUTPUT
54+
55+
shell: bash
4856
- name: Setup Rust
4957
uses: actions-rust-lang/setup-rust-toolchain@v1
5058
with:
51-
toolchain: stable
59+
toolchain: ${{ steps.set_toolchain_version.outputs.rust-version }}
5260
components: llvm-tools-preview
5361

5462
- name: Install cargo-llvm-cov

0 commit comments

Comments
 (0)