Skip to content

Commit

Permalink
chore: use new forge feature for filtering coverage (hyperlane-xyz#4318)
Browse files Browse the repository at this point in the history
### Description

- Remove lcov toolchain from coverage script in favor of new native
forge features
- Require strictly increasing project coverage

### Drive-by changes

- Add coverage gutters to vscode recommendations for inline view

### Backward compatibility

Yes

### Testing

See codecov report comment
  • Loading branch information
yorhodes authored Aug 14, 2024
1 parent 5dfa2d5 commit 0d544d9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
7 changes: 7 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
coverage:
status:
project:
default:
target: auto # strictly increasing coverage
threshold: 3% # buffer for coverage drop

comment:
layout: "header, diff, flags, components" # show component info in the PR comment

Expand Down
1 change: 1 addition & 0 deletions solidity/.vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"recommendations": [
"JuanBlanco.solidity",
"tintinweb.vscode-ethover",
"ryanluker.vscode-coverage-gutters"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
Expand Down
25 changes: 3 additions & 22 deletions solidity/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,10 @@
# exit on error
set -e

# generates lcov.info
# exclude FastTokenRouter until https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/2806 is resolved
forge coverage \
--report lcov \
--report summary \
--no-match-coverage "(test|mock|node_modules|script|Fast)" \
--no-match-test testFork \
--ir-minimum # https://github.com/foundry-rs/foundry/issues/3357

if ! command -v lcov &>/dev/null; then
echo "lcov is not installed. Installing..."
sudo apt-get install lcov
fi

lcov --version

# exclude FastTokenRouter until https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/2806
EXCLUDE="*test* *mock* *node_modules* *script* *FastHyp*"
lcov \
--rc lcov_branch_coverage=1 \
--remove lcov.info $EXCLUDE \
--output-file forge-pruned-lcov.info \

if [ "$CI" != "true" ]; then
genhtml forge-pruned-lcov.info \
--rc lcov_branch_coverage=1 \
--output-directory coverage
open coverage/index.html
fi

0 comments on commit 0d544d9

Please sign in to comment.