From a97f177445c3ae45d958bea4abb66b79b7a0065f Mon Sep 17 00:00:00 2001 From: spacebear Date: Mon, 11 Nov 2024 17:47:48 -0500 Subject: [PATCH] Add code coverage to CI Following rust-bitcoin's example, run code coverage in CI with cargo llvm-cov and upload the results to Coveralls. --- .github/workflows/rust.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d3a3832e..63c87a0b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -51,3 +51,21 @@ jobs: run: rustup component add clippy --toolchain nightly-x86_64-unknown-linux-gnu - name: "Run linting" run: bash contrib/lint.sh + + Coverage: + name: Code coverage + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: "Checkout repo" + uses: actions/checkout@v4 + - name: "Install 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 --all-features --workspace --lcov --output-path lcov.info + - name: "Upload report to coveralls" + uses: coverallsapp/github-action@v2