Skip to content

Commit

Permalink
Merge pull request #1612 from duthils/gh-actions-rust-version
Browse files Browse the repository at this point in the history
github actions: set rust version globally
  • Loading branch information
felixfontein authored Sep 13, 2024
2 parents 301e350 + ae2ac42 commit 422c397
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,18 @@ jobs:
VAULT_TOKEN: "root"
VAULT_ADDR: "http://127.0.0.1:8200"
steps:
- name: Install rustup
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain 1.70.0

- name: Check out code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

# Rustup will detect toolchain version and profile from rust-toolchain.toml
# It will download and install the toolchain and components automatically
# and make them available for subsequent commands
- name: Install Rust toolchain
run: rustup show

- name: Show Rust version
run: cargo --version

- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: sops-linux-amd64-${{ github.sha }}
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ on:
pull_request:
branches:
- main
# Only run when linted files change
# Only run when Rust version or linted files change
paths:
- 'rust-toolchain.toml'
- 'functional-tests/**/*.rs'

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

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

- name: Show Rust version
run: cargo --version

- name: Run Formatting Check
run: cargo fmt --check
Expand Down
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.70.0"
profile = "minimal"

0 comments on commit 422c397

Please sign in to comment.