forked from boundless-xyz/boundless
-
Notifications
You must be signed in to change notification settings - Fork 0
279 lines (231 loc) · 8.21 KB
/
contracts.yml
File metadata and controls
279 lines (231 loc) · 8.21 KB
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
name: Contracts
on:
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FOUNDRY_VERSION: v1.2.3
RISC0_TOOLCHAIN_VERSION: 1.88.0
RISC0_CRATE_VERSION: "3.0.3"
jobs:
contracts-changed:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.changes.outputs.src }}
foundry: ${{ steps.changes.outputs.foundry }}
steps:
- name: checkout code
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3.0.0
id: changes
with:
filters: |
src:
- 'contracts/src/**'
foundry:
- 'foundry.toml'
test:
- 'contracts/test/**'
scripts:
- 'contracts/scripts/**'
gas-snapshots-check:
runs-on: ubuntu-latest
needs: contracts-changed
if: ${{ needs.contracts-changed.outputs.src == 'true' || needs.contracts-changed.outputs.foundry == 'true' }}
steps:
- name: install npm
uses: actions/setup-node@v4
with:
node-version: 20
- name: checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: ${{ env.FOUNDRY_VERSION }}
- name: print forge version
run: forge --version
- name: Ensure gas snapshots have been updated. TODO Fix this. Snapshot checks are currently disabled as they don't match in CI.
run: FORGE_SNAPSHOT_CHECK=false forge test --isolate
upgradability:
runs-on: ubuntu-latest
needs: contracts-changed
if: ${{ needs.contracts-changed.outputs.src == 'true' || needs.contracts-changed.outputs.foundry == 'true' }}
steps:
- name: install npm
uses: actions/setup-node@v4
with:
node-version: 20
- name: install @openzeppelin/upgrades-core@1.41.0
run: npm install -g @openzeppelin/upgrades-core@1.41.0
- name: install foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: ${{ env.FOUNDRY_VERSION }}
- name: checkout main code
uses: actions/checkout@v4
with:
ref: main
submodules: recursive
- name: Forge build on main branch
run: forge build
env:
FOUNDRY_PROFILE: reference-contract
FOUNDRY_OUT: contracts/out
- name: Upload build-info artifact
uses: actions/upload-artifact@v4
with:
name: build-info
path: contracts/out/build-info/
- name: checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download build-info artifact
uses: actions/download-artifact@v4
with:
name: build-info
path: contracts/reference-contract/build-info-reference
- name: Run forge test on reference-contract profile
run: forge test -vvv
env:
FOUNDRY_PROFILE: reference-contract
FOUNDRY_OUT: contracts/reference-contract/out
deployment-scripts:
runs-on: [ self-hosted, prod, "${{ matrix.os }}", "${{ matrix.device }}" ]
needs: contracts-changed
if: ${{ needs.contracts-changed.outputs.src == 'true' || needs.contracts-changed.outputs.foundry == 'true' || needs.contracts-changed.outputs.scripts == 'true'}}
strategy:
# Run only on Linux with CPU.
matrix:
include:
- os: Linux
feature: default
device: cpu
steps:
- name: checkout code
uses: actions/checkout@v4
- name: install npm
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install yq (GitHub binary)
run: |
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.46.1/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install tomlkit
run: pip install tomlkit
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: v1.0.0
- uses: risc0/risc0/.github/actions/rustup@v3.0.3
- uses: risc0/risc0/.github/actions/sccache@v3.0.3
with:
key: ${{ matrix.os }}-${{ matrix.feature }}
- name: install cargo risczero
uses: ./.github/actions/bininstall-risc0
with:
risczero-version: ${{ env.RISC0_CRATE_VERSION }}
toolchain-version: ${{ env.RISC0_TOOLCHAIN_VERSION }}
- name: checkout main code
uses: actions/checkout@v4
with:
ref: main
submodules: recursive
- name: Forge build on main branch
run: forge build
env:
FOUNDRY_PROFILE: reference-contract
FOUNDRY_OUT: contracts/out
- name: Upload build-info artifact
uses: actions/upload-artifact@v4
with:
name: build-info-deployment
path: contracts/out/build-info/
- name: checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download build-info artifact
uses: actions/download-artifact@v4
with:
name: build-info-deployment
path: contracts/build-info-reference
- name: forge build
run: forge build
- name: cargo install boundless-cli
run: cargo install boundless-cli --path crates/boundless-cli --locked
- name: cargo install just
run: cargo install just
- name: cargo build
run: cargo build --locked
- name: spin up local network
run: just localnet up
env:
CI: 1
RISC0_DEV_MODE: 1
REPO_ROOT: ${{ github.workspace }}
- name: deploy script
run: ./contracts/scripts/manage DeployBoundlessMarket --broadcast
env:
CHAIN_KEY: anvil
# This key is a prefunded address for the anvil test configuration (index 0)
DEPLOYER_PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
ADMIN_ADDRESS: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
- name: forge test after new deployment
env:
CHAIN_KEY: anvil
RISC0_DEV_MODE: 1
run: ./contracts/scripts/test --match-contract '^DeploymentTest$'
- name: forge clean
run: forge clean
env:
FOUNDRY_OUT: contracts/out
- name: upgrade script
run: ./contracts/scripts/manage UpgradeBoundlessMarket --broadcast
env:
CHAIN_KEY: anvil
# This key is a prefunded address for the anvil test configuration (index 0)
DEPLOYER_PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
ADMIN_ADDRESS: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
- name: forge test after upgrade
env:
CHAIN_KEY: anvil
RISC0_DEV_MODE: 1
run: ./contracts/scripts/test --match-contract '^DeploymentTest$'
- name: rollback script
run: ./contracts/scripts/manage RollbackBoundlessMarket --broadcast
env:
CHAIN_KEY: anvil
# This key is a prefunded address for the anvil test configuration (index 0)
DEPLOYER_PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
ADMIN_ADDRESS: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
- name: forge test after rollback
env:
CHAIN_KEY: anvil
RISC0_DEV_MODE: 1
run: ./contracts/scripts/test --match-contract '^DeploymentTest$'
- name: Cleanup
if: always()
run: just localnet down
env:
CI: 1
- name: sccache stats
run: sccache --show-stats