From 97aab86e8eb93dde4f06bdb7083f9f2e77b88b8e Mon Sep 17 00:00:00 2001 From: Valentin Tolmer Date: Wed, 23 Jun 2021 10:57:43 +0200 Subject: [PATCH] Add clippy and fmt to the workflow --- .github/workflows/rust.yml | 102 ++++++++++++++++++++++++++++++++++--- 1 file changed, 94 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7ae98f3..37168a6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -4,19 +4,105 @@ on: push: branches: [ main ] pull_request: - branches: [ main ] + types: [opened, repoened, synchronize] env: CARGO_TERM_COLOR: always jobs: - build: - + test_server: + name: cargo test server runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - name: Checkout sources + uses: actions/checkout@v2 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose + + test_client: + name: cargo test client + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Build + run: cargo build --verbose + working-directory: ./app + - name: Run tests + run: cargo test --verbose + working-directory: ./app + + clippy: + name: cargo clippy + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install nightly toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: rustfmt, clippy + + - name: Run cargo clippy on server + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --tests -- -D warnings + + - name: Run cargo clippy on client + working-directory: ./app + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --tests -- -D warnings + + - name: Run cargo clippy on model + working-directory: ./model + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --tests -- -D warnings + + + format: + name: cargo fmt + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install nightly toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: rustfmt, clippy + + - name: Run cargo fmt on server + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: Run cargo fmt on client + working-directory: ./app + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: Run cargo fmt on model + working-directory: ./model + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check