grcov #293
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use grcov to analyze code coverage | |
name: grcov | |
on: | |
push: | |
paths: | |
- "**.rs" | |
- "**.yaml" | |
- "**.yml" | |
- "**.toml" | |
branches: | |
- main | |
schedule: | |
- cron: '0 0 * * 0' # Sunday | |
jobs: | |
coverage: | |
name: Coverage | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: -Cinstrument-coverage | |
LLVM_PROFILE_FILE: "sentinel-core-%p-%m.profraw" | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
default: true | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-ci-${{ env.cache-name }}- | |
${{ runner.os }}-cargo-ci- | |
- name: install grcov | |
run: cargo install grcov --force | |
- name: install llvm tools | |
run: rustup component add llvm-tools-preview | |
- name: test project | |
run: cargo test --workspace --exclude sentinel-envoy-module --exclude ebpf-probes --exclude ebpf-userspace | |
- name: test project | |
run: cargo test --workspace --exclude sentinel-envoy-module --exclude ebpf-probes --exclude ebpf-userspace -- --ignored --test-threads=1 | |
- name: generate lcov.info file | |
run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info | |
- name: commit codecov | |
run: bash <(curl -s https://codecov.io/bash) -f lcov.info |