]> Untitled Git - bdk/commitdiff
ci(coverage): use `codecov` instead of `coveralls`
authorShubham Shinde <shindeshubham0520@gmail.com>
Mon, 9 Mar 2026 22:13:37 +0000 (03:43 +0530)
committerLeonardo Lima <oleonardolima@users.noreply.github.com>
Tue, 5 May 2026 19:10:24 +0000 (16:10 -0300)
- update the `code_coverage.yml` CI job to use codecov instead of
  coveralls, copied from `bdk_wallet` repository.

.github/workflows/code_coverage.yml

index 7c0ca51bf1bfd85684d9733fe37badcf11a24571..3aabc697ac2afc0c59aeec6f60524d0b9f900b8b 100644 (file)
@@ -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