chore: use new forge feature for filtering coverage (#4318)

### 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
pull/4327/head
Yorke Rhodes 3 months ago committed by GitHub
parent 5dfa2d54e6
commit 0d544d97e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      codecov.yml
  2. 1
      solidity/.vscode/extensions.json
  3. 25
      solidity/coverage.sh

@ -1,3 +1,10 @@
coverage:
status:
project:
default:
target: auto # strictly increasing coverage
threshold: 3% # buffer for coverage drop
comment: comment:
layout: "header, diff, flags, components" # show component info in the PR comment layout: "header, diff, flags, components" # show component info in the PR comment

@ -6,6 +6,7 @@
"recommendations": [ "recommendations": [
"JuanBlanco.solidity", "JuanBlanco.solidity",
"tintinweb.vscode-ethover", "tintinweb.vscode-ethover",
"ryanluker.vscode-coverage-gutters"
], ],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace. // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [] "unwantedRecommendations": []

@ -3,29 +3,10 @@
# exit on error # exit on error
set -e set -e
# generates lcov.info # exclude FastTokenRouter until https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/2806 is resolved
forge coverage \ forge coverage \
--report lcov \ --report lcov \
--report summary \
--no-match-coverage "(test|mock|node_modules|script|Fast)" \
--no-match-test testFork \ --no-match-test testFork \
--ir-minimum # https://github.com/foundry-rs/foundry/issues/3357 --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

Loading…
Cancel
Save