From 0d544d97e5fe77feaa98b9147fa38b6da4516db5 Mon Sep 17 00:00:00 2001 From: Yorke Rhodes Date: Wed, 14 Aug 2024 15:47:17 -0400 Subject: [PATCH] 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 --- codecov.yml | 7 +++++++ solidity/.vscode/extensions.json | 1 + solidity/coverage.sh | 25 +++---------------------- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/codecov.yml b/codecov.yml index 34bba51fc8..f748f30dc5 100644 --- a/codecov.yml +++ b/codecov.yml @@ -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 diff --git a/solidity/.vscode/extensions.json b/solidity/.vscode/extensions.json index 033e0b2a58..a5da993383 100644 --- a/solidity/.vscode/extensions.json +++ b/solidity/.vscode/extensions.json @@ -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": [] diff --git a/solidity/coverage.sh b/solidity/coverage.sh index 050ac0d257..2776a76adf 100755 --- a/solidity/coverage.sh +++ b/solidity/coverage.sh @@ -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