Skip to content

Commit

Permalink
fix incorrect coverage values in the compare test coverage workflow (#…
Browse files Browse the repository at this point in the history
…828)

* chore: remove unused hardhat absolute path replacement

Resolves: #826
  • Loading branch information
gitcoindev authored Oct 31, 2023
1 parent 6e45c80 commit 7a70182
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions .github/workflows/coverage-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
uses: actions/checkout@v3
with:
ref: development
path: development

- name: Setup Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand All @@ -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 \
Expand All @@ -59,32 +55,25 @@ jobs:
"src/dollar/utils/*" \
"test/*" \
# Generate summary
COVERAGE_DEVELOPMENT_OUTPUT=$(lcov \
--rc lcov_branch_coverage=1 \
--list filtered-lcov.info)
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 \
Expand All @@ -105,7 +94,6 @@ jobs:
"src/dollar/utils/*" \
"test/*" \
# Generate summary
COVERAGE_DEVELOPMENT_OUTPUT=$(lcov \
--rc lcov_branch_coverage=1 \
Expand Down

1 comment on commit 7a70182

@ubiquibot
Copy link

@ubiquibot ubiquibot bot commented on 7a70182 Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.