Skip to content

Commit

Permalink
feat: code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ethicnology committed Nov 14, 2024
1 parent 3278146 commit 28e8e75
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: coverage

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
coverage:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
name: Coverage
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: llvm-tools-preview
- name: Test
run: cargo test --features coverage
env:
RUSTFLAGS: "-Cinstrument-coverage"
RUSTDOCFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "${{ github.workspace }}/default_%m_%p.profraw"
- name: Collect coverage
run: |
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.19/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar -xjf-
./grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --keep-only 'src/*' --ignore '**/tests.rs' -o coverage.lcov
- name: Submit coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./coverage.lcov
token: ${{ secrets.CODECOV_TOKEN }}

0 comments on commit 28e8e75

Please sign in to comment.