-
Notifications
You must be signed in to change notification settings - Fork 2
84 lines (69 loc) · 2.3 KB
/
node.js.yml
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Build and Test
on:
pull_request:
jobs:
Gas-Test:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' # This line ensures that this job only runs on pull requests
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.15.0'
- name: Restore cache
id: restore-cache
uses: actions/cache/restore@v3
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install HardHat
if: steps.restore-cache.outputs.cache-hit != 'true'
run: npm i hardhat
- name: Run gas tests and generate report
id: gas_test
run: npx hardhat test
env:
BSCSCAN_API_KEY: ${{ secrets.BSCSCAN_API_KEY }}
CMC_API_KEY: ${{ secrets.CMC_API_KEY }}
- name: Generate Markdown Table and Save to Env
run: node parseGasReport.js
- name: Comment PR with Gas Test Report
uses: thollander/actions-comment-pull-request@v2
with:
filePath: md_gas_report.txt
comment_tag: 'gas_report'
Coverage-Test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.15.0'
- name: Restore cache
id: restore-cache
uses: actions/cache/restore@v3
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install HardHat
if: steps.restore-cache.outputs.cache-hit != 'true'
run: npm i hardhat
- name: Run tests and generate coverage
run: npx hardhat coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
# Save cache only if it was not restored before
- name: Save cache
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}