From 9dc36b052e7346eb92391aae70ca8ab73b546f26 Mon Sep 17 00:00:00 2001 From: baerwang Date: Tue, 26 Dec 2023 19:42:46 +0800 Subject: [PATCH] chore: use actions cargo of fmt and clippy --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ .github/workflows/rust.yml | 19 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b67cd83 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: ci +on: + pull_request: + push: + branches: [ main ] + +jobs: + format: + name: cargo fmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly + components: rustfmt + + - name: Run fmt + run: cargo +nightly fmt --all -- --check --unstable-features + + cargo-clippy: + name: cargo clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + components: clippy + + - uses: Swatinem/rust-cache@v2 + + - run: cargo clippy --all-targets --all-features --workspace -- -D warnings \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..0505c0f --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,19 @@ +name: Rust + +on: + push: + branches: [ main ] + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - run: cargo build --verbose + + - run: cargo test --verbose \ No newline at end of file