Skip to content

Commit 2537b38

Browse files
author
vpnlnetwork
authored
Update ci.yml (hardhat)
1 parent 0d76afd commit 2537b38

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 25
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Use Node.js 20
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
23+
- name: Cache npm
24+
uses: actions/cache@v4
25+
with:
26+
path: ~/.npm
27+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
28+
restore-keys: |
29+
${{ runner.os }}-node-
30+
31+
- name: Install deps
32+
run: npm ci
33+
34+
- name: Compile (Hardhat)
35+
run: npx hardhat compile
36+
37+
- name: Run tests (Hardhat)
38+
run: npx hardhat test --network hardhat
39+
40+
- name: Lint Solidity with solhint (optional)
41+
if: hashFiles('.solhint.json') != '' || hashFiles('.solhint.jsonc') != ''
42+
run: npx solhint 'contracts/**/*.sol'
43+
44+
demo-build:
45+
name: Build demo (optional)
46+
runs-on: ubuntu-latest
47+
if: hashFiles('demo/package.json') != ''
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Use Node.js 20
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version: '20'
56+
57+
- name: Cache npm (demo)
58+
uses: actions/cache@v4
59+
with:
60+
path: ~/.npm
61+
key: ${{ runner.os }}-node-demo-${{ hashFiles('demo/package-lock.json') }}
62+
restore-keys: |
63+
${{ runner.os }}-node-
64+
65+
- name: Install demo deps
66+
working-directory: demo
67+
run: npm ci
68+
69+
- name: Build demo
70+
working-directory: demo
71+
run: npm run build

0 commit comments

Comments
 (0)