Skip to content

Commit 0e85865

Browse files
authored
ci: add L2 ovm tests (Synthetixio#1119)
* ci: add wait-for-hardhat cmd Signed-off-by: Jakub Mucha <jakub.mucha@icloud.com> * ci: add header machine Signed-off-by: Jakub Mucha <jakub.mucha@icloud.com> * ci: add prod tests ovm job Signed-off-by: Jakub Mucha <jakub.mucha@icloud.com> * ci: add prod tests ovm job to the workflow Signed-off-by: Jakub Mucha <jakub.mucha@icloud.com> * ci: generated circleci config Signed-off-by: Jakub Mucha <jakub.mucha@icloud.com> * ci: remove cmd-wait-for-rpc/hardhat cmds Signed-off-by: Jakub Mucha <jakub.mucha@icloud.com> * ci: add wait-for-port cmd Signed-off-by: Jakub Mucha <jakub.mucha@icloud.com> * ci: updated jobs to use cmd-wait-for-port Signed-off-by: Jakub Mucha <jakub.mucha@icloud.com> * ci: generated updated config Signed-off-by: Jakub Mucha <jakub.mucha@icloud.com>
1 parent 6106587 commit 0e85865

10 files changed

+108
-18
lines changed

.circleci/config.yml

+51-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
version: 2.1
22
commands:
3-
cmd-wait-for-rpc:
3+
cmd-wait-for-port:
4+
parameters:
5+
port:
6+
type: integer
47
steps:
58
- run: sleep 5
69
- run:
710
shell: /bin/sh
811
command: |
9-
wget --retry-connrefused --waitretry=1 --read-timeout=120 --timeout=120 -t 100 http://localhost:8545
12+
wget --retry-connrefused --waitretry=1 --read-timeout=120 --timeout=120 -t 100 http://localhost:<<parameters.port>>
1013
:
1114
jobs:
1215
job-compile:
@@ -86,7 +89,8 @@ jobs:
8689
- run:
8790
command: npx hardhat node
8891
background: true
89-
- cmd-wait-for-rpc
92+
- cmd-wait-for-port:
93+
port: 8545
9094
- run: node publish deploy --network local --fresh-deploy --yes --use-ovm --ignore-safety-checks --ignore-custom-parameters --deployment-path ./publish/deployed/local-ovm
9195
- run: npm run test:prod -- --no-compile --use-ovm --patch-fresh-deployment --deployment-path ./publish/deployed/local-ovm
9296
job-prod-diff-tests-local:
@@ -104,7 +108,8 @@ jobs:
104108
- run:
105109
command: npx hardhat node
106110
background: true
107-
- cmd-wait-for-rpc
111+
- cmd-wait-for-port:
112+
port: 8545
108113
- run: node publish deploy --network local --fresh-deploy --yes
109114
- run: npm run test:prod -- --patch-fresh-deployment
110115
job-prod-diff-tests:
@@ -123,12 +128,47 @@ jobs:
123128
- run:
124129
command: npx hardhat node --target-network mainnet
125130
background: true
126-
- cmd-wait-for-rpc
131+
- cmd-wait-for-port:
132+
port: 8545
127133
- run: node publish prepare-deploy --network mainnet
128134
- run: node publish deploy --ignore-safety-checks --add-new-synths --use-fork --yes --network mainnet
129135
- run: npm run test:prod:gas -- --target-network mainnet --patch-fresh-deployment && npx codechecks codechecks.prod.yml
130136
- store_artifacts:
131137
path: test-gas-used-prod.log
138+
job-prod-tests-ovm:
139+
working_directory: ~/repo
140+
machine:
141+
image: ubuntu-2004:202010-01
142+
docker_layer_caching: true
143+
resource_class: large
144+
steps:
145+
- checkout
146+
- attach_workspace:
147+
at: .
148+
- run:
149+
name: Prepare docker containers
150+
command: |
151+
git clone git@github.com:ethereum-optimism/optimism-integration.git
152+
cd optimism-integration
153+
docker-compose pull
154+
- run:
155+
name: Start chains
156+
background: true
157+
command: |
158+
cd optimism-integration
159+
./up.sh
160+
- cmd-wait-for-port:
161+
port: 8545
162+
- cmd-wait-for-port:
163+
port: 9545
164+
- run:
165+
name: Deploy OVM Synthetix instances
166+
command: |
167+
node publish deploy-ovm-pair
168+
- run:
169+
name: Run OVM production tests
170+
command: |
171+
npm run test:prod:ovm
132172
job-prod-tests:
133173
working_directory: ~/repo
134174
docker:
@@ -143,7 +183,8 @@ jobs:
143183
- run:
144184
command: npx hardhat node --target-network mainnet
145185
background: true
146-
- cmd-wait-for-rpc
186+
- cmd-wait-for-port:
187+
port: 8545
147188
- run: npm run test:prod:gas -- --target-network mainnet && npx codechecks codechecks.prod.yml
148189
- store_artifacts:
149190
path: test-gas-used-prod.log
@@ -320,6 +361,10 @@ workflows:
320361
- job-prod-tests:
321362
requires:
322363
- job-prepare
364+
- job-prod-tests-ovm:
365+
name: job-prod-tests-ovm
366+
requires:
367+
- job-prepare
323368
- job-prod-diff-tests-local:
324369
name: job-prod-diff-tests-local
325370
requires:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Wait until a connection is established with http://localhost:{port}
2+
parameters:
3+
port:
4+
type: integer
5+
steps:
6+
- run: sleep 5
7+
- run:
8+
shell: /bin/sh
9+
command: |
10+
wget --retry-connrefused --waitretry=1 --read-timeout=120 --timeout=120 -t 100 http://localhost:<<parameters.port>>
11+
:

.circleci/src/commands/cmd-wait-for-rpc.yml

-8
This file was deleted.

.circleci/src/jobs/job-prod-diff-tests-local-ovm.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ steps:
1313
- run:
1414
command: npx hardhat node
1515
background: true
16-
- cmd-wait-for-rpc
16+
- cmd-wait-for-port:
17+
port: 8545
1718
# Deploy
1819
- run: node publish deploy --network local --fresh-deploy --yes --use-ovm --ignore-safety-checks --ignore-custom-parameters --deployment-path ./publish/deployed/local-ovm
1920
# Run production tests

.circleci/src/jobs/job-prod-diff-tests-local.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ steps:
1010
- run:
1111
command: npx hardhat node
1212
background: true
13-
- cmd-wait-for-rpc
13+
- cmd-wait-for-port:
14+
port: 8545
1415
# Deploy
1516
- run: node publish deploy --network local --fresh-deploy --yes
1617
# Run production tests

.circleci/src/jobs/job-prod-diff-tests.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ steps:
1111
- run:
1212
command: npx hardhat node --target-network mainnet
1313
background: true
14-
- cmd-wait-for-rpc
14+
- cmd-wait-for-port:
15+
port: 8545
1516
# Prepare deploy
1617
- run: node publish prepare-deploy --network mainnet
1718
# Deploy
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Starts optimism-integration L1 and L2 local chains and runs Optimism integration tests against them
2+
{{> job-header-machine.yml}}
3+
resource_class: large
4+
steps:
5+
- checkout
6+
- attach_workspace:
7+
at: .
8+
- run:
9+
name: Prepare docker containers
10+
command: |
11+
git clone git@github.com:ethereum-optimism/optimism-integration.git
12+
cd optimism-integration
13+
docker-compose pull
14+
- run:
15+
name: Start chains
16+
background: true
17+
command: |
18+
cd optimism-integration
19+
./up.sh
20+
- cmd-wait-for-port:
21+
port: 8545
22+
- cmd-wait-for-port:
23+
port: 9545
24+
- run:
25+
name: Deploy OVM Synthetix instances
26+
command: |
27+
node publish deploy-ovm-pair
28+
- run:
29+
name: Run OVM production tests
30+
command: |
31+
npm run test:prod:ovm

.circleci/src/jobs/job-prod-tests.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ steps:
77
- run:
88
command: npx hardhat node --target-network mainnet
99
background: true
10-
- cmd-wait-for-rpc
10+
- cmd-wait-for-port:
11+
port: 8545
1112
- run: npm run test:prod:gas -- --target-network mainnet && npx codechecks codechecks.prod.yml
1213
- store_artifacts:
1314
path: test-gas-used-prod.log
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
working_directory: ~/repo
2+
machine:
3+
image: ubuntu-2004:202010-01
4+
docker_layer_caching: true

.circleci/src/workflows/workflow-all.yml

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3030
- job-prod-tests:
3131
{{> require-prepare.yml}}
32+
- job-prod-tests-ovm:
33+
name: job-prod-tests-ovm
34+
{{> require-prepare.yml}}
3235
- job-prod-diff-tests-local:
3336
name: job-prod-diff-tests-local
3437
{{> require-prepare.yml}}

0 commit comments

Comments
 (0)