-
Notifications
You must be signed in to change notification settings - Fork 1
150 lines (120 loc) · 3.97 KB
/
build.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Build, test and publish
on:
push:
branches: [main, develop]
tags: '*'
pull_request:
branches: [main, develop]
schedule:
- cron: "33 3 * * 1"
jobs:
build_hardhat:
name: Build and test (Hardhat)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: NPM install globals
run: npm install -g hardhat-shorthand solhint
- name: NPM install
run: npm install
- name: Compile contracts
run: npm run build
# - name: Run all tests
# run: npm run test
# - name: Archive build artifacts
# uses: actions/upload-artifact@v4
# with:
# name: artifacts
# path: |
# artifacts
# - name: Run linter (prettier check and solhint)
# run: npm run lint
build_foundry:
name: Build and test (Foundry)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Compile contracts
run: forge build
- name: Run all tests
run: forge test -vv
- name: Extract contract sizes report
run: forge build --sizes | egrep "|([^|]+)|([^|]*)|([^|]*)|" > contract_sizes.log
# - name: Archive size log
# uses: actions/upload-artifact@v4
# with:
# name: contract_sizes
# path: |
# contract_sizes.log
# publish:
# name: Publish npm package to npmjs
# runs-on: ubuntu-latest
# permissions:
# contents: read
# id-token: write
# needs: [build_hardhat, build_foundry]
# # only run if not on main and hardhat **and** founddry are successful and not dependabot
# if: ${{ github.ref != 'refs/heads/main' && contains(join(needs.*.result, ','), 'success') && github.actor != 'dependabot[bot]' }}
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Download build artifacts
# uses: actions/download-artifact@v4
# with:
# name: artifacts
# path: artifacts
# - name: Setup node environment
# uses: actions/setup-node@v4
# with:
# node-version: 20
# registry-url: 'https://registry.npmjs.org'
# # latest npm required for provenance
# - run: npm install -g npm
# - run: npm ci
# - name: Set build version identifier
# # version is set to current patch + 1 and a build identifier (revision plus seconds to avoid duplicates) is added
# run: npm version "`npm version patch --no-git-tag-version`-`git rev-parse --short HEAD`-`date +%s | tail -c4`" --no-git-tag-version
# - run: npm publish --tag next --provenance
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPMJS_ACCESS_TOKEN }}
# deployment_test:
# name: Execute test deployment on local chain
# runs-on: ubuntu-latest
# permissions:
# contents: read
# # id-token: write
# needs: [build_hardhat, build_foundry]
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# submodules: recursive
# - name: Install Foundry
# uses: foundry-rs/foundry-toolchain@v1
# - name: Setup node environment
# uses: actions/setup-node@v4
# with:
# node-version: 20
# registry-url: 'https://registry.npmjs.org'
# - name: Install dependencies
# run: |
# npm install -g hardhat-shorthand
# npm install
# - name: Run deployment script
# env:
# SKIP_VERIFICATION: true
# run: hh run scripts/deploy_all.ts