name: ci
on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize, reopened]
branches:
- '*'
env:
CARGO_TERM_COLOR: always
RUST_VERSION: "1.85.0"
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
components: rustfmt
- run: cargo fmt --all -- --check
check:
needs: fmt
name: Check
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
- run: cargo check --all-features
unit_test:
needs: check
name: Unit Test
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
components: rustfmt
- name: Build
run: cargo install --path .
- name: Run Tests
run: cargo test --verbose
clippy:
needs: check
name: Clippy
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-D warnings -A clippy::todo"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy
- run: cargo clippy --all-features