on: [push, pull_request] name: Code Coverage jobs: Codecov: name: Code Coverage runs-on: ubuntu-latest env: 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 # WARNING: this is not testing the following features: test-esplora, test-hardware-signer, async-interface # This is because some of our features are mutually exclusive, and generating various reports and # merging them doesn't seem to be working very well. # For more info, see: # - https://github.com/bitcoindevkit/bdk/issues/696 # - https://github.com/bitcoindevkit/bdk/pull/748#issuecomment-1242721040 run: cargo test --features all-keys,compact_filters,compiler,key-value-db,sqlite,sqlite-bundled,test-electrum,test-rpc,verify - 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: Coveralls upload uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} - name: Upload artifact uses: actions/upload-artifact@v2 with: name: coverage-report path: coverage-report.html