@@ -33,331 +33,7 @@ steps:
33
33
echo "ABIs not up-to-date in packages/subgraph, need to run 'npm run refresh-abis'"
34
34
exit 1
35
35
fi
36
-
37
- ---
38
- # deploy sharing smart contract to prod, staging or dev
39
- kind : pipeline
40
- type : docker
41
- name : sharing-smart-contract deploy
42
-
43
- trigger :
44
- event :
45
- - promote
46
- target :
47
- # deploy and verify the AddOnlyAppWhitelistRegistry and DataProtectorSharing contracts with the dev deployer
48
- - sharing-smart-contract-deploy-dev
49
- # deploy and verify the AddOnlyAppWhitelistRegistry and DataProtectorSharing contracts with the dev deployer, configure DataProtectorSharing for staging and commit the staging environment update
50
- - sharing-smart-contract-deploy-staging
51
- # deploy and verify the AddOnlyAppWhitelistRegistry and DataProtectorSharing contracts with the prod deployer and commit the prod environment update
52
- - sharing-smart-contract-deploy-prod
53
- branch :
54
- - main
55
-
56
- steps :
57
- - name : install-deps
58
- image : node:18.19
59
- pull : always
60
- commands :
61
- - cd packages/sharing-smart-contract
62
- - node -v
63
- - npm -v
64
- - npm ci
65
-
66
- - name : install-forge
67
- image : node:18.19
68
- pull : always
69
- commands :
70
- - export XDG_CONFIG_HOME=/drone/src
71
- - curl -L https://foundry.paradigm.xyz | bash
72
- - export PATH="$PATH:/drone/src/.foundry/bin"
73
- - foundryup
74
- - cd packages/sharing-smart-contract
75
- - forge install foundry-rs/forge-std --no-git
76
-
77
- - name : bellecour-fork
78
- detach : true
79
- image : ghcr.io/foundry-rs/foundry:latest
80
- pull : always
81
- expose :
82
- - 8545
83
- commands :
84
- - anvil --host 0.0.0.0 --port 8545 --hardfork berlin --fork-url https://bellecour.iex.ec --chain-id 134 --gas-limit 6700000 --gas-price 0
85
-
86
- - name : bellecour-fork-healthy
87
- image : bash
88
- commands :
89
- - while ! nc -z bellecour-fork 8545 ; do sleep 1 ; done && echo "bellecour-fork ready"
90
- depends_on :
91
- - bellecour-fork
92
-
93
- - name : compile
94
- image : node:18.19
95
- commands :
96
- - cd packages/sharing-smart-contract
97
- - export PATH="$PATH:/drone/src/.foundry/bin"
98
- - npm run compile
99
- depends_on :
100
- - install-forge
101
- - install-deps
102
-
103
- - name : check format
104
- image : node:18.19
105
- commands :
106
- - cd packages/sharing-smart-contract
107
- - npm run check-format
108
- depends_on :
109
- - install-deps
110
-
111
- - name : lint
112
- image : node:18.19
113
- commands :
114
- - cd packages/sharing-smart-contract
115
- - npm run lint
116
- depends_on :
117
- - install-deps
118
-
119
- - name : uml-diagrams
120
- image : node:18.19
121
- commands :
122
- - cd packages/sharing-smart-contract
123
- - npm run uml
124
- depends_on :
125
- - install-deps
126
-
127
- - name : static-analyzer
128
- image : node:18.19
129
- commands :
130
- - cd packages/sharing-smart-contract
131
- - git clone https://github.com/Picodes/4naly3er.git
132
- - cd 4naly3er
133
- - git reset --hard HEAD~1 # FIX issue https://github.com/Picodes/4naly3er/issues/48
134
- - yarn install
135
- - yarn analyze ../contracts
136
- depends_on :
137
- - compile
138
- - lint
139
-
140
- - name : hardhat-tests
141
- image : node:18.19
142
- commands :
143
- - cd packages/sharing-smart-contract
144
- - export PATH="$PATH:/drone/src/.foundry/bin"
145
- - npm run test -- --network ci-bellecour-fork
146
- depends_on :
147
- - install-deps
148
- - install-forge
149
- - compile
150
- - bellecour-fork-healthy
151
-
152
- - name : forge-tests
153
- image : node:18.19
154
- commands :
155
- - cd packages/sharing-smart-contract
156
- - export PATH="$PATH:/drone/src/.foundry/bin"
157
- - forge test --no-match-test "invariant" -vvvvv
158
- depends_on :
159
- - install-deps
160
- - install-forge
161
- - compile
162
- - bellecour-fork-healthy
163
-
164
- - name : smart-contract-dev-deployment
165
- image : node:18.19
166
- environment :
167
- WALLET_PRIVATE_KEY :
168
- from_secret : deployer-dev-privatekey
169
- commands :
170
- - cd packages/sharing-smart-contract
171
- - export PATH="$PATH:/drone/src/.foundry/bin"
172
- - npm run deploy -- --network bellecour
173
- depends_on :
174
- - compile
175
- - forge-tests
176
- - hardhat-tests
177
- when :
178
- target :
179
- - sharing-smart-contract-deploy-dev
180
-
181
- - name : smart-contract-staging-deployment
182
- image : node:18.19
183
- environment :
184
- WALLET_PRIVATE_KEY :
185
- from_secret : deployer-dev-privatekey
186
- ENV : staging
187
- MANIFEST_DEFAULT_DIR : .openzeppelin/staging
188
- commands :
189
- - cd packages/sharing-smart-contract
190
- - export PATH="$PATH:/drone/src/.foundry/bin"
191
- - npm run deploy -- --network bellecour
192
- - git add .openzeppelin
193
- depends_on :
194
- - compile
195
- - forge-tests
196
- - hardhat-tests
197
- when :
198
- target :
199
- - sharing-smart-contract-deploy-staging
200
-
201
- - name : smart-contract-prod-deployment
202
- image : node:18.19
203
- environment :
204
- WALLET_PRIVATE_KEY :
205
- from_secret : deployer-prod-privatekey
206
- MANIFEST_DEFAULT_DIR : .openzeppelin/prod
207
- commands :
208
- - cd packages/sharing-smart-contract
209
- - export PATH="$PATH:/drone/src/.foundry/bin"
210
- - npm run deploy -- --network bellecour
211
- - git add .openzeppelin
212
- depends_on :
213
- - compile
214
- - forge-tests
215
- - hardhat-tests
216
- when :
217
- target :
218
- - sharing-smart-contract-deploy-prod
219
-
220
- - name : update-prod-env
221
- image : node:18.19
222
- environment :
223
- ENV : prod
224
- commands :
225
- - cd environments
226
- - KEY=dataprotectorSharingContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/address) npm run update-env
227
- - KEY=dataprotectorSharingStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/block) npm run update-env
228
- - KEY=addOnlyAppWhitelistRegistryContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/address) npm run update-env
229
- - KEY=addOnlyAppWhitelistRegistryStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/block) npm run update-env
230
- - git add environments.json
231
- -
git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected] >"
232
- when :
233
- target :
234
- - sharing-smart-contract-deploy-prod
235
- depends_on :
236
- - smart-contract-prod-deployment
237
-
238
- - name : update-staging-env
239
- image : node:18.19
240
- environment :
241
- ENV : staging
242
- commands :
243
- - cd environments
244
- - KEY=dataprotectorSharingContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/address) npm run update-env
245
- - KEY=dataprotectorSharingStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/block) npm run update-env
246
- - KEY=addOnlyAppWhitelistRegistryContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/address) npm run update-env
247
- - KEY=addOnlyAppWhitelistRegistryStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/block) npm run update-env
248
- - git add environments.json
249
- -
git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected] >"
250
- when :
251
- target :
252
- - sharing-smart-contract-deploy-staging
253
- depends_on :
254
- - smart-contract-staging-deployment
255
-
256
- - name : smart-contract-staging-update-env
257
- image : node:18.19
258
- environment :
259
- WALLET_PRIVATE_KEY :
260
- # TODO replace by dataprotector-admin-dev-privatekey
261
- from_secret : deployer-dev-privatekey
262
- ENV : staging
263
- commands :
264
- - cd packages/sharing-smart-contract
265
- - export PATH="$PATH:/drone/src/.foundry/bin"
266
- - npm run update-env -- --network bellecour
267
- depends_on :
268
- # relies on environments.json
269
- - update-staging-env
270
- when :
271
- target :
272
- - sharing-smart-contract-deploy-staging
273
-
274
- - name : git-push
275
- image : appleboy/drone-git-push
276
- settings :
277
- remote :
ssh://[email protected] /iExecBlockchainComputing/dataprotector-sdk.git
278
- branch : update-env-${DRONE_BUILD_NUMBER}
279
- ssh_key :
280
- from_secret : ssh-key-team-product-github-push
281
- when :
282
- target :
283
- - sharing-smart-contract-deploy-prod
284
- - sharing-smart-contract-deploy-staging
285
- depends_on :
286
- - update-prod-env
287
- - update-staging-env
288
- - smart-contract-staging-update-env
289
-
290
- ---
291
- # pipeline to updateEnv in DataProtectorSharing SC
292
- kind : pipeline
293
- type : docker
294
- name : sharing-smart-contract update-env
295
-
296
- trigger :
297
- event :
298
- - promote
299
- target :
300
- # configure the staging DataProtectorSharing contract to use the staging environment
301
- - sharing-smart-contract-update-env-staging
302
- # configure the prod DataProtectorSharing contract to use the prod environment
303
- - sharing-smart-contract-update-env-prod
304
- branch :
305
- - main
306
-
307
- steps :
308
- - name : install-deps
309
- image : node:18.19
310
- pull : always
311
- commands :
312
- - cd packages/sharing-smart-contract
313
- - npm ci
314
-
315
- - name : install-forge
316
- image : node:18.19
317
- pull : always
318
- commands :
319
- - export XDG_CONFIG_HOME=/drone/src
320
- - curl -L https://foundry.paradigm.xyz | bash
321
- - export PATH="$PATH:/drone/src/.foundry/bin"
322
- - foundryup
323
- - forge install foundry-rs/forge-std --no-git
324
-
325
- - name : smart-contract-staging-update-env
326
- image : node:18.19
327
- environment :
328
- WALLET_PRIVATE_KEY :
329
- # TODO replace by dataprotector-admin-dev-privatekey
330
- from_secret : deployer-dev-privatekey
331
- ENV : staging
332
- commands :
333
- - cd packages/sharing-smart-contract
334
- - export PATH="$PATH:/drone/src/.foundry/bin"
335
- - npm run update-env -- --network bellecour
336
- depends_on :
337
- - install-forge
338
- - install-deps
339
- when :
340
- target :
341
- - sharing-smart-contract-update-env-staging
342
-
343
- - name : smart-contract-prod-update-env
344
- image : node:18.19
345
- environment :
346
- WALLET_PRIVATE_KEY :
347
- # TODO replace by dataprotector-admin-prod-privatekey
348
- from_secret : deployer-prod-privatekey
349
- ENV : prod
350
- commands :
351
- - cd packages/sharing-smart-contract
352
- - export PATH="$PATH:/drone/src/.foundry/bin"
353
- - npm run update-env -- --network bellecour
354
- depends_on :
355
- - install-forge
356
- - install-deps
357
- when :
358
- target :
359
- - sharing-smart-contract-update-env-prod
360
-
36
+
361
37
---
362
38
# pipeline to upgrade the DataProtectorSharing SC
363
39
kind : pipeline
0 commit comments