Skip to content

Adding grcov and Codecov support #2

Adding grcov and Codecov support

Adding grcov and Codecov support #2

Workflow file for this run

name: Test
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: llvm-tools-preview
- name: Activate cache
uses: Swatinem/rust-cache@v2
- name: Install grcov
uses: taiki-e/install-action@v2
with:
tool: grcov
- name: Build crate
run: cargo build --verbose --all-targets
env:
RUSTFLAGS: "-Cinstrument-coverage"
- name: Test crate
run: cargo test --verbose
env:
LLVM_PROFILE_FILE: "target/coverage/prof/%p-%m.profraw"
RUSTFLAGS: "-Cinstrument-coverage"
- name: Create coverage report
run: |
grcov \
--source-dir . \
--binary-path target/debug \
--branch \
--excl-start 'mod tests \{' \
--ignore 'tests/*' \
-t lcov \
-o lcov.info \
target/coverage/prof
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: false
# vim:set et sts=2: