name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Unit Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
./target
key: test-cargo-registry
- name: List
run: find ./
- name: Run tests
run: cargo test --verbose
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Add rustfmt
run: rustup component add rustfmt
- name: Run rustfmt
run: cargo fmt --all --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
./target
key: test-cargo-registry
- name: List
run: find ./
- name: Add clippy
run: rustup component add clippy
- name: Run clippy
run: cargo clippy -- -D warnings