coverage.yaml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. name: ☂ Code Coverage
  2. on:
  3. push:
  4. branches: [ main ]
  5. pull_request:
  6. branches: [ '**' ]
  7. jobs:
  8. coverage:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: Checkout Repository
  12. uses: actions/checkout@v4
  13. - name: Install Rust Toolchain
  14. uses: actions-rs/toolchain@v1
  15. with:
  16. override: true
  17. toolchain: nightly
  18. components: llvm-tools-preview
  19. profile: minimal
  20. - name: Cache Project
  21. uses: Swatinem/rust-cache@v2
  22. - name: Generate Code coverage
  23. env:
  24. CARGO_INCREMENTAL: '0'
  25. LLVM_PROFILE_FILE: "rs-wnfs-%p-%m.profraw"
  26. RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
  27. RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
  28. run: cargo test -p wnfs --all-features
  29. - name: Install grcov
  30. run: "curl -L https://github.com/mozilla/grcov/releases/download/v0.8.12/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf -"
  31. - name: Run grcov
  32. run: "./grcov . --llvm --binary-path target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore '/*' -o lcov.info"
  33. - name: Install covfix
  34. uses: actions-rs/install@v0.1
  35. with:
  36. crate: rust-covfix
  37. use-tool-cache: true
  38. - name: Run covfix
  39. run: rust-covfix lcov.info -o lcov.info --verbose
  40. - name: Upload to codecov.io
  41. uses: codecov/codecov-action@v4
  42. continue-on-error: true
  43. with:
  44. token: ${{ secrets.CODECOV_TOKEN }}
  45. fail_ci_if_error: false
  46. files: lcov.info