-
Notifications
You must be signed in to change notification settings - Fork 119
434 lines (434 loc) · 18.1 KB
/
integration_test_calamari.yml
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
name: calamari integration test
on:
push:
branches: [manta]
pull_request:
branches: [manta]
types: [opened, reopened, synchronize, labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DEBIAN_FRONTEND: noninteractive
POLKADOT_BINARY: https://github.com/paritytech/polkadot/releases/download/v1.3.0/polkadot
jobs:
print-rust-versions:
if: contains(github.event.pull_request.labels.*.name, 'A-calamari')
runs-on: ubuntu-20.04
container:
image: paritytech/ci-linux:production
outputs:
rustc-stable: ${{ steps.get-rust-versions.outputs.stable }}
rustc-nightly: ${{ steps.get-rust-versions.outputs.nightly }}
env:
CARGO_TERM_COLOR: always
steps:
- id: get-rust-versions
run: |
echo "::set-output name=stable::$(rustc +stable --version)"
echo "::set-output name=nightly::$(rustc +nightly --version)"
build-node-current:
timeout-minutes: 120
if: contains(github.event.pull_request.labels.*.name, 'A-calamari')
runs-on: ubuntu-20.04
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 18
- name: install sccache
env:
SCCACHE_RELEASE_URL: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.5.3
run: |
sudo apt update && sudo apt install -y curl
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$SCCACHE_RELEASE_URL/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: cache sccache
uses: actions/cache@v2
continue-on-error: false
with:
path: /home/runner/.cache/sccache
key: sccache-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
sccache-
- name: start sccache server
run: sccache --start-server
- name: init
shell: bash
run: |
sudo apt update
sudo apt install -y pkg-config libssl-dev protobuf-compiler git clang curl
protoc --version
curl -s https://sh.rustup.rs -sSf | sh -s -- -y
source ${HOME}/.cargo/env
rustup toolchain install 1.71.0
rustup default 1.71.0
rustup target add wasm32-unknown-unknown
- name: cache cargo
uses: Swatinem/rust-cache@v2
- name: build
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: /home/runner/.cache/sccache
run: |
source ${HOME}/.cargo/env
RUSTC_BOOTSTRAP=1 cargo build --profile production --verbose
- name: stop sccache server
run: sccache --stop-server || true
- if: always()
name: upload
uses: actions/upload-artifact@v2
with:
name: manta
path: target/production/manta
calamari-integration-test:
if: contains(github.event.pull_request.labels.*.name, 'A-calamari')
needs: [build-node-current]
runs-on: runtime-integration-test
timeout-minutes: 240
container:
image: ubuntu:20.04
strategy:
fail-fast: false
matrix:
chain-spec:
- id: calamari-dev
expected:
block-count:
relay: 25
para: 6
peer-count:
relay: 7
para: 4
steps:
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version: 18.x
- run: |
mkdir -p $HOME/.local/share/calamari-pc
mkdir -p $HOME/.local/bin
echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: fetch manta
uses: actions/download-artifact@v2
with:
name: manta
- name: mv and chmod manta
run: |
mv $GITHUB_WORKSPACE/manta $HOME/.local/bin/
chmod +x $HOME/.local/bin/manta
ls -ahl $GITHUB_WORKSPACE/
ls -ahl $HOME/.local/bin/
- name: fetch and chmod polkadot
shell: bash
run: |
apt update && apt install -y curl jq wget git
if [[ ! -f "$HOME/.local/bin/polkadot" ]]; then
curl -L -o $HOME/.local/bin/polkadot ${{ env.POLKADOT_BINARY }}
chmod +x $HOME/.local/bin/polkadot
fi
ls -ahl $HOME/.local/bin/
- name: Install dasel cli
run: |
curl -sSLf "$(curl -sSLf https://api.github.com/repos/tomwright/dasel/releases/latest | grep browser_download_url | grep linux_amd64 | grep -v .gz | cut -d\" -f 4)" -L -o $HOME/dasel && chmod +x $HOME/dasel
$HOME/dasel --version
- id: create-chainspec
shell: bash
run: |
jq --version
manta build-spec --chain ${{ matrix.chain-spec.id }} --disable-default-bootnode --raw > $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-spec.json
jq \
--sort-keys \
--arg name "calamari testnet ${GITHUB_SHA:0:7}" \
--arg id ${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7} \
--arg relay_chain rococo-local-${GITHUB_SHA:0:7} \
'. |
.name = $name |
.id = $id |
.relay_chain = $relay_chain |
.telemetryEndpoints = [["/dns/api.telemetry.manta.systems/tcp/443/x-parity-wss/%2Fsubmit%2F", 0]]
' $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-spec.json > $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json
ls -ahl $HOME/.local/share/calamari-pc/
echo "::set-output name=short-sha::${GITHUB_SHA:0:7}"
manta export-state --chain $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json > $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-state.json || true
- uses: borales/[email protected]
- uses: actions/checkout@v2
with:
repository: Manta-Network/Manta
path: Manta
- if: always()
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.chain-spec.id }}-state.json
path: /home/runner/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-state.json
- if: always()
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.chain-spec.id }}-spec.json
path: /home/runner/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-spec.json
- if: always()
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.chain-spec.id }}-${{ steps.create-chainspec.outputs.short-sha }}-spec.json
path: /home/runner/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${{ steps.create-chainspec.outputs.short-sha }}-spec.json
- name: create launch config
run: |
ls -ahl $GITHUB_WORKSPACE/Manta
cd $GITHUB_WORKSPACE
$HOME/dasel put -t string -v $HOME/.local/bin/polkadot -r toml \
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \
'.relaychain.default_command'
$HOME/dasel put -t string -v $HOME/.local/bin/manta -r toml \
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \
'.parachains.[0].collators.[0].command'
cat $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml
- if: always()
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.chain-spec.id }}-${{ steps.create-chainspec.outputs.short-sha }}-launch-config.json
path: /home/runner/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${{ steps.create-chainspec.outputs.short-sha }}-launch-config.json
- uses: actions/checkout@v2
with:
repository: paritytech/zombienet
path: zombienet-tool
- uses: actions/checkout@v2
with:
repository: Manta-Network/Dev-Tools
path: dev-tools-rococo
- uses: actions/checkout@v2
with:
repository: Manta-Network/Dev-Tools
path: dev-tools-calamari
- name: Setup yarn
run: npm install -g yarn
- name: Install pm2
run: npm install -g pm2
- name: launch testnet
shell: bash
run: |
cd $GITHUB_WORKSPACE/zombienet-tool
git pull && git checkout v1.3.89
cd $GITHUB_WORKSPACE/zombienet-tool/javascript
yarn
npm run build
pm2 start packages/cli/dist/cli.js --name zombienet \
--output $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stdout.log \
--error $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stderr.log \
-- spawn --provider native $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml
- name: init measure-block-time rococo
run: |
cd $GITHUB_WORKSPACE/dev-tools-rococo/measure-block-time
yarn install
pm2 start index.js \
--name measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }} \
--output $GITHUB_WORKSPACE/measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }}-stdout.log \
--error $GITHUB_WORKSPACE/measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }}-stderr.log \
--no-autorestart \
-- \
--address=ws://127.0.0.1:9911
- name: init measure-block-time calamari
run: |
cd $GITHUB_WORKSPACE/dev-tools-calamari/measure-block-time
yarn install
pm2 start index.js \
--name measure-block-time-${{ matrix.chain-spec.id }} \
--output $GITHUB_WORKSPACE/measure-block-time-${{ matrix.chain-spec.id }}-stdout.log \
--error $GITHUB_WORKSPACE/measure-block-time-${{ matrix.chain-spec.id }}-stderr.log \
--no-autorestart \
-- \
--address=ws://127.0.0.1:9921
- uses: actions/checkout@v2
with:
repository: Manta-Network/Manta
path: Manta
- name: run test suites
run: |
sleep 120
cd $GITHUB_WORKSPACE/Manta/tests
yarn install
yarn
yarn correctness_test --address=ws://127.0.0.1:9921 --exit
yarn performance_test --address=ws://127.0.0.1:9921 --exit
- name: check if target block is finalized
run: |
cd $GITHUB_WORKSPACE/dev-tools-calamari/check-finalized-block
yarn install
yarn
node index.js --para_address=ws://127.0.0.1:9921 --relay_address=ws://127.0.0.1:9911 --target_block=${{ matrix.chain-spec.expected.block-count.para }}
if [ $? == 1 ]; then echo "Failed to finalize the target block - ${{ matrix.chain-spec.expected.block-count.para }}"; exit 1; fi
- name: stop testnet
run: |
cd $GITHUB_WORKSPACE/zombienet-tool
pm2 stop measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }}
pm2 stop measure-block-time-${{ matrix.chain-spec.id }}
pm2 stop zombienet
- if: always()
uses: actions/upload-artifact@v2
with:
name: zombienet-for-${{ matrix.chain-spec.id }}-stdout.log
path: $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stdout.log
- if: always()
uses: actions/upload-artifact@v2
with:
name: zombienet-for-${{ matrix.chain-spec.id }}-stderr.log
path: $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stderr.log
- if: always()
uses: actions/upload-artifact@v2
with:
name: measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }}-stdout.log
path: $GITHUB_WORKSPACE/measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }}-stdout.log
- if: always()
uses: actions/upload-artifact@v2
with:
name: measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }}-stderr.log
path: $GITHUB_WORKSPACE/measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }}-stderr.log
- if: always()
uses: actions/upload-artifact@v2
with:
name: measure-block-time-${{ matrix.chain-spec.id }}-stdout.log
path: $GITHUB_WORKSPACE/measure-block-time-${{ matrix.chain-spec.id }}-stdout.log
- if: always()
uses: actions/upload-artifact@v2
with:
name: measure-block-time-${{ matrix.chain-spec.id }}-stderr.log
path: $GITHUB_WORKSPACE/measure-block-time-${{ matrix.chain-spec.id }}-stderr.log
- if: always()
uses: actions/upload-artifact@v2
with:
name: block-time-rococo-relay-for-${{ matrix.chain-spec.id }}.json
path: $GITHUB_WORKSPACE/block-time-rococo.json
- if: always()
name: test - calamari alice peered successfully
run: |
cd $GITHUB_WORKSPACE/zombienet-tool/javascript
node packages/cli/dist/cli.js -f -p native test $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.zndsl
- name: append manta-pay storage
shell: bash
run: |
wget -P $GITHUB_WORKSPACE/Manta/tests/data https://manta-ops.s3.amazonaws.com/integration-tests-data/storage.json
mv $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json $GITHUB_WORKSPACE/Manta/tests/data/fork.json
cd $GITHUB_WORKSPACE/Manta/tests
yarn install
yarn
node append_storage.js calamari
cd ../../
mv $GITHUB_WORKSPACE/Manta/tests/data/fork.json $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json
$HOME/dasel put -t string -v $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json -r toml \
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \
'.parachains.[0].chain_spec_path'
$HOME/dasel delete -r toml \
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \
'.parachains.[0].chain'
- name: launch testnet
shell: bash
run: |
cd $GITHUB_WORKSPACE/zombienet-tool/javascript
yarn
npm run build
pm2 start packages/cli/dist/cli.js --name zombienet \
--output $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stdout.log \
--error $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stderr.log \
-- spawn --provider native $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml
- name: run stress test
run: |
sleep 720
cd $GITHUB_WORKSPACE/Manta/tests
yarn install
yarn
yarn stress_benchmark_test --address=ws://127.0.0.1:9921 --exit
- name: stop testnet
run: |
cd $GITHUB_WORKSPACE/zombienet-tool
pm2 stop zombienet
- if: always()
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.chain-spec.id }}-alice-stress.log
path: $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stdout.log
- name: launch testnet
shell: bash
run: |
cd $GITHUB_WORKSPACE/zombienet-tool/javascript
yarn
npm run build
pm2 start packages/cli/dist/cli.js --name zombienet \
--output $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stdout.log \
--error $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stderr.log \
-- spawn --provider native $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml
- name: run farming test
run: |
sleep 120
cd $GITHUB_WORKSPACE/Manta/tests
yarn install
yarn
yarn test_farming --address=ws://127.0.0.1:9921 --exit
- name: stop testnet
run: |
cd $GITHUB_WORKSPACE/zombienet-tool
pm2 stop zombienet
- if: always()
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.chain-spec.id }}-alice-stress.log
path: $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stdout.log
docker-image-test:
timeout-minutes: 120
if: contains(github.event.pull_request.labels.*.name, 'A-calamari')
needs: [build-node-current]
runs-on: ubuntu-20.04
strategy:
matrix:
runtime:
- name: calamari
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- name: fetch manta
uses: actions/download-artifact@v2
with:
name: manta
- name: build docker image
run: |
mv manta docker/manta
cd docker/
chmod +x manta
GIT_TAG=${{ github.event.release.tag_name }}
BINARY_NAME=manta
ln -s ${{ matrix.runtime.name }}.Dockerfile Dockerfile
docker build \
--build-arg PARA_BINARY_REF=${GIT_TAG} \
--build-arg PARA_BINARY_URL=manta \
--tag ${{ matrix.runtime.name }} ./
- name: run docker image
run: |
sudo docker run -p 9944:9944 -p 9945:9945 -d ${{ matrix.runtime.name }} --unsafe-rpc-external -- --unsafe-rpc-external > docker_id.log
sleep 60
- name: Show log
run: |
echo "Get the docker container ID:"
image_id=`cat docker_id.log`
echo $image_id
echo "Adjusting permissions so we can access docker logs..."
sudo cat /var/lib/docker/containers/${image_id}/${image_id}-json.log
- uses: actions/checkout@v2
with:
repository: Manta-Network/Dev-Tools
path: dev-tools
- name: check if target block is finalized
run: |
cd dev-tools/check-finalized-block
npm install -g yarn
yarn install
yarn
node index.js --para_address=ws://127.0.0.1:9944 --relay_address=ws://127.0.0.1:9945 --target_block=6
if [ $? == 1 ]; then echo "Failed to finalize the target block - 6"; exit 1; fi