name: master
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Enable caching
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Format
run: cargo fmt --check
- name: Lint
run: cargo clippy --all --features internal-testing
- name: Lint (all features)
run: cargo clippy --all --all-features
- name: Build
run: cargo build --all --verbose
- name: Run tests
run: cargo test --all --features internal-testing --verbose
- name: Run tests (all features)
run: cargo test --all --all-features --verbose
- name: Run doc-tests
run: cargo test --doc --all --features internal-testing --verbose
- name: Check that the benchmarks can still compile
run: cargo bench --no-run --features internal-testing
- name: Generate the documentation
run: cargo doc --all --verbose
- name: Generate the documentation (all features)
run: cargo doc --all --all-features --verbose
- name: Check that the crate is publishable
run: cargo publish --allow-dirty --dry-run
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install llvm-tools-preview
run: rustup component add llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Enable caching
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Generate code coverage
run: cargo llvm-cov --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: false