Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding wasm coverage #1233

Draft
wants to merge 41 commits into
base: master
Choose a base branch
from
Draft

Conversation

jrmncos
Copy link
Contributor

@jrmncos jrmncos commented Aug 3, 2024

@jrmncos jrmncos changed the title feat: adding wasm coveage feat: adding wasm coverage Aug 3, 2024
@bbarwik
Copy link

bbarwik commented Aug 13, 2024

Hey, I have two tips:

  1. Here's an example how to add correctly wasmcov to examples: bbarwik@64448a6. Then to run examples with coverage in CI set env WASMCOV_DIR, run ./build.sh and then cargo wasmcov test --near=1.40.0. An example:
      - name: Create wasmcov directory
        run: mkdir -p ${{ github.workspace }}/wasmcov

      - name: Set WASMCOV_DIR environment variable
        run: echo "WASMCOV_DIR=${{ github.workspace }}/wasmcov" >> $GITHUB_ENV
  1. Cache ${{ github.workspace }}/wasmcov/near_sandbox so it doesn't need to rebuild neard and it runs faster:
      - name: Set up cache for near_sandbox directory
        uses: actions/cache@v3
        with:
          path: ${{ github.workspace }}/wasmcov/near_sandbox
          key: ${{ runner.os }}-near-sandbox-${{ github.sha }}
          restore-keys: |
            ${{ runner.os }}-near-sandbox-

@codecov-commenter
Copy link

codecov-commenter commented Aug 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (master@4551e43). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1233   +/-   ##
=========================================
  Coverage          ?   79.61%           
=========================================
  Files             ?      102           
  Lines             ?    14606           
  Branches          ?        0           
=========================================
  Hits              ?    11629           
  Misses            ?     2977           
  Partials          ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jrmncos
Copy link
Contributor Author

jrmncos commented Aug 19, 2024

hey @frol @bbarwik I'm block and I will need help to continue with this issue.
My approach was the following:

  • I did the same as this commit for each directory in examples.
  • with the file build_wasm_test_all.sh build and test all directories
  • with the file merge_profdata.sh merge the .profraw files into one .profdata file and then convert it manually to a .lcov file with the command llvm-cov export
  • send all the .lcov files to codecov

The build and test is working locally for each directory, except from fungible-token, in some cases works and in others no. Here is an example of an error
---- test_storage_deposit_not_enough_deposit stdout ---- thread 'test_storage_deposit_not_enough_deposit' panicked at tests/workspaces.rs:110:5: assertion failed: contract_balance_diff < NearToken::from_yoctonear(100_000_000_000_000_000_000) note: run with RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
test_storage_deposit_not_enough_deposit`

I modified tests like this to run it locally but is still flaky.

In another hand, CI is taking so many time to run, and also it's failing with this error when is running tests
`Error: unable to broadcast the transaction to the network

Caused by:
error while parsing method call result: [missing field priority_fee]`

You can take a look here to the entire workflow. I have my doubts about how the command --near works internally when is running in a pipeline and not locally.

Any help will be welcome! thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: NEW❗
Development

Successfully merging this pull request may close these issues.

3 participants