name: Coverage
on:
pull_request:
branches:
- "**" push:
branches:
- "master"
workflow_dispatch:
jobs:
coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Rust Cache
uses: Swatinem/rust-cache@v1.3.0
- name: Install Rust
run: ./scripts/init.sh
- name: Install Rustup component
run: rustup component add llvm-tools-preview
- name: Install grcov
run: cargo install grcov
- name: Run Tests
run: cargo test --verbose --lib
env:
RUSTFLAGS: "-Zinstrument-coverage"
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
- name: Generate Coverage data
run: grcov . -s . --binary-path ./target/debug/ --ignore-not-existing -t lcov -o lcov.info
- name: Upload to codecov.io
run: bash <(curl -s https://codecov.io/bash) -f lcov.info