name: CI
on:
push:
branches: [master]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: rustfmt (nightly)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: rustfmt (check)
run: cargo +nightly fmt --all -- --check
lint-test:
name: clippy & tests (stable)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: clippy (deny warnings)
run: cargo clippy --all-targets -- -D warnings
- name: tests
run: cargo test --workspace --all-targets --no-fail-fast
coverage:
name: coverage (stable)
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: rustup update stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --workspace --ignore-filename-regex "src/commands|src/main.rs" --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: false