Skip to content

Commit

Permalink
Codify linting toolchain in a toolchain file
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Twey committed Nov 21, 2023
1 parent 85f8e54 commit 87e98fa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ permissions:
contents: read

jobs:

test:
runs-on: ubuntu-latest-16-cores
timeout-minutes: 45
Expand Down Expand Up @@ -103,11 +102,10 @@ 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 toolchains/lint/rust-toolchain.toml
- uses: Twey/setup-rust-toolchain@v1
with:
toolchain: nightly-2023-10-22
target: wasm32-unknown-unknown
components: clippy rustfmt
- name: Install cargo-machete
run: |
cargo install cargo-machete --locked
Expand All @@ -126,7 +124,7 @@ jobs:
cargo install cargo-sort --locked
- name: Check formatting
run: |
cargo +nightly-2023-10-22 fmt -- --check
cargo fmt -- --check
- name: Check for unused dependencies
run: |
cargo machete
Expand Down Expand Up @@ -161,3 +159,7 @@ jobs:
run: |
cd examples
cargo sort -c -w
- name: Restore `rust-toolchain.toml` file
if: '!cancelled()'
run: |
ln -sf toolchains/build/rust-toolchain.toml
5 changes: 5 additions & 0 deletions toolchains/build/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[toolchain]
channel = "1.73.0"
components = [ "clippy", "rustfmt", "rust-src" ]
targets = [ "wasm32-unknown-unknown" ]
profile = "minimal"
5 changes: 5 additions & 0 deletions toolchains/lint/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[toolchain]
channel = "nightly-2023-10-23"
components = [ "clippy", "rustfmt" ]
targets = [ "wasm32-unknown-unknown" ]
profile = "minimal"

0 comments on commit 87e98fa

Please sign in to comment.