Skip to content

Commit

Permalink
chore: add code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
huitseeker committed Mar 31, 2022
1 parent 0b58459 commit 794c9cd
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Codecov
on:
push:
branches:
- main
pull_request:
branches:
- main
types: [opened, reopened, synchronize]

jobs:
codecov-grcov:
name: Generate code coverage
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: install toolchain according to rust-toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: default
override: true
components: llvm-tools-preview
- name: Checkout sources
uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v1
- name: Install grcov, and cache the binary
uses: baptiste0928/cargo-install@v1
with:
crate: grcov
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
env:
RUSTFLAGS: '-Cinstrument-coverage'
RUSTDOCFLAGS: '-Cinstrument-coverage'
- name: Run tests
env:
RUSTFLAGS: '-Cinstrument-coverage'
RUSTDOCFLAGS: '-Cinstrument-coverage'
LLVM_PROFILE_FILE: 'codecov-instrumentation-%p-%m.profraw'
run: |
cargo test
- name: Run grcov
run: grcov . --binary-path target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov
- name: Upload to codecov.io
uses: codecov/codecov-action@v1

0 comments on commit 794c9cd

Please sign in to comment.