name: Rust
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
components: clippy,rustfmt
- name: Check Formatting
run: cargo fmt --all -- --check
- name: Check Clippy Lints
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run Tests
run: cargo test --all --all-features --no-fail-fast
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
components: llvm-tools-preview
- name: Install cargo-llvm-cov
run: curl -LsSf https://github.com/taiki-e/cargo-llvm-cov/releases/latest/download/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: true