Skip to content

Commit

Permalink
add coverage GH actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nicbus committed Feb 22, 2024
1 parent d63382c commit 362e76c
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Coverage

on:
push:
branches:
- master
- coverage
pull_request:
branches:
- master

jobs:
codecov:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: llvm-tools-preview

- name: Run tests
env:
RUSTFLAGS: "-Cinstrument-coverage"
RUSTDOCFLAGS: "-Cinstrument-coverage"
run: cargo test

- name: Install grcov
run: cargo install grcov

- name: Generate coverage report
run: >
grcov . -s . --binary-path target/debug/ -t lcov --branch
--ignore-not-existing -o coverage.lcov
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
file: coverage.lcov
flags: rust
token: ${{ secrets.CODECOV_TOKEN }}

0 comments on commit 362e76c

Please sign in to comment.