Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch GitHub actions to actions-rust-lang/setup-toolchain #1182

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
- uses: Twey/setup-rust-toolchain@v1
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
Expand All @@ -59,9 +57,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
- uses: Twey/setup-rust-toolchain@v1
- name: Checkout docs.rs tool repository
run: |
cd ${{ runner.temp }}
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/dynamodb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ jobs:
runs-on: ubuntu-latest-16-cores
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- uses: Twey/setup-rust-toolchain@v1
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/explorer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- uses: Twey/setup-rust-toolchain@v1
- name: Build
run: |
cd linera-explorer
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions-rs/toolchain@v1
with:
profile: minimal
- uses: Swatinem/rust-cache@v2
- uses: Twey/setup-rust-toolchain@v1
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
Expand Down
23 changes: 6 additions & 17 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: wasm32-unknown-unknown
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- uses: Twey/setup-rust-toolchain@v1
- name: Clear up some space
run: |
sudo rm -rf /usr/share/dotnet
Expand Down Expand Up @@ -102,17 +97,11 @@ jobs:
run: >
find linera-* -name '*.rs' -a -not -wholename '*/target/*' -print0
| xargs -0 -L1 ./scripts/target/release/check_copyright_header
- uses: actions-rs/toolchain@v1
- uses: Twey/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-10-22
target: wasm32-unknown-unknown
components: clippy
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rustfmt
- uses: Swatinem/rust-cache@v2
components: clippy rustfmt
- name: Install cargo-machete
run: |
cargo install cargo-machete --locked
Expand All @@ -131,7 +120,7 @@ jobs:
cargo install cargo-sort --locked
- name: Check formatting
run: |
cargo +nightly fmt -- --check
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this one to fully normalize the imports with imports_granularity = Crate.
rust-lang/rustfmt#4991

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'll submit a patch to the action — currently if you have a toolchain file there's no way to use a different toolchain than the one specified there.

cargo +nightly-2023-10-22 fmt -- --check
- name: Check for unused dependencies
run: |
cargo machete
Expand All @@ -143,7 +132,7 @@ jobs:
- name: Run Wasm application lints
run: |
cd examples
cargo +nightly fmt -- --check
cargo fmt -- --check
cargo clippy --all-targets --all-features --target wasm32-unknown-unknown --locked
cargo clippy --all-targets --all-features --target x86_64-unknown-linux-gnu --locked
- name: Run clippy
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/scylladb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ jobs:
runs-on: ubuntu-latest-16-cores
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- uses: Twey/setup-rust-toolchain@v1
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
Expand Down
9 changes: 2 additions & 7 deletions linera-service/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Project {
debug!("writing Cargo.toml");
Self::create_cargo_toml(&root, name, linera_root)?;

debug!("writing rust-toolchain");
debug!("writing rust-toolchain.toml");
Self::create_rust_toolchain(&root)?;

debug!("writing state.rs");
Expand Down Expand Up @@ -167,15 +167,10 @@ impl Project {
}

fn create_rust_toolchain(project_root: &Path) -> Result<()> {
Self::write_string_to_file(
&project_root.join("rust-toolchain"),
include_str!("../template/rust-toolchain.template"),
)?;
Self::write_string_to_file(
&project_root.join("rust-toolchain.toml"),
include_str!("../template/rust-toolchain.toml.template"),
)?;
Ok(())
)
}

fn create_state_file(source_directory: &Path) -> Result<()> {
Expand Down
1 change: 0 additions & 1 deletion linera-service/template/rust-toolchain.template

This file was deleted.

1 change: 0 additions & 1 deletion rust-toolchain

This file was deleted.

3 changes: 2 additions & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[toolchain]
channel = "1.72.0"
components = [ "rustfmt", "rustc-dev", "rust-src" ]
components = [ "clippy", "rustfmt", "rust-src" ]
targets = [ "wasm32-unknown-unknown" ]
profile = "minimal"