Merge rust-bitcoin/rust-bitcoin#2361: Add github action for llvm-cov coverage

47b476ec5b Ignore fuzz dir from coverage reports (pool2win)
50ff68550c Add github action for llvm-cov coverage (pool2win)

Pull request description:

  There has been discussion around generating coverage reports for tests. See #1853  and #2353.

  This PR adds an action using llvm-cov and coveralls.

  The action generates lcov coverage report using llvm-cov and uploads the generated report to coveralls. You can see sample reports for my fork here: https://coveralls.io/github/pool2win/rust-bitcoin

  I am using the [cargo-llvm-cov](https://github.com/taiki-e/cargo-llvm-cov) wrapper around llvm-cov.

  I also use the coveralls official github action to push the coverage report to coveralls. It removes the need to deal with repository secrets etc, making the action easy to run for all contributors on their forks.

  We can move this action later to rust.yml if we need to.

ACKs for top commit:
  apoelstra:
    ACK 47b476ec5b
  Kixunil:
    ACK 47b476ec5b
  tcharding:
    ACK 47b476ec5b

Tree-SHA512: 7a7b8caf94d4b4828416bc1e6df49bfe47fede7b8fa4386d905a6f40439a95df1d3fedecdd6d64675f2f6858851f18d2f8863994aa20ac1ab224f97ca48b4af2
This commit is contained in:
Andrew Poelstra 2024-01-19 22:53:39 +00:00
commit 782c2d17bd
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 24 additions and 0 deletions

24
.github/workflows/coveralls.yml vendored Normal file
View File

@ -0,0 +1,24 @@
on:
- push
- pull_request
name: Code coverage with llvm-cov
jobs:
Coveralls:
name: Code coverage - stable toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Checkout Toolchain
# https://github.com/dtolnay/rust-toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage for tests
run: cargo llvm-cov --ignore-filename-regex fuzz --all-features --workspace --lcov --output-path lcov.info
- name: Upload report to coveralls
uses: coverallsapp/github-action@v2