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