Skip to content

Commit 422c397

Browse files
authored
Merge pull request #1612 from duthils/gh-actions-rust-version
github actions: set rust version globally
2 parents 301e350 + ae2ac42 commit 422c397

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

.github/workflows/cli.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,18 @@ jobs:
8585
VAULT_TOKEN: "root"
8686
VAULT_ADDR: "http://127.0.0.1:8200"
8787
steps:
88-
- name: Install rustup
89-
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain 1.70.0
90-
9188
- name: Check out code
9289
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
9390

91+
# Rustup will detect toolchain version and profile from rust-toolchain.toml
92+
# It will download and install the toolchain and components automatically
93+
# and make them available for subsequent commands
94+
- name: Install Rust toolchain
95+
run: rustup show
96+
97+
- name: Show Rust version
98+
run: cargo --version
99+
94100
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
95101
with:
96102
name: sops-linux-amd64-${{ github.sha }}

.github/workflows/linters.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ on:
77
pull_request:
88
branches:
99
- main
10-
# Only run when linted files change
10+
# Only run when Rust version or linted files change
1111
paths:
12+
- 'rust-toolchain.toml'
1213
- 'functional-tests/**/*.rs'
1314

1415
permissions:
@@ -22,8 +23,14 @@ jobs:
2223
- name: Check out code
2324
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2425

25-
- name: Install rustup
26-
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain 1.70.0
26+
# Rustup will detect toolchain version and profile from rust-toolchain.toml
27+
# It will download and install the toolchain and components automatically
28+
# and make them available for subsequent commands
29+
- name: Install Rust toolchain and additional components
30+
run: rustup component add rustfmt
31+
32+
- name: Show Rust version
33+
run: cargo --version
2734

2835
- name: Run Formatting Check
2936
run: cargo fmt --check

rust-toolchain.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[toolchain]
2+
channel = "1.70.0"
3+
profile = "minimal"

0 commit comments

Comments
 (0)