-
Notifications
You must be signed in to change notification settings - Fork 18
41 lines (40 loc) · 1.5 KB
/
code-coverage-check.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Code Coverage Check
on:
push:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
env:
PROTOCOL_DEPLOYER_PRIVATE_KEY: 123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234
CC_TOKEN_DEPLOYER_PRIVATE_KEY: 123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234
NODE_OPTIONS: --max_old_space_size=4096
RINKEBY_URL: https://provider_url/project_key
ROPSTEN_URL: https://provider_url/project_key
MAINNET_URL: https://provider_url/project_key
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '12.20.x'
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Compile Contracts
run: npm run contracts:compile
- name: Code Coverage
run: npm run tests:coverage
- name: Check Code Coverage
shell: bash
run: |
MIN_COVERAGE=100
COVERAGE=`grep -a -m 1 -h -r '<span class="strong">' coverage/index.html | head -1 | sed 's/^[^>]*>//' | sed 's/%.*$//'`
echo "solidity code coverage is '$COVERAGE'"
if (( $(echo "$COVERAGE < $MIN_COVERAGE" | bc -l) )); then echo "Fail: code coverage '$COVERAGE' is lower than configured '$MIN_COVERAGE'" >&2; exit 1; fi
- name: Upload code coverage results
uses: actions/upload-artifact@v2
with:
name: code-coverage-report
path: coverage/