From ad2eec3fdebdbf60ca28e7825699bd55071a2338 Mon Sep 17 00:00:00 2001 From: James Kay Date: Thu, 16 Nov 2023 16:34:51 +0000 Subject: [PATCH] Codify linting toolchain in a toolchain file Moves the nightly toolchain we use for linting out of a GitHub action and into a dedicated `rust-toolchain.lint.toml` file. rustup doesn't currently support specifying a toolchain file, though [it will soon](https://github.com/rust-lang/rustup/issues/2686), so we hack around it by moving the toolchain file back and forth as part of the GitHub action for Rust. --- .github/workflows/rust.yml | 8 ++++---- rust-toolchain.toml | 6 +----- toolchains/build/rust-toolchain.toml | 5 +++++ toolchains/lint/rust-toolchain.toml | 4 ++++ 4 files changed, 14 insertions(+), 9 deletions(-) mode change 100644 => 120000 rust-toolchain.toml create mode 100644 toolchains/build/rust-toolchain.toml create mode 100644 toolchains/lint/rust-toolchain.toml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5481ec7a7bc..ddb0eb1dd81 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -102,11 +102,11 @@ jobs: run: > find linera-* -name '*.rs' -a -not -wholename '*/target/*' -print0 | xargs -0 -L1 ./scripts/target/release/check_copyright_header + - name: Put lint toolchain file in place + run: | + ln -sf rust-toolchain.lint.toml rust-toolchain.toml - uses: Twey/setup-rust-toolchain@v1 - with: - toolchain: nightly-2023-10-22 - target: wasm32-unknown-unknown - components: clippy rustfmt + working-directory: toolchains/lint - name: Install cargo-machete run: | cargo install cargo-machete --locked diff --git a/rust-toolchain.toml b/rust-toolchain.toml deleted file mode 100644 index bbd74155ccf..00000000000 --- a/rust-toolchain.toml +++ /dev/null @@ -1,5 +0,0 @@ -[toolchain] -channel = "1.73.0" -components = [ "clippy", "rustfmt", "rust-src" ] -targets = [ "wasm32-unknown-unknown" ] -profile = "minimal" diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 120000 index 00000000000..00f75390645 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1 @@ +toolchains/build/rust-toolchain.toml \ No newline at end of file diff --git a/toolchains/build/rust-toolchain.toml b/toolchains/build/rust-toolchain.toml new file mode 100644 index 00000000000..bbd74155ccf --- /dev/null +++ b/toolchains/build/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +channel = "1.73.0" +components = [ "clippy", "rustfmt", "rust-src" ] +targets = [ "wasm32-unknown-unknown" ] +profile = "minimal" diff --git a/toolchains/lint/rust-toolchain.toml b/toolchains/lint/rust-toolchain.toml new file mode 100644 index 00000000000..014ff528dcc --- /dev/null +++ b/toolchains/lint/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "nightly-2023-10-23" +components = [ "clippy", "rustfmt" ] +profile = "minimal"