Skip to content

Commit

Permalink
Merge pull request #3742 from anoma/tomas/wasm-cov
Browse files Browse the repository at this point in the history
include wasm tests in code cov
  • Loading branch information
mergify[bot] committed Sep 3, 2024
2 parents 5f20b23 + 71f3291 commit c7f6a80
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
8 changes: 7 additions & 1 deletion wasm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,18 @@ 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

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

0 comments on commit c7f6a80

Please sign in to comment.