From ae2ac422faf3ab656f1eedd4af167fe452a45e4e Mon Sep 17 00:00:00 2001 From: Sebastien Duthil Date: Wed, 11 Sep 2024 21:10:55 -0400 Subject: [PATCH] github actions: set rust version globally Signed-off-by: Sebastien Duthil --- .github/workflows/cli.yml | 12 +++++++++--- .github/workflows/linters.yml | 13 ++++++++++--- rust-toolchain.toml | 3 +++ 3 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index f058bdb91..0e99243ac 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -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 }} diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 4635bd6c9..fa57e8e1b 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -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: @@ -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 diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 000000000..928904257 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.70.0" +profile = "minimal"