Skip to content

Commit 9cb3c98

Browse files
committed
Codify linting toolchain in a toolchain file
Moves the nightly toolchain we use for linting out of a GitHub action and into a dedicated `toolchains/lint/rust-toolchain.toml` file. rustup doesn't currently support specifying a toolchain file, though [it will soon](rust-lang/rustup#2686), so we hack around it by moving the toolchain file back and forth as part of the GitHub action for Rust.
1 parent 85f8e54 commit 9cb3c98

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.github/workflows/rust.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ permissions:
3131
contents: read
3232

3333
jobs:
34-
3534
test:
3635
runs-on: ubuntu-latest-16-cores
3736
timeout-minutes: 45
@@ -103,11 +102,10 @@ jobs:
103102
run: >
104103
find linera-* -name '*.rs' -a -not -wholename '*/target/*' -print0
105104
| xargs -0 -L1 ./scripts/target/release/check_copyright_header
105+
- name: Put lint toolchain file in place
106+
run: |
107+
ln -sf toolchains/lint/rust-toolchain.toml
106108
- uses: Twey/setup-rust-toolchain@v1
107-
with:
108-
toolchain: nightly-2023-10-22
109-
target: wasm32-unknown-unknown
110-
components: clippy rustfmt
111109
- name: Install cargo-machete
112110
run: |
113111
cargo install cargo-machete --locked
@@ -126,7 +124,7 @@ jobs:
126124
cargo install cargo-sort --locked
127125
- name: Check formatting
128126
run: |
129-
cargo +nightly-2023-10-22 fmt -- --check
127+
cargo fmt -- --check
130128
- name: Check for unused dependencies
131129
run: |
132130
cargo machete
@@ -161,3 +159,6 @@ jobs:
161159
run: |
162160
cd examples
163161
cargo sort -c -w
162+
163+
post:
164+
ln -sf toolchains/build/rust-toolchain.toml

toolchains/build/rust-toolchain.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[toolchain]
2+
channel = "1.73.0"
3+
components = [ "clippy", "rustfmt", "rust-src" ]
4+
targets = [ "wasm32-unknown-unknown" ]
5+
profile = "minimal"

toolchains/lint/rust-toolchain.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[toolchain]
2+
channel = "nightly-2023-10-23"
3+
components = [ "clippy", "rustfmt" ]
4+
profile = "minimal"

0 commit comments

Comments
 (0)