devops: added lcov merging for hardhat and forge coverage

This commit is contained in:
vicnaum
2023-01-19 21:28:31 +01:00
parent f09f58aa70
commit a9b4c9d879
4 changed files with 14 additions and 3 deletions

View File

@@ -20,7 +20,7 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Compile code and run test coverage
run: npm run coverage
run: npm run hardhat:coverage
foundry:
strategy:
@@ -50,3 +50,5 @@ jobs:
cp .env.example .env
source .env
forge test -vvv
- name: Run Full Merged Coverage
run: npm run coverage

5
.gitignore vendored
View File

@@ -17,11 +17,12 @@ build/
/tasks/collect.ts
/tasks/test-module.ts
/coverage
/coverage*
coverage.json
.coverage_artifacts
.coverage_cache
.coverage_contracts
lcov*
addresses.json
@@ -35,3 +36,5 @@ out/
/broadcast/**/dry-run/
contracts/core/modules/follow/SecretCodeFollowModule.sol
.DS_Store

View File

@@ -10,7 +10,10 @@
"size": "npm run compile && SKIP_LOAD=true hardhat size-contracts",
"full-deploy-local": "hardhat full-deploy --network localhost",
"full-deploy-mumbai": "hardhat full-deploy --network mumbai",
"coverage": "npm run compile && hardhat coverage --temp temp-artifacts --testfiles test/emptyrun.coverage.ts && hardhat coverage --temp temp-artifacts --testfiles '!test/emptyrun.coverage.ts'",
"hardhat:coverage": "npm run compile && hardhat coverage --temp temp-artifacts --testfiles test/emptyrun.coverage.ts && hardhat coverage --temp temp-artifacts --testfiles '!test/emptyrun.coverage.ts'",
"foundry:coverage": "forge coverage --report lcov",
"merge:coverage": "bash scripts/mergeCoverage.sh",
"coverage": "npm run hardhat:coverage && npm run foundry:coverage && npm run merge:coverage",
"run-env": "npm i && tail -f /dev/null",
"hardhat": "hardhat",
"hardhat:kovan": "hardhat --network kovan",

3
scripts/mergeCoverage.sh Normal file
View File

@@ -0,0 +1,3 @@
lcov -a lcov.info -a coverage/lcov.info -o lcov_merged.info
lcov -r lcov_merged.info 'test/*' '*contracts/core/modules/collect/*' '*contracts/core/modules/deprecated/*' '*contracts/core/modules/follow/*' '*contracts/core/modules/reference/*' '*contracts/core/modules/*Base.sol' '*contracts/mocks/*' -o lcov_merged_clean.info
genhtml lcov_merged_clean.info --rc lcov_branch_coverage=1 -o coverage_merged -s