diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e1e7250..2e912e0 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,35 +2,66 @@ name: Rust on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] env: CARGO_TERM_COLOR: always jobs: - build: + quality: + name: Code quality + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v7 + - name: Cache Cargo build artifacts + uses: actions/cache@v6 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}- + ${{ runner.os }}-cargo- + + - name: Formatting check + run: cargo fmt --check + + - name: Clippy + run: cargo clippy --no-deps --all-targets --all-features + - name: Documentation + run: cargo doc --no-deps --all-features + + test: + name: Tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Cache Cargo build artifacts - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}- - ${{ runner.os }}-cargo- - - name: Check - run: cargo check - - name: Clippy - run: cargo clippy - - name: Test - run: cargo test + - uses: actions/checkout@v7 + - name: Cache Cargo build artifacts + uses: actions/cache@v6 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}- + ${{ runner.os }}-cargo- + + - name: Install cargo-nextest + uses: taiki-e/install-action@nextest + + - name: Test + run: cargo nextest run --all-features + + - name: Documentation tests + run: cargo test --doc --all-features