Add codecov github action (#2449)

### Description

Adds simplest viable codecov setup
pull/2453/head
Yorke Rhodes 1 year ago committed by GitHub
parent b98d882efe
commit aab8f19f8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      .github/workflows/node.yml
  2. 1
      package.json
  3. 40
      solidity/coverage.sh
  4. 2
      solidity/package.json
  5. 192
      typescript/token/lcov.base.info

@ -187,7 +187,6 @@ jobs:
sarif_file: ${{ steps.slither.outputs.sarif }}
coverage-sol:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: [yarn-build]
@ -209,10 +208,12 @@ jobs:
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
- name: Install dependencies
run: sudo apt-get install lcov
- name: Run tests with coverage
run: yarn workspace @hyperlane-xyz/core run coverage
run: yarn coverage
env:
NODE_OPTIONS: --max_old_space_size=4096
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}

@ -21,6 +21,7 @@
"prettier": "yarn workspaces foreach --verbose --parallel run prettier",
"lint": "yarn workspaces foreach --verbose --parallel run lint",
"test": "yarn workspaces foreach --verbose --parallel run test",
"coverage": "yarn workspaces foreach --verbose --parallel run coverage",
"version:check": "yarn version check --interactive",
"version:prepare": "yarn workspaces foreach --no-private --verbose --topological version --immediate",
"publish:all": "yarn workspaces foreach --no-private --verbose --topological npm publish --access public"

@ -1,40 +0,0 @@
set -e # exit on error
# generates lcov.info
forge coverage --report lcov
# generates coverage/lcov.info
yarn hardhat coverage
# Foundry uses relative paths but Hardhat uses absolute paths.
# Convert absolute paths to relative paths for consistency.
sed -i -e 's/\/.*solidity.//g' coverage/lcov.info
# Merge lcov files
lcov \
--rc lcov_branch_coverage=1 \
--add-tracefile coverage/lcov.info \
--add-tracefile lcov.info \
--output-file merged-lcov.info
# Filter out node_modules, test, and mock files
lcov \
--rc lcov_branch_coverage=1 \
--remove merged-lcov.info \
--output-file filtered-lcov.info \
"*node_modules*" "*test*" "*mock*"
# Generate summary
lcov \
--rc lcov_branch_coverage=1 \
--list filtered-lcov.info
# Open more granular breakdown in browser
if [ "$CI" != "true" ]
then
genhtml \
--rc genhtml_branch_coverage=1 \
--output-directory coverage \
filtered-lcov.info
open coverage/index.html
fi

@ -46,7 +46,7 @@
"build": "hardhat compile && tsc",
"lint": "solhint contracts/**/*.sol",
"clean": "hardhat clean && rm -rf ./dist ./cache",
"coverage": "./coverage.sh",
"coverage": "hardhat coverage && forge coverage --report lcov",
"prettier": "prettier --write ./contracts ./test",
"test": "hardhat test && yarn test:forge",
"test:forge": "forge test -vvv",

