From ec97693cd4267a64adda934eebfd99cdf218ae10 Mon Sep 17 00:00:00 2001 From: Guillermo Perez Date: Sat, 16 Sep 2023 17:33:14 -0400 Subject: [PATCH] add code coverage to wasm build --- .github/workflows/build-wasm.yml | 8 +++++--- .github/workflows/sanity-checks.yml | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-wasm.yml b/.github/workflows/build-wasm.yml index 26e2b6e269..3cd4d4bc31 100644 --- a/.github/workflows/build-wasm.yml +++ b/.github/workflows/build-wasm.yml @@ -34,6 +34,7 @@ jobs: # SCCACHE_GHA_ENABLED: "true" # RUSTC_WRAPPER: "sccache" steps: + # PREP - name: Check out code uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #3.5.2 @@ -52,7 +53,7 @@ jobs: ./target/srtool cache-directories: ./runtime # save-if: ${{ github.ref == 'refs/heads/master' }} - + # BUILD - name: Setup build options id: buildopt run: | @@ -68,6 +69,7 @@ jobs: env: RUSTC_VERSION: ${{ matrix.rust_version }} BUILD_OPTS: ${{ env.BUILD_OPTS }} + TARPAULIN_VERSION: 0.19.1 # travis-ci codecov generator with: image: paritytech/srtool:${{ matrix.rust_version }} options: --user root -v /home/runner/.cargo:/cargo-home -v ${{ github.workspace }}:/build -e PACKAGE=${{ matrix.package }} @@ -80,10 +82,10 @@ jobs: du -sh /cargo-home/* echo "---- RUNNING BUILD ----" /srtool/build --save - + - id: set_runtime run: echo "RUNTIME=$(echo "${{ matrix.package }}" | sed -e "s/-runtime$//")" >> $GITHUB_ENV - - name: upload srtool report + - name: Upload srtool report uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 #v3.1.3 with: name: srtool-wasm-report.txt diff --git a/.github/workflows/sanity-checks.yml b/.github/workflows/sanity-checks.yml index d63e6c4bbc..f0295556a1 100644 --- a/.github/workflows/sanity-checks.yml +++ b/.github/workflows/sanity-checks.yml @@ -38,6 +38,27 @@ jobs: env: TARGET: ${{ matrix.target }} RUSTC_WRAPPER: "sccache" + + - name: generate codecov reports + run: | + if ${{ contains(matrix.target, 'test' ) }}; then + echo "---- GENERATE CODE COVERAGE ----" + echo "Generate code coverage for ${{ matrix.package }}" + cargo binstall cargo-tarpaulin + # make Cargo.toml + cargo +nightly tarpaulin --verbose --no-fail-fast --workspace --timeout 300 --out Xml + fi + + # UPLOAD REPORTS + - name: Upload codecov report + uses: codecov/codecov-action@v3 + with: + # token: ${{ secrets.CODECOV_TOKEN }} + # files: ./coverage1.xml,./coverage2.xml # optional + # flags: unittests # optional + # name: codecov-umbrella # optional + # fail_ci_if_error: true # optional (default = false) + verbose: true # optional (default = false) benchmark-check: name: bench-check-${{ matrix.runtime }}