bdk 0.30.2

A modern, lightweight, descriptor-based wallet library
Documentation
on:
  push:
    branches:
      - 'master'
      - 'release/*'
  pull_request:
    branches:
      - 'master'
      - 'release/*'

name: Code Coverage

jobs:
  Codecov:
    name: Code Coverage
    if: false # disabled
    runs-on: ubuntu-20.04
    env:
      RUSTFLAGS: "-Cinstrument-coverage"
      RUSTDOCFLAGS: "-Cinstrument-coverage"
      LLVM_PROFILE_FILE: "report-%p-%m.profraw"

    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Install lcov tools
        run: sudo apt-get install lcov -y
      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@nightly
        with:
          components: llvm-tools-preview
      - 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 -- --test-threads=1
      - 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@v4
        with:
          name: coverage-report
          path: coverage-report.html