Skip to content

Commit 233445a

Browse files
committed
Use Rust toolchain version from .tool-versions for GitHub actions
1 parent 8f7ef34 commit 233445a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.github/workflows/format.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@ jobs:
2424
~/.cargo/git/db/
2525
target/
2626
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
27+
28+
- name: Retrieve Rust version
29+
id: rust-version
30+
run: echo "rust-version=$(grep '^rust ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
31+
shell: bash
2732

2833
- name: Set up rust toolchain
2934
uses: actions-rust-lang/setup-rust-toolchain@v1
3035
with:
3136
components: "clippy, rustfmt"
32-
toolchain: 1.83
37+
toolchain: ${{ steps.rust-version.outputs.rust-version }}
3338

3439
- name: Add wasm32-wasi target
3540
run: rustup target add wasm32-wasip1

.github/workflows/test.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,15 @@ jobs:
2424
target/
2525
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
2626

27+
- name: Retrieve Rust version
28+
id: rust-version
29+
run: echo "rust-version=$(grep '^rust ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
30+
shell: bash
31+
2732
- name: Set up Rust tool chain
2833
uses: actions-rust-lang/setup-rust-toolchain@v1
2934
with:
30-
toolchain: 1.83
35+
toolchain: ${{ steps.rust-version.outputs.rust-version }}
3136

3237
- name: Add wasm32-wasi target
3338
run: rustup target add wasm32-wasip1

0 commit comments

Comments
 (0)