@@ -126,268 +126,6 @@ steps:
126126 - cd packages/smart-contract
127127 - npm run verify -- --network bellecour $(cat deployments/DataProtector/address) $(cat deployments/DataProtector/args)
128128
129- ---
130- # deploy sharing smart contract to prod, staging or dev
131- kind : pipeline
132- type : docker
133- name : sharing-smart-contract deploy
134-
135- trigger :
136- event :
137- - promote
138- target :
139- # deploy and verify the AddOnlyAppWhitelistRegistry and DataProtectorSharing contracts with the dev deployer
140- - sharing-smart-contract-deploy-dev
141- # deploy and verify the AddOnlyAppWhitelistRegistry and DataProtectorSharing contracts with the dev deployer, configure DataProtectorSharing for staging and commit the staging environment update
142- - sharing-smart-contract-deploy-staging
143- # deploy and verify the AddOnlyAppWhitelistRegistry and DataProtectorSharing contracts with the prod deployer and commit the prod environment update
144- - sharing-smart-contract-deploy-prod
145- branch :
146- - develop
147- - main
148-
149- steps :
150- - name : install-deps
151- image : node:18.19
152- pull : always
153- commands :
154- - cd packages/sharing-smart-contract
155- - node -v
156- - npm -v
157- - npm ci
158-
159- - name : install-forge
160- image : node:18.19
161- pull : always
162- commands :
163- - export XDG_CONFIG_HOME=/drone/src
164- - curl -L https://foundry.paradigm.xyz | bash
165- - export PATH="$PATH:/drone/src/.foundry/bin"
166- - foundryup
167- - cd packages/sharing-smart-contract
168- - forge install foundry-rs/forge-std --no-git
169-
170- - name : bellecour-fork
171- detach : true
172- image : ghcr.io/foundry-rs/foundry:latest
173- pull : always
174- expose :
175- - 8545
176- commands :
177- - 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
178-
179- - name : bellecour-fork-healthy
180- image : bash
181- commands :
182- - while ! nc -z bellecour-fork 8545 ; do sleep 1 ; done && echo "bellecour-fork ready"
183- depends_on :
184- - bellecour-fork
185-
186- - name : compile
187- image : node:18.19
188- commands :
189- - cd packages/sharing-smart-contract
190- - export PATH="$PATH:/drone/src/.foundry/bin"
191- - npm run compile
192- depends_on :
193- - install-forge
194- - install-deps
195-
196- - name : check format
197- image : node:18.19
198- commands :
199- - cd packages/sharing-smart-contract
200- - npm run check-format
201- depends_on :
202- - install-deps
203-
204- - name : lint
205- image : node:18.19
206- commands :
207- - cd packages/sharing-smart-contract
208- - npm run lint
209- depends_on :
210- - install-deps
211-
212- - name : uml-diagrams
213- image : node:18.19
214- commands :
215- - cd packages/sharing-smart-contract
216- - npm run uml
217- depends_on :
218- - install-deps
219-
220- - name : static-analyzer
221- image : node:18.19
222- commands :
223- - cd packages/sharing-smart-contract
224- - git clone https://github.com/Picodes/4naly3er.git
225- - cd 4naly3er
226- - git reset --hard HEAD~1 # FIX issue https://github.com/Picodes/4naly3er/issues/48
227- - yarn install
228- - yarn analyze ../contracts
229- depends_on :
230- - compile
231- - lint
232-
233- - name : hardhat-tests
234- image : node:18.19
235- commands :
236- - cd packages/sharing-smart-contract
237- - export PATH="$PATH:/drone/src/.foundry/bin"
238- - npm run test -- --network ci-bellecour-fork
239- depends_on :
240- - install-deps
241- - install-forge
242- - compile
243- - bellecour-fork-healthy
244-
245- - name : forge-tests
246- image : node:18.19
247- commands :
248- - cd packages/sharing-smart-contract
249- - export PATH="$PATH:/drone/src/.foundry/bin"
250- - forge test --no-match-test "invariant" -vvvvv
251- depends_on :
252- - install-deps
253- - install-forge
254- - compile
255- - bellecour-fork-healthy
256-
257- - name : smart-contract-dev-deployment
258- image : node:18.19
259- environment :
260- WALLET_PRIVATE_KEY :
261- from_secret : deployer-dev-privatekey
262- commands :
263- - cd packages/sharing-smart-contract
264- - export PATH="$PATH:/drone/src/.foundry/bin"
265- - npm run deploy -- --network bellecour
266- depends_on :
267- - compile
268- - forge-tests
269- - hardhat-tests
270- when :
271- target :
272- - sharing-smart-contract-deploy-dev
273- branch :
274- - develop
275-
276- - name : smart-contract-staging-deployment
277- image : node:18.19
278- environment :
279- WALLET_PRIVATE_KEY :
280- from_secret : deployer-dev-privatekey
281- ENV : staging
282- MANIFEST_DEFAULT_DIR : .openzeppelin/staging
283- commands :
284- - cd packages/sharing-smart-contract
285- - export PATH="$PATH:/drone/src/.foundry/bin"
286- - npm run deploy -- --network bellecour
287- - git add .openzeppelin
288- depends_on :
289- - compile
290- - forge-tests
291- - hardhat-tests
292- when :
293- target :
294- - sharing-smart-contract-deploy-staging
295- branch :
296- - develop
297-
298- - name : smart-contract-prod-deployment
299- image : node:18.19
300- environment :
301- WALLET_PRIVATE_KEY :
302- from_secret : deployer-prod-privatekey
303- MANIFEST_DEFAULT_DIR : .openzeppelin/prod
304- commands :
305- - cd packages/sharing-smart-contract
306- - export PATH="$PATH:/drone/src/.foundry/bin"
307- - npm run deploy -- --network bellecour
308- - git add .openzeppelin
309- depends_on :
310- - compile
311- - forge-tests
312- - hardhat-tests
313- when :
314- target :
315- - sharing-smart-contract-deploy-prod
316- branch :
317- - main
318-
319- - name : update-prod-env
320- image : node:18.19
321- environment :
322- ENV : prod
323- commands :
324- - cd environments
325- - KEY=dataprotectorSharingContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/address) npm run update-env
326- - KEY=dataprotectorSharingStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/block) npm run update-env
327- - KEY=addOnlyAppWhitelistRegistryContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/address) npm run update-env
328- - KEY=addOnlyAppWhitelistRegistryStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/block) npm run update-env
329- - git add environments.json
330- -
git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected] >" 331- when :
332- target :
333- - sharing-smart-contract-deploy-prod
334- depends_on :
335- - smart-contract-prod-deployment
336-
337- - name : update-staging-env
338- image : node:18.19
339- environment :
340- ENV : staging
341- commands :
342- - cd environments
343- - KEY=dataprotectorSharingContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/address) npm run update-env
344- - KEY=dataprotectorSharingStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/block) npm run update-env
345- - KEY=addOnlyAppWhitelistRegistryContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/address) npm run update-env
346- - KEY=addOnlyAppWhitelistRegistryStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/block) npm run update-env
347- - git add environments.json
348- -
git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected] >" 349- when :
350- target :
351- - sharing-smart-contract-deploy-staging
352- depends_on :
353- - smart-contract-staging-deployment
354-
355- - name : smart-contract-staging-update-env
356- image : node:18.19
357- environment :
358- WALLET_PRIVATE_KEY :
359- # TODO replace by dataprotector-admin-dev-privatekey
360- from_secret : deployer-dev-privatekey
361- ENV : staging
362- commands :
363- - cd packages/sharing-smart-contract
364- - export PATH="$PATH:/drone/src/.foundry/bin"
365- - npm run update-env -- --network bellecour
366- depends_on :
367- # relies on environments.json
368- - update-staging-env
369- when :
370- target :
371- - sharing-smart-contract-deploy-staging
372- branch :
373- - develop
374-
375- - name : git-push
376- image : appleboy/drone-git-push
377- settings :
378- remote :
ssh://[email protected] /iExecBlockchainComputing/dataprotector-sdk.git 379- branch : update-env-${DRONE_BUILD_NUMBER}
380- ssh_key :
381- from_secret : ssh-key-team-product-github-push
382- when :
383- target :
384- - sharing-smart-contract-deploy-prod
385- - sharing-smart-contract-deploy-staging
386- depends_on :
387- - update-prod-env
388- - update-staging-env
389- - smart-contract-staging-update-env
390-
391129---
392130# pipeline to updateEnv in DataProtectorSharing SC
393131kind : pipeline
0 commit comments