From 7a70182d49a0b9dc947c9925a5d28edc49c28b0d Mon Sep 17 00:00:00 2001 From: korrrba <88761781+gitcoindev@users.noreply.github.com> Date: Tue, 31 Oct 2023 16:18:52 +0100 Subject: [PATCH] fix incorrect coverage values in the compare test coverage workflow (#828) * chore: remove unused hardhat absolute path replacement Resolves: #826 --- .github/workflows/coverage-check.yml | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/coverage-check.yml b/.github/workflows/coverage-check.yml index a6b0510e2..90271a6e4 100644 --- a/.github/workflows/coverage-check.yml +++ b/.github/workflows/coverage-check.yml @@ -19,6 +19,7 @@ jobs: uses: actions/checkout@v3 with: ref: development + path: development - name: Setup Foundry uses: foundry-rs/foundry-toolchain@v1 @@ -30,15 +31,10 @@ jobs: - name: Get development branch coverage id: coverage-development + working-directory: development/packages/contracts run: | - cd ./packages/contracts - # generates lcov.info - forge coverage --report lcov - - # Foundry uses relative paths but Hardhat uses absolute paths. - # Convert absolute paths to relative paths for consistency. - sed -i -e 's/\/.*solidity.//g' lcov.info + forge build && forge coverage --report lcov # Merge lcov files lcov \ @@ -59,7 +55,6 @@ jobs: "src/dollar/utils/*" \ "test/*" \ - # Generate summary COVERAGE_DEVELOPMENT_OUTPUT=$(lcov \ --rc lcov_branch_coverage=1 \ @@ -67,24 +62,18 @@ jobs: echo COVERAGE=$(echo "${COVERAGE_DEVELOPMENT_OUTPUT}" | tail -n 1 | cut -d % -f 1 | cut -d \| -f 2) >> $GITHUB_OUTPUT + - name: Delete development branch folder + run: rm -rf development + - name: Checkout code in PR branch uses: actions/checkout@v3 - - name: Update Forge Dependencies - working-directory: packages/contracts - run: forge update lib/forge-std - - name: Get PR branch coverage id: coverage-pr + working-directory: packages/contracts run: | - cd ./packages/contracts - # generates lcov.info - forge coverage --report lcov - - # Foundry uses relative paths but Hardhat uses absolute paths. - # Convert absolute paths to relative paths for consistency. - sed -i -e 's/\/.*solidity.//g' lcov.info + forge build && forge coverage --report lcov # Merge lcov files lcov \ @@ -105,7 +94,6 @@ jobs: "src/dollar/utils/*" \ "test/*" \ - # Generate summary COVERAGE_DEVELOPMENT_OUTPUT=$(lcov \ --rc lcov_branch_coverage=1 \