From 71f3ea8415a4bf065918c7e521fa746c9b75b115 Mon Sep 17 00:00:00 2001 From: cchudant Date: Thu, 8 Aug 2024 19:35:21 +0000 Subject: [PATCH] ci: coverage in ci --- .github/workflows/coverage.yml | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 6314f5229..57bf2505f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -4,6 +4,8 @@ name: Task - Integration Tests on: workflow_dispatch: workflow_call: + pull_request: + branches: [main] jobs: coverage: @@ -21,10 +23,30 @@ jobs: sudo apt-get install -y clang llvm libudev-dev protobuf-compiler - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov - - name: Coverage - run: cargo llvm-cov --codecov --output-path codecov.json - - name: Upload coverage to codecov.io - uses: codecov/codecov-action@v3 + + - name: Build binary + run: | + source <(cargo llvm-cov show-env --export-prefix) + cargo build --bin deoxys --profile dev + + - name: Launch Anvil + run: anvil --fork-url $ANVIL_FORK_URL --fork-block-number $ANVIL_BLOCK_NUMBER & + env: + ANVIL_FORK_URL: "https://eth.merkle.io" + ANVIL_BLOCK_NUMBER: 20395662 + + - name: Build and run tests + run: | + source <(cargo llvm-cov show-env --export-prefix) + export COVERAGE_BIN=$(realpath target/debug/deoxys) + rm -f target/madara-* lcov.info + cargo test --profile dev + - name: Generate coverage info + run: | + source <(cargo llvm-cov show-env --export-prefix) + cargo llvm-cov report --cobertura --output-path coverage.cobertura.xml + + - name: Code Coverage Summary Report + uses: irongut/CodeCoverageSummary@v1.3.0 with: - files: codecov.json - fail_ci_if_error: false + filename: coverage.cobertura.xml