-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (50 loc) · 1.62 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
name: Build and Test
on:
pull_request:
jobs:
Deploy-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: 20.9.0
- name: Restore cache
id: restore-cache
uses: actions/cache/restore@v3
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install HardHat
if: steps.restore-cache.outputs.cache-hit != 'true'
run: npm i hardhat
- name: File Import
run: npx hardhat run ./scripts/fileImport.ts
- name: compile contracts
run: npx hardhat compile
- name: Run tests
run: npx hardhat test
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
CMC_API_KEY: ${{ secrets.CMC_API_KEY }}
- name: Check if gasReport.md exists
id: check_gas_report
run: |
if [ -f gasReport.md ]; then
echo "exists=true" >> $GITHUB_ENV
else
echo "exists=false" >> $GITHUB_ENV
fi
- name: Comment on pull request
if: github.event_name == 'pull_request' && env.exists == 'true'
uses: thollander/actions-comment-pull-request@v2
with:
filePath: gasReport.md
comment_tag: 'gas_report'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}