From 85877bf50255321c1eab7abb763da7f6f212c613 Mon Sep 17 00:00:00 2001 From: miguelmtzinf Date: Tue, 20 Feb 2024 12:29:39 +0100 Subject: [PATCH] fix: Fix package scripts and remove combined-coverage --- .github/workflows/certora-gho.yml | 1 - .github/workflows/node.js.yml | 2 +- README.md | 1 + combined-coverage.sh | 34 ------------------------------- package.json | 24 ++++++++++++++-------- setup-test-env.sh | 4 +--- 6 files changed, 18 insertions(+), 48 deletions(-) delete mode 100755 combined-coverage.sh diff --git a/.github/workflows/certora-gho.yml b/.github/workflows/certora-gho.yml index 9fd57aa0..419b95d7 100644 --- a/.github/workflows/certora-gho.yml +++ b/.github/workflows/certora-gho.yml @@ -13,7 +13,6 @@ on: jobs: verify: runs-on: ubuntu-latest - # group: larger steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 0ff01d6a..90d0fc9d 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -3,7 +3,7 @@ on: push jobs: build: runs-on: - group: larger + group: ubuntu-latest env: ALCHEMY_KEY: '${{secrets.ALCHEMY_KEY}}' strategy: diff --git a/README.md b/README.md index 0dc83f4f..f22820c1 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ Clone the repository and run the following command to install dependencies: ```sh npm i +forge i ``` If you need to interact with GHO in the Goerli testnet, provide your Alchemy API key and mnemonic in the `.env` file: diff --git a/combined-coverage.sh b/combined-coverage.sh deleted file mode 100755 index b6847432..00000000 --- a/combined-coverage.sh +++ /dev/null @@ -1,34 +0,0 @@ - -#!/bin/bash - -# @dev -# This bash script creates coverage reports via Hardhat and Foundry -# and then merges them, removing uninteresting files - -npm run hardhat coverage -forge coverage --report lcov - -# sed -i -e 's/\/.*gho-core.//g' coverage/lcov.info -sed -i -e '/^FN\|FNDA:/s/,[^.]*\./,/g' lcov.info - - - -lcov \ - --rc lcov_branch_coverage=1 \ - --add-tracefile coverage/lcov.info \ - --add-tracefile lcov.info \ - --output-file merged-lcov.info - -lcov \ - --rc lcov_branch_coverage=1 \ - --remove merged-lcov.info \ - --output-file combined-lcov.info \ - "*node_modules*" "*test*" "*mock*" "*script*" - -rm merged-lcov.info - -lcov \ - --rc lcov_branch_coverage=1 \ - --list combined-lcov.info - -genhtml ./combined-lcov.info -o report --branch-coverage \ No newline at end of file diff --git a/package.json b/package.json index ee1d96fc..7e170755 100644 --- a/package.json +++ b/package.json @@ -19,24 +19,30 @@ }, "scripts": { "hardhat": "hardhat", - "clean": "hardhat clean", + "clean": "npm run clean:hh & npm run clean:forge", + "clean:hh": "hardhat clean", + "clean:forge": "forge clean", "prettier:check": "prettier --check .", "prettier:write": "prettier --write .", "prepare": "husky install", - "compile": "rm -rf ./artifacts ./cache ./types && SKIP_LOAD=true hardhat compile", - "test": ". ./setup-test-env.sh && hardhat test ./test/*.ts", - "forge-test": "forge test -vvv --no-match-test 'skip'", - "test-goerli:fork": ". ./setup-test-env.sh && FORK=goerli npm run test --no-compile", - "test-goerli:fork:skip-deploy": ". ./setup-test-env.sh && FORK=goerli SKIP_DEPLOY=true npm run test", + "compile": "npm run compile:hh && npm run compile:forge", + "compile:hh": "rm -rf ./artifacts ./cache ./types && SKIP_LOAD=true hardhat compile", + "compile:forge": "forge build --force", + "test": "npm run test:hh && npm run test:forge", + "test:hh": ". ./setup-test-env.sh && hardhat test ./test/*.ts", + "test:forge": "forge test -vvv --no-match-test 'skip'", + "test-goerli:fork": ". ./setup-test-env.sh && FORK=goerli npm run test:hh --no-compile", + "test-goerli:fork:skip-deploy": ". ./setup-test-env.sh && FORK=goerli SKIP_DEPLOY=true npm run test:hh", "test:stkAave": ". ./setup-test-env.sh && hardhat test ./test/__setup.test.ts ./test/stkAave-upgrade.test.ts", - "coverage": ". ./setup-test-env.sh && hardhat coverage", - "combined-coverage": ". ./setup-test-env.sh && ./combined-coverage.sh", + "coverage:hh": ". ./setup-test-env.sh && hardhat coverage", + "coverage:forge": "forge coverage --report summary", + "coverage:forge:report": "forge coverage --report lcov && lcov --remove lcov.info \"*test/*\" \"*script/*\" \"*node_modules/*\" --output-file lcov.info --rc lcov_branch_coverage=1 && genhtml lcov.info --branch-coverage --output-dir coverage", "deploy-testnet": ". ./setup-test-env.sh && hardhat deploy-and-setup", "deploy-testnet:goerli": "HARDHAT_NETWORK=goerli npm run deploy-testnet", "deploy-testnet:goerli:fork": "FORK=goerli npm run deploy-testnet", "deploy-testnet:sepolia": "HARDHAT_NETWORK=sepolia npm run deploy-testnet", "deploy-testnet:sepolia:fork": "FORK=sepolia npm run deploy-testnet", - "ci:clean": "rm -rf ./artifacts ./cache ./types ./temp-artifacts", + "ci:clean": "npm run clean && rm -rf ./artifacts ./cache ./types ./cache_forge", "ci:test": "npm run test" }, "devDependencies": { diff --git a/setup-test-env.sh b/setup-test-env.sh index 07915e64..3ae10b56 100644 --- a/setup-test-env.sh +++ b/setup-test-env.sh @@ -5,9 +5,7 @@ # This bash script ensures a clean repository # and loads environment variables for testing and deploying GHO source code. -# export NODE_OPTIONS="--max_old_space_size=32768" export NODE_OPTIONS="--max_old_space_size=16384" - set -e echo "[BASH] Setting up testnet enviroment" @@ -16,7 +14,7 @@ if [ ! "$COVERAGE" = true ]; then # remove hardhat and artifacts cache npm run ci:clean - # compile @aave/core-v3 contracts + # compile contracts npm run compile else echo "[BASH] Skipping compilation to keep coverage artifacts"