From 74e218291a9fb485e0abc85ddf0c50da4f225db8 Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Wed, 3 Jan 2024 17:22:55 +0800 Subject: [PATCH] feat: add Rust check ci --- .github/workflows/CI.yml | 29 +++++++++++++++++++++++++++++ rust-toolchain.toml | 5 +++++ 2 files changed, 34 insertions(+) create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c748e0b..fed7917 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,9 +17,38 @@ env: - docs/** pull_request: null jobs: + rust_check: + name: Rust check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly-2023-06-27 + target: x86_64-unknown-linux-gnu + + - name: Run Cargo Check + run: cargo check --workspace --all-targets --locked # Not using --release because it uses too much cache, and is also slow. + + - name: Run Clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --workspace --all-targets -- -D warnings + + - name: Run rustfmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + cargo-test: name: Test cargo runs-on: ubuntu-latest + needs: + - rust_check steps: - uses: actions/checkout@v3 - name: Install Rust diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..4b190c1 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +profile = "default" +# Use nightly for better access to the latest Rust features. +# This date is aligned to stable release dates. +channel = "nightly-2023-06-27"