name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt --all -- --check
- name: Build
run: cargo build --workspace
- name: Run tests
run: cargo test --workspace
- name: Run doc
run: cargo doc
- name: Run clippy
run: cargo clippy --workspace --examples --tests -- -D warnings
- name: Run v3 example
run: cargo build --example derive_clap3 --no-default-features --features clap-3