build: update #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, synchronize] | |
push: | |
branches: | |
- main | |
- "renovate/**" | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.yml' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: ${{ github.ref_name != 'main' }} | |
jobs: | |
test: | |
name: Test | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# - os: windows-latest # See `test-windows` job below | |
- os: ubuntu-latest | |
- os: macos-14 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: taiki-e/checkout-action@v1 | |
- uses: Boshen/setup-rust@main | |
with: | |
# warm cache factory for all other CI jobs | |
# cache `target` directory to avoid download crates | |
save-cache: ${{ github.ref_name == 'main' }} | |
cache-key: warm | |
- run: cargo test --no-run | |
- run: cargo test | |
- run: git diff --exit-code # Must commit everything | |
typos: | |
name: Spell Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@v1 | |
- uses: crate-ci/[email protected] | |
with: | |
files: . | |
deny: | |
name: Cargo Deny | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@v1 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
src: | |
- 'Cargo.lock' | |
- uses: Boshen/setup-rust@main | |
if: steps.filter.outputs.src == 'true' | |
with: | |
restore-cache: false | |
tools: cargo-deny | |
- if: steps.filter.outpts.src == 'true' | |
run: cargo deny check | |
unused-deps: | |
name: Check Unused Dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@v1 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
src: | |
- '**/*.rs' | |
- '**/Cargo.toml' | |
- 'Cargo.lock' | |
- uses: Boshen/setup-rust@main | |
with: | |
restore-cache: false | |
if: steps.filter.outputs.src == 'true' | |
- uses: cargo-bins/[email protected] | |
if: steps.filter.outputs.src == 'true' | |
- run: cargo binstall --no-confirm cargo-shear@1 | |
if: steps.filter.outputs.src == 'true' | |
- run: cargo shear | |
if: steps.filter.outputs.src == 'true' | |
format: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@v1 | |
- uses: Boshen/setup-rust@main | |
with: | |
components: rustfmt | |
restore-cache: false | |
- run: cargo fmt --all -- --check | |
lint: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@v1 | |
- uses: Boshen/setup-rust@main | |
with: | |
cache-key: warm | |
components: clippy | |
- run: cargo clippy -- -D warnings | |
doc: | |
name: Doc | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@v1 | |
- uses: Boshen/setup-rust@main | |
with: | |
cache-key: warm | |
components: rust-docs | |
- run: RUSTDOCFLAGS='-D warnings' cargo doc --no-deps --document-private-items |