@ -1,192 +0,0 @@
TN:
SF:/Users/yorhodes/hyperlane/abacus-monorepo/typescript/token/contracts/extensions/HypERC721URICollateral.sol
FN:14,constructor
FN:22,_transferFromSender
FNF:2
FNH:2
FNDA:24,constructor
FNDA:54,_transferFromSender
DA:27,54
DA:28,52
LF:2
LH:2
BRF:0
BRH:0
end_of_record
TN:
SF:/Users/yorhodes/hyperlane/abacus-monorepo/typescript/token/contracts/extensions/HypERC721URIStorage.sol
FN:19,constructor
FN:25,_transferFromSender
FN:38,_transferTo
FN:47,tokenURI
FN:56,_beforeTokenTransfer
FN:70,supportsInterface
FN:79,_burn
FNF:7
FNH:6
FNDA:120,constructor
FNDA:41,_transferFromSender
FNDA:65,_transferTo
FNDA:44,tokenURI
FNDA:4916,_beforeTokenTransfer
FNDA:0,supportsInterface
FNDA:39,_burn
DA:30,41
DA:31,40
DA:43,65
DA:44,65
DA:53,44
DA:62,4916
DA:76,0
DA:83,39
LF:8
LH:7
BRF:0
BRH:0
end_of_record
TN:
SF:/Users/yorhodes/hyperlane/abacus-monorepo/typescript/token/contracts/HypERC20.sol
FN:18,constructor
FN:34,initialize
FN:50,_transferFromSender
FN:63,_transferTo
FNF:4
FNH:4
FNDA:99,constructor
FNDA:429,initialize
FNDA:10,_transferFromSender
FNDA:48,_transferTo
DA:36,429
DA:42,429
DA:43,429
DA:55,10
DA:56,9
DA:68,48
LF:6
LH:6
BRF:0
BRH:0
end_of_record
TN:
SF:/Users/yorhodes/hyperlane/abacus-monorepo/typescript/token/contracts/HypERC20Collateral.sol
FN:20,constructor
FN:31,initialize
FN:43,_transferFromSender
FN:59,_transferTo
FNF:4
FNH:3
FNDA:18,constructor
FNDA:72,initialize
FNDA:40,_transferFromSender
FNDA:0,_transferTo
DA:21,18
DA:33,72
DA:48,40
DA:52,39
DA:64,0
LF:5
LH:4
BRDA:48,1,0,39
BRDA:48,1,1,1
BRDA:64,2,0,0
BRDA:64,2,1,0
BRF:4
BRH:2
end_of_record
TN:
SF:/Users/yorhodes/hyperlane/abacus-monorepo/typescript/token/contracts/HypERC721.sol
FN:17,constructor
FN:33,initialize
FN:50,_transferFromSender
FN:65,_transferTo
FNF:4
FNH:4
FNDA:234,constructor
FNDA:998,initialize
FNDA:81,_transferFromSender
FNDA:117,_transferTo
DA:35,998
DA:40,998
DA:41,998
DA:42,9600
DA:56,81
DA:57,78
DA:58,78
DA:70,117
LF:8
LH:8
BRDA:56,1,0,78
BRDA:56,1,1,3
BRF:2
BRH:2
end_of_record
TN:
SF:/Users/yorhodes/hyperlane/abacus-monorepo/typescript/token/contracts/HypERC721Collateral.sol
FN:20,constructor
FN:31,initialize
FN:43,_transferFromSender
FN:57,_transferTo
FNF:4
FNH:3
FNDA:45,constructor
FNDA:180,initialize
FNDA:95,_transferFromSender
FNDA:0,_transferTo
DA:21,45
DA:33,180
DA:49,95
DA:50,91
DA:62,0
LF:5
LH:4
BRF:0
BRH:0
end_of_record
TN:
SF:/Users/yorhodes/hyperlane/abacus-monorepo/typescript/token/contracts/libs/Message.sol
FN:5,format
FN:13,recipient
FN:17,amount
FN:22,tokenId
FN:26,metadata
FNF:5
FNH:4
FNDA:217,format
FNDA:165,recipient
FNDA:165,amount
FNDA:0,tokenId
FNDA:165,metadata
DA:10,217
DA:14,165
DA:18,165
DA:23,0
DA:31,165
LF:5
LH:4
BRF:0
BRH:0
end_of_record
TN:
SF:/Users/yorhodes/hyperlane/abacus-monorepo/typescript/token/contracts/libs/TokenRouter.sol
FN:45,constructor
FN:57,transferRemote
FN:89,_handle
FNF:3
FNH:3
FNDA:396,constructor
FNDA:227,transferRemote
FNDA:165,_handle
DA:46,396
DA:62,227
DA:63,217
DA:70,185
DA:94,165
DA:95,165
DA:96,165
DA:97,165
DA:98,156
LF:9
LH:9
BRF:0
BRH:0
end_of_record
Loading…
Cancel
Save