diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml new file mode 100644 index 0000000..f2f71db --- /dev/null +++ b/.github/workflows/coverage.yaml @@ -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 }} +