Commit ea4f01c5 authored by Maurelian's avatar Maurelian

chore(contracts): generate test coverage in CI

chore(contracts): make coverage its own action
Co-authored-by: default avatarGeorgios Konstantopoulos <me@gakonst.com>
parent 12dbd81b
......@@ -60,6 +60,53 @@ jobs:
ENABLE_GAS_REPORT: 1
- name: Print gas report
run: cat packages/contracts/gas-report.txt
test-coverage:
name: Generate test coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fetch history
run: git fetch
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
# only install dependencies if there was a change in the deps
# if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install
- name: Build
run: yarn build
- name: Test Coverage
run: yarn test:coverage
# Tests are quite brittle when instrumented by Solidity Coverage.
# If tests pass in the Test job above, tests failing during coverage shouldn't break CI.
continue-on-error: true
- uses: codecov/codecov-action@v1
with:
files: ./packages/contracts/coverage.json
fail_ci_if_error: false
verbose: true
lint:
name: Linting
runs-on: ubuntu-latest
......
......@@ -12,6 +12,7 @@ cache-ovm
l2geth/build/bin
packages/contracts/deployments/custom
packages/contracts/coverage*
packages/data-transport-layer/db
......
......@@ -18,6 +18,7 @@
"clean": "yarn lerna run clean",
"build": "yarn lerna run build",
"test": "yarn lerna run test --parallel",
"test:coverage": "yarn lerna run test:coverage --parallel",
"lint": "yarn lerna run lint",
"lint:fix": "yarn lerna run lint:fix",
"postinstall": "patch-package",
......
......@@ -56,7 +56,7 @@ yarn test ./test/path/to/my/test.spec.ts
### Measuring test coverage:
```shell
yarn test-coverage
yarn test:coverage
```
The output is most easily viewable by opening the html file in your browser:
......
......@@ -29,6 +29,7 @@
"test": "yarn run test:contracts",
"test:contracts": "hardhat test --show-stack-traces",
"test:gas": "hardhat test \"test/contracts/OVM/execution/OVM_StateManager.gas-spec.ts\" --no-compile --show-stack-traces",
"test:coverage": "NODE_OPTIONS=--max_old_space_size=8192 hardhat coverage",
"lint": "yarn run lint:typescript",
"lint:typescript": "tslint --format stylish --project .",
"lint:fix": "yarn run lint:fix:typescript",
......@@ -51,7 +52,8 @@
"@openzeppelin/contracts-upgradeable": "^3.3.0",
"@typechain/hardhat": "^1.0.1",
"ganache-core": "^2.13.2",
"glob": "^7.1.6"
"glob": "^7.1.6",
"solidity-coverage": "^0.7.16"
},
"devDependencies": {
"@eth-optimism/hardhat-ovm": "^0.1.0",
......
......@@ -2198,22 +2198,23 @@
resolved "https://registry.yarnpkg.com/@truffle/error/-/error-0.0.12.tgz#83e02e6ffe1d154fe274141d90038a91fd1e186d"
integrity sha512-kZqqnPR9YDJG7KCDOcN1qH16Qs0oz1PzF0Y93AWdhXuL9S9HYo/RUUeqGKbPpRBEZldQUS8aa4EzfK08u5pu6g==
"@truffle/interface-adapter@^0.4.20":
version "0.4.20"
resolved "https://registry.yarnpkg.com/@truffle/interface-adapter/-/interface-adapter-0.4.20.tgz#cf3f176e6fe14321bf164d502bf8d05e50209eb5"
integrity sha512-GcdtXjU+Mhx/WuD3Af1thojHilhUAWtKfoNF09oEDyGSrS0QEWq9s9kOFjrfTFJrK+g0I6VXMrU2sIido96NBA==
"@truffle/interface-adapter@^0.4.19":
version "0.4.19"
resolved "https://registry.yarnpkg.com/@truffle/interface-adapter/-/interface-adapter-0.4.19.tgz#19248ac88099f8df34f58a3d43a95ba3470dc89a"
integrity sha512-+Zz6Fr8+I2wYSS8RM3WBOMzf22QffMQTnlsYsRgRHzv3gYoRA9ZDLb84lFRfmWyw+IdXTo90tjRHEb5krC6uxg==
dependencies:
bn.js "^5.1.3"
ethers "^4.0.32"
source-map-support "^0.5.19"
web3 "1.2.9"
"@truffle/provider@^0.2.24":
version "0.2.27"
resolved "https://registry.yarnpkg.com/@truffle/provider/-/provider-0.2.27.tgz#8d06f94df6e6ea632ccd4518c419f6d3c0b05531"
integrity sha512-PwFcrH++FslHQMZEiID6t6CFTVavJHj4EVszmMS3E4+P9HIcpZTh/hHACqXhvlBxv94J9yM6SFmcSSokn8GC7A==
version "0.2.26"
resolved "https://registry.yarnpkg.com/@truffle/provider/-/provider-0.2.26.tgz#88e31b79973c2427c4a17d9a59411e6fbc810190"
integrity sha512-YKPmhB9S9AQkT2ePGtadwjDduxU23DXXy+5zyM5fevw5GCbXSnf+jG6rICXjPkVFjuKBlXuq5JbuERZn43522Q==
dependencies:
"@truffle/error" "^0.0.12"
"@truffle/interface-adapter" "^0.4.20"
"@truffle/interface-adapter" "^0.4.19"
web3 "1.2.9"
"@typechain/ethers-v5@1.0.0":
......@@ -6839,13 +6840,20 @@ github-from-package@0.0.0:
resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce"
integrity sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=
glob-parent@^5.1.0, glob-parent@^5.1.1, glob-parent@~5.1.0:
glob-parent@^5.1.0, glob-parent@^5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
dependencies:
is-glob "^4.0.1"
glob-parent@~5.1.0:
version "5.1.1"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229"
integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==
dependencies:
is-glob "^4.0.1"
glob@7.1.3:
version "7.1.3"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
......@@ -13002,9 +13010,9 @@ u2f-api@0.2.7:
integrity sha512-fqLNg8vpvLOD5J/z4B6wpPg4Lvowz1nJ9xdHcCzdUPKcFE/qNCceV2gNZxSJd5vhAZemHr/K/hbzVA0zxB5mkg==
uglify-js@^3.1.4:
version "3.13.3"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.13.3.tgz#ce72a1ad154348ea2af61f50933c76cc8802276e"
integrity sha512-otIc7O9LyxpUcQoXzj2hL4LPWKklO6LJWoJUzNa8A17Xgi4fOeDC8FBDOLHnC/Slo1CQgsZMcM6as0M76BZaig==
version "3.13.2"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.13.2.tgz#fe10319861bccc8682bfe2e8151fbdd8aa921c44"
integrity sha512-SbMu4D2Vo95LMC/MetNaso1194M1htEA+JrqE9Hk+G2DhI+itfS9TRu9ZKeCahLDNa/J3n4MqUJ/fOHMzQpRWw==
uid-number@0.0.6:
version "0.0.6"
......@@ -13740,7 +13748,21 @@ web3-utils@1.2.9:
underscore "1.9.1"
utf8 "3.0.0"
web3-utils@^1.0.0-beta.31, web3-utils@^1.3.0, web3-utils@^1.3.4:
web3-utils@^1.0.0-beta.31, web3-utils@^1.3.0:
version "1.3.4"
resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.3.4.tgz#9b1aa30d7549f860b573e7bb7e690999e7192198"
integrity sha512-/vC2v0MaZNpWooJfpRw63u0Y3ag2gNjAWiLtMSL6QQLmCqCy4SQIndMt/vRyx0uMoeGt1YTwSXEcHjUzOhLg0A==
dependencies:
bn.js "^4.11.9"
eth-lib "0.2.8"
ethereum-bloom-filters "^1.0.6"
ethjs-unit "0.1.6"
number-to-bn "1.7.0"
randombytes "^2.1.0"
underscore "1.9.1"
utf8 "3.0.0"
web3-utils@^1.3.4:
version "1.3.5"
resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.3.5.tgz#14ee2ff1a7a226867698d6eaffd21aa97aed422e"
integrity sha512-5apMRm8ElYjI/92GHqijmaLC+s+d5lgjpjHft+rJSs/dsnX8I8tQreqev0dmU+wzU+2EEe4Sx9a/OwGWHhQv3A==
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment