@@ -174,268 +174,6 @@ steps:
174174 - cd packages/smart-contract
175175 - npm run verify -- --network bellecour $(cat deployments/DataProtector/address) $(cat deployments/DataProtector/args)
176176
177- ---
178- # deploy sharing smart contract to prod, staging or dev
179- kind : pipeline
180- type : docker
181- name : sharing-smart-contract deploy
182-
183- trigger :
184- event :
185- - promote
186- target :
187- # deploy and verify the AddOnlyAppWhitelistRegistry and DataProtectorSharing contracts with the dev deployer
188- - sharing-smart-contract-deploy-dev
189- # deploy and verify the AddOnlyAppWhitelistRegistry and DataProtectorSharing contracts with the dev deployer, configure DataProtectorSharing for staging and commit the staging environment update
190- - sharing-smart-contract-deploy-staging
191- # deploy and verify the AddOnlyAppWhitelistRegistry and DataProtectorSharing contracts with the prod deployer and commit the prod environment update
192- - sharing-smart-contract-deploy-prod
193- branch :
194- - develop
195- - main
196-
197- steps :
198- - name : install-deps
199- image : node:18.19
200- pull : always
201- commands :
202- - cd packages/sharing-smart-contract
203- - node -v
204- - npm -v
205- - npm ci
206-
207- - name : install-forge
208- image : node:18.19
209- pull : always
210- commands :
211- - export XDG_CONFIG_HOME=/drone/src
212- - curl -L https://foundry.paradigm.xyz | bash
213- - export PATH="$PATH:/drone/src/.foundry/bin"
214- - foundryup
215- - cd packages/sharing-smart-contract
216- - forge install foundry-rs/forge-std --no-git
217-
218- - name : bellecour-fork
219- detach : true
220- image : ghcr.io/foundry-rs/foundry:latest
221- pull : always
222- expose :
223- - 8545
224- commands :
225- - 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
226-
227- - name : bellecour-fork-healthy
228- image : bash
229- commands :
230- - while ! nc -z bellecour-fork 8545 ; do sleep 1 ; done && echo "bellecour-fork ready"
231- depends_on :
232- - bellecour-fork
233-
234- - name : compile
235- image : node:18.19
236- commands :
237- - cd packages/sharing-smart-contract
238- - export PATH="$PATH:/drone/src/.foundry/bin"
239- - npm run compile
240- depends_on :
241- - install-forge
242- - install-deps
243-
244- - name : check format
245- image : node:18.19
246- commands :
247- - cd packages/sharing-smart-contract
248- - npm run check-format
249- depends_on :
250- - install-deps
251-
252- - name : lint
253- image : node:18.19
254- commands :
255- - cd packages/sharing-smart-contract
256- - npm run lint
257- depends_on :
258- - install-deps
259-
260- - name : uml-diagrams
261- image : node:18.19
262- commands :
263- - cd packages/sharing-smart-contract
264- - npm run uml
265- depends_on :
266- - install-deps
267-
268- - name : static-analyzer
269- image : node:18.19
270- commands :
271- - cd packages/sharing-smart-contract
272- - git clone https://github.com/Picodes/4naly3er.git
273- - cd 4naly3er
274- - git reset --hard HEAD~1 # FIX issue https://github.com/Picodes/4naly3er/issues/48
275- - yarn install
276- - yarn analyze ../contracts
277- depends_on :
278- - compile
279- - lint
280-
281- - name : hardhat-tests
282- image : node:18.19
283- commands :
284- - cd packages/sharing-smart-contract
285- - export PATH="$PATH:/drone/src/.foundry/bin"
286- - npm run test -- --network ci-bellecour-fork
287- depends_on :
288- - install-deps
289- - install-forge
290- - compile
291- - bellecour-fork-healthy
292-
293- - name : forge-tests
294- image : node:18.19
295- commands :
296- - cd packages/sharing-smart-contract
297- - export PATH="$PATH:/drone/src/.foundry/bin"
298- - forge test --no-match-test "invariant" -vvvvv
299- depends_on :
300- - install-deps
301- - install-forge
302- - compile
303- - bellecour-fork-healthy
304-
305- - name : smart-contract-dev-deployment
306- image : node:18.19
307- environment :
308- WALLET_PRIVATE_KEY :
309- from_secret : deployer-dev-privatekey
310- commands :
311- - cd packages/sharing-smart-contract
312- - export PATH="$PATH:/drone/src/.foundry/bin"
313- - npm run deploy -- --network bellecour
314- depends_on :
315- - compile
316- - forge-tests
317- - hardhat-tests
318- when :
319- target :
320- - sharing-smart-contract-deploy-dev
321- branch :
322- - develop
323-
324- - name : smart-contract-staging-deployment
325- image : node:18.19
326- environment :
327- WALLET_PRIVATE_KEY :
328- from_secret : deployer-dev-privatekey
329- ENV : staging
330- MANIFEST_DEFAULT_DIR : .openzeppelin/staging
331- commands :
332- - cd packages/sharing-smart-contract
333- - export PATH="$PATH:/drone/src/.foundry/bin"
334- - npm run deploy -- --network bellecour
335- - git add .openzeppelin
336- depends_on :
337- - compile
338- - forge-tests
339- - hardhat-tests
340- when :
341- target :
342- - sharing-smart-contract-deploy-staging
343- branch :
344- - develop
345-
346- - name : smart-contract-prod-deployment
347- image : node:18.19
348- environment :
349- WALLET_PRIVATE_KEY :
350- from_secret : deployer-prod-privatekey
351- MANIFEST_DEFAULT_DIR : .openzeppelin/prod
352- commands :
353- - cd packages/sharing-smart-contract
354- - export PATH="$PATH:/drone/src/.foundry/bin"
355- - npm run deploy -- --network bellecour
356- - git add .openzeppelin
357- depends_on :
358- - compile
359- - forge-tests
360- - hardhat-tests
361- when :
362- target :
363- - sharing-smart-contract-deploy-prod
364- branch :
365- - main
366-
367- - name : update-prod-env
368- image : node:18.19
369- environment :
370- ENV : prod
371- commands :
372- - cd environments
373- - KEY=dataprotectorSharingContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/address) npm run update-env
374- - KEY=dataprotectorSharingStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/block) npm run update-env
375- - KEY=addOnlyAppWhitelistRegistryContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/address) npm run update-env
376- - KEY=addOnlyAppWhitelistRegistryStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/block) npm run update-env
377- - git add environments.json
378- -
git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected] >" 379- when :
380- target :
381- - sharing-smart-contract-deploy-prod
382- depends_on :
383- - smart-contract-prod-deployment
384-
385- - name : update-staging-env
386- image : node:18.19
387- environment :
388- ENV : staging
389- commands :
390- - cd environments
391- - KEY=dataprotectorSharingContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/address) npm run update-env
392- - KEY=dataprotectorSharingStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/block) npm run update-env
393- - KEY=addOnlyAppWhitelistRegistryContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/address) npm run update-env
394- - KEY=addOnlyAppWhitelistRegistryStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/block) npm run update-env
395- - git add environments.json
396- -
git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected] >" 397- when :
398- target :
399- - sharing-smart-contract-deploy-staging
400- depends_on :
401- - smart-contract-staging-deployment
402-
403- - name : smart-contract-staging-update-env
404- image : node:18.19
405- environment :
406- WALLET_PRIVATE_KEY :
407- # TODO replace by dataprotector-admin-dev-privatekey
408- from_secret : deployer-dev-privatekey
409- ENV : staging
410- commands :
411- - cd packages/sharing-smart-contract
412- - export PATH="$PATH:/drone/src/.foundry/bin"
413- - npm run update-env -- --network bellecour
414- depends_on :
415- # relies on environments.json
416- - update-staging-env
417- when :
418- target :
419- - sharing-smart-contract-deploy-staging
420- branch :
421- - develop
422-
423- - name : git-push
424- image : appleboy/drone-git-push
425- settings :
426- remote :
ssh://[email protected] /iExecBlockchainComputing/dataprotector-sdk.git 427- branch : update-env-${DRONE_BUILD_NUMBER}
428- ssh_key :
429- from_secret : ssh-key-team-product-github-push
430- when :
431- target :
432- - sharing-smart-contract-deploy-prod
433- - sharing-smart-contract-deploy-staging
434- depends_on :
435- - update-prod-env
436- - update-staging-env
437- - smart-contract-staging-update-env
438-
439177---
440178# pipeline to updateEnv in DataProtectorSharing SC
441179kind : pipeline
0 commit comments