From 1c4d47825b0ebc6027f04b8672ccabe83cbd8cee Mon Sep 17 00:00:00 2001 From: Daniela Brozzoni Date: Fri, 9 Sep 2022 15:27:31 +0200 Subject: [PATCH 1/3] Run code coverage on every PR In this way we can check how much of a PR is covered by the tests, making the review process slightly easier. --- .github/workflows/code_coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index 5e650459da..9f5cfd0f36 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -1,4 +1,4 @@ -on: [push] +on: [push, pull_request] name: Code Coverage From 9d758a489efb8428d504740ab9e0247702f2b95c Mon Sep 17 00:00:00 2001 From: Daniela Brozzoni Date: Fri, 9 Sep 2022 22:42:26 +0200 Subject: [PATCH 2/3] Run the code coverage with different features --- .github/workflows/code_coverage.yml | 34 ++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index 9f5cfd0f36..e3e3a0f093 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -10,7 +10,24 @@ jobs: RUSTFLAGS: "-Cinstrument-coverage" RUSTDOCFLAGS: "-Cinstrument-coverage" LLVM_PROFILE_FILE: "report-%p-%m.profraw" - + strategy: + matrix: + features: + - default + - minimal + - all-keys + - minimal,use-esplora-ureq + - key-value-db + - electrum + - compact_filters + - esplora,ureq,key-value-db,electrum + - compiler + - rpc + - verify + - async-interface + - use-esplora-reqwest + - sqlite + - sqlite-bundled steps: - name: Checkout uses: actions/checkout@v2 @@ -37,19 +54,30 @@ jobs: key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install grcov run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi - - name: Test + - name: Test ${{ matrix.features }} 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: Coveralls upload + - name: Coveralls Parallel upload uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} + flag-name: run-${{ matrix.features }} + parallel: true - name: Upload artifact uses: actions/upload-artifact@v2 with: name: coverage-report path: coverage-report.html + finish: + needs: Codecov + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true From 13a416380de0ab1f00411f01ac7aee1fe8328ea9 Mon Sep 17 00:00:00 2001 From: Daniela Brozzoni Date: Fri, 9 Sep 2022 22:59:02 +0200 Subject: [PATCH 3/3] WIP try all features? --- .github/workflows/code_coverage.yml | 31 ++++++++++++----------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index e3e3a0f093..4cb979ee64 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -12,22 +12,17 @@ jobs: LLVM_PROFILE_FILE: "report-%p-%m.profraw" strategy: matrix: - features: - - default - - minimal - - all-keys - - minimal,use-esplora-ureq - - key-value-db - - electrum - - compact_filters - - esplora,ureq,key-value-db,electrum - - compiler - - rpc - - verify - - async-interface - - use-esplora-reqwest - - sqlite - - sqlite-bundled + blockchain: + - name: electrum + features: test-electrum,verify + - name: rpc + features: test-rpc + - name: rpc-legacy + features: test-rpc-legacy + - name: esplora + features: test-esplora,use-esplora-reqwest,verify + - name: esplora + features: test-esplora,use-esplora-ureq,verify steps: - name: Checkout uses: actions/checkout@v2 @@ -54,8 +49,8 @@ jobs: key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install grcov run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi - - name: Test ${{ matrix.features }} - run: cargo test --features default,minimal,all-keys,compact_filters,key-value-db,compiler,sqlite,sqlite-bundled,test-electrum,verify,test-rpc + - name: Test ${{ matrix.blockchain.name }} + run: cargo test --features compiler,verify,sqlite,sqlite-bundled,compact_filters,key-value-db,all-keys,keys-bip39,rpc,${{ matrix.blockchain.features }} - 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