diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 580a529cfd..561672a46c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -236,9 +236,15 @@ jobs: name: wasm-for-tests-${{ github.event.pull_request.head.sha|| github.sha }} path: wasm_for_tests - name: Test Wasm - run: cargo +${{ env.NIGHTLY }} nextest run --manifest-path wasm/Cargo.toml + # run: cargo +${{ env.NIGHTLY }} nextest run --manifest-path wasm/Cargo.toml + run: make test-wasm-with-coverage env: RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=/usr/local/bin/mold" + - name: Store coverage file artifact + uses: actions/upload-artifact@v4 + with: + name: wasm-cov-${{ github.event.pull_request.head.sha || github.sha }} + path: wasm/lcov.info # output of `make test-wasm-with-coverage` - name: Clean cargo cache if: steps.cache.outputs.cache-hit != 'true' run: cargo cache --autoclean-expensive @@ -630,9 +636,14 @@ jobs: with: name: integration-cov-${{ github.event.pull_request.head.sha || github.sha }} path: integration-cov + - name: Download wasm coverage artifacts + uses: actions/download-artifact@v4 + with: + name: wasm-cov-${{ github.event.pull_request.head.sha || github.sha }} + path: wasm-cov - name: Upload coverage to codecov uses: codecov/codecov-action@v4 with: - files: integration-cov/lcov.info, unit-cov/lcov.info + files: integration-cov/lcov.info, unit-cov/lcov.info, wasm-cov/lcov.info fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} diff --git a/Makefile b/Makefile index 3105c234f1..5b069e7e4f 100644 --- a/Makefile +++ b/Makefile @@ -212,6 +212,9 @@ test-integration-with-coverage: --test-threads=1 \ -Z unstable-options --report-time +test-wasm-with-coverage: + make -C $(wasms) test-with-coverage + test-unit-mainnet: $(cargo) +$(nightly) test --lib \ --features "mainnet" \ diff --git a/wasm/Makefile b/wasm/Makefile index d4c5b0a52f..cdc55fb6ef 100644 --- a/wasm/Makefile +++ b/wasm/Makefile @@ -28,7 +28,7 @@ fmt-check: $(cargo) +$(nightly) fmt --check test: - $(cargo) +$(nightly) test -- -Z unstable-options --report-time + $(cargo) +$(nightly) test --lib -- -Z unstable-options --report-time clean: $(cargo) clean @@ -36,4 +36,10 @@ clean: deps: $(rustup) target add wasm32-unknown-unknown +test-with-coverage: + $(cargo) +$(nightly) llvm-cov --lib --output-path lcov.info \ + --lcov \ + -- -Z unstable-options --report-time + + .PHONY: all debug check clippy clippy-fix fmt fmt-check test clean deps \ No newline at end of file