From 2a42f2517036325588c7681b5efc90b3c725a119 Mon Sep 17 00:00:00 2001 From: Shubham Shinde Date: Tue, 10 Mar 2026 03:43:37 +0530 Subject: [PATCH] ci(coverage): use `codecov` instead of `coveralls` - update the `code_coverage.yml` CI job to use codecov instead of coveralls, copied from `bdk_wallet` repository. --- .github/workflows/code_coverage.yml | 49 ++++++++++++++++++----------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index 7c0ca51b..3aabc697 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -1,13 +1,20 @@ -on: [push, pull_request] - name: Code Coverage -permissions: {} +# Generates code coverage reports using cargo-llvm-cov and uploads results to Codecov. +# Runs on every push and pull request to track test coverage metrics. +# Uploads coverage data to Codecov for tracking and produces an HTML report artifact for download. + +on: [push, pull_request] + +permissions: + contents: read + pull-requests: write jobs: - Codecov: + Coverage: name: Code Coverage runs-on: ubuntu-latest + steps: - name: Checkout uses: actions/checkout@v6 @@ -18,24 +25,30 @@ jobs: - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: nightly-2025-11-27 - override: true - cache: true - components: llvm-tools-preview + toolchain: nightly-2025-11-27 + components: llvm-tools-preview + # override: true + cache: true - name: Install cargo-llvm-cov - run: if [[ ! -e ~/.cargo/bin/cargo-llvm-cov ]]; then cargo install cargo-llvm-cov; fi - - name: Make coverage directory - run: mkdir coverage - - name: Test and report coverage - run: cargo llvm-cov -q --doctests --branch --all --ignore-filename-regex "(example*|crates/testenv/*)" --all-features --lcov --output-path ./coverage/lcov.info + run: cargo install cargo-llvm-cov + - name: Generate coverage data + run: cargo llvm-cov --all --all-features --branch --quiet --doctests --ignore-filename-regex "(example*|crates/testenv/*)" --lcov --output-path lcov.info + env: + RUSTFLAGS: "--cfg coverage_nightly" - name: Generate HTML coverage report - run: genhtml -o coverage-report.html --ignore-errors unmapped ./coverage/lcov.info - - name: Coveralls upload - uses: coverallsapp/github-action@master + run: cargo llvm-cov --all --all-features --branch --quiet --doctests --ignore-filename-regex "(example*|crates/testenv/*)" --html + env: + RUSTFLAGS: "--cfg coverage_nightly" + - name: Codecov upload + uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 with: - github-token: ${{ secrets.GITHUB_TOKEN }} + files: ./lcov.info + flags: rust + name: codecov-bdk + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false - name: Upload artifact uses: actions/upload-artifact@v7 with: name: coverage-report - path: coverage-report.html + path: target/llvm-cov/html -- 2.49.0