name: test
on:
push:
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install Rust stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run unit tests
run: cargo test --features full
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install Rust stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install llvm-tools
run: rustup component add llvm-tools-preview
- name: Install grcov
run: cargo install grcov
- name: Build and test with coverage instrumentation
run: |
export CARGO_INCREMENTAL=0
export RUSTFLAGS="-C instrument-coverage"
export LLVM_PROFILE_FILE="cargo-test-%p-%m.profraw"
cargo build --features full --verbose $CARGO_OPTIONS
cargo test --features full --verbose $CARGO_OPTIONS
mkdir coverage
grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o coverage/lcov.info
- name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash) -f coverage/lcov.info
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}