]> Untitled Git - bdk/commitdiff
Change configs for source-base code coverage
authorwszdexdrf <piyushkumar2k02@kgpian.iitkgp.ac.in>
Sun, 7 Aug 2022 13:48:35 +0000 (19:18 +0530)
committerwszdexdrf <piyushkumar2k02@kgpian.iitkgp.ac.in>
Fri, 2 Sep 2022 05:50:04 +0000 (11:20 +0530)
Also add cacheing to code coverage workflow

.github/workflows/code_coverage.yml
codecov.yaml [deleted file]

index 09563dc829469268b74e1e5f85ae61b674cafb34..5e650459da6ecc66d82ccff81716c0cfc242f324 100644 (file)
@@ -3,35 +3,53 @@ on: [push]
 name: Code Coverage
 
 jobs:
-
   Codecov:
     name: Code Coverage
     runs-on: ubuntu-latest
     env:
-      CARGO_INCREMENTAL: '0'
-      RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off'
-      RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off'
+      RUSTFLAGS: "-Cinstrument-coverage"
+      RUSTDOCFLAGS: "-Cinstrument-coverage"
+      LLVM_PROFILE_FILE: "report-%p-%m.profraw"
 
     steps:
       - name: Checkout
         uses: actions/checkout@v2
+      - name: Install lcov tools
+        run: sudo apt-get install lcov -y
       - name: Install rustup
         run: curl https://sh.rustup.rs -sSf | sh -s -- -y
       - name: Set default toolchain
         run: rustup default nightly
       - name: Set profile
         run: rustup set profile minimal
+      - name: Add llvm tools
+        run: rustup component add llvm-tools-preview
       - name: Update toolchain
         run: rustup update
+      - name: Cache cargo
+        uses: actions/cache@v3
+        with:
+          path: |
+            ~/.cargo/bin/
+            ~/.cargo/registry/index/
+            ~/.cargo/registry/cache/
+            ~/.cargo/git/db/
+          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
+      - name: Install grcov
+        run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi
       - name: Test
-        run: cargo test --features all-keys,compiler,esplora,ureq,compact_filters --no-default-features
-                    
-      - id: coverage
-        name: Generate coverage
-        uses: actions-rs/grcov@v0.1.5
+        run: cargo test --features default,minimal,all-keys,compact_filters,key-value-db,compiler,sqlite,sqlite-bundled,test-electrum,verify,test-rpc
+      - name: Run grcov
+        run: mkdir coverage; grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore '/*' -o ./coverage/lcov.info
+      - name: Generate HTML coverage report
+        run: genhtml -o coverage-report.html ./coverage/lcov.info
 
-      - name: Upload coverage to Codecov
-        uses: codecov/codecov-action@v2
+      - name: Coveralls upload
+        uses: coverallsapp/github-action@master
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+      - name: Upload artifact
+        uses: actions/upload-artifact@v2
         with:
-          file: ${{ steps.coverage.outputs.report }}
-          directory: ./coverage/reports/
+          name: coverage-report
+          path: coverage-report.html
diff --git a/codecov.yaml b/codecov.yaml
deleted file mode 100644 (file)
index 062eabb..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-coverage:
-  status:
-    project:
-      default:
-        target: auto
-        threshold: 1%
-        base: auto
-        informational: false
-    patch:
-      default:
-        target: auto
-        threshold: 100%
-        base: auto
\ No newline at end of file