Skip to content

Commit

Permalink
chore: fix incorrect coverage values in the compare test coverage
Browse files Browse the repository at this point in the history
worklow

- fetch development and pull request branches to separate folders
- set working-directory during get coverage steps
- forge build before forge coverage to be able to access JSON ABI facet
contracts

Resolves: ubiquity#826
  • Loading branch information
gitcoindev committed Oct 25, 2023
1 parent df84ee4 commit d60c6e7
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions .github/workflows/coverage-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ jobs:
uses: actions/checkout@v3
with:
ref: development
path: development

- name: Checkout code in PR branch
uses: actions/checkout@v3
with:
path: pr

- name: Setup Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand All @@ -30,11 +36,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
forge build && forge coverage --report lcov
# Foundry uses relative paths but Hardhat uses absolute paths.
# Convert absolute paths to relative paths for consistency.
Expand All @@ -59,28 +64,19 @@ 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: 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: pr/packages/contracts
run: |
cd ./packages/contracts
# generates lcov.info
forge coverage --report lcov
forge build && forge coverage --report lcov
# Foundry uses relative paths but Hardhat uses absolute paths.
# Convert absolute paths to relative paths for consistency.
Expand All @@ -105,7 +101,6 @@ jobs:
"src/dollar/utils/*" \
"test/*" \
# Generate summary
COVERAGE_DEVELOPMENT_OUTPUT=$(lcov \
--rc lcov_branch_coverage=1 \
Expand All @@ -126,4 +121,4 @@ jobs:
- name: Upload test coverage report to coveralls.io
uses: coverallsapp/github-action@v2
with:
file: packages/contracts/filtered-lcov.info
file: pr/packages/contracts/filtered-lcov.info

0 comments on commit d60c6e7

Please sign in to comment.