-
Notifications
You must be signed in to change notification settings - Fork 51
793 lines (737 loc) · 30.2 KB
/
release.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
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
name: CI
on:
pull_request:
push:
branches:
- master
- perm-*
jobs:
set-tags:
runs-on: ubuntu-latest
outputs:
image_exists: ${{ steps.check-docker-image.outputs.image_exists }}
git_ref: ${{ steps.check-git-ref.outputs.git_ref }}
sha: ${{ steps.get-sha.outputs.sha }}
sha8: ${{ steps.get-sha.outputs.sha8 }}
latest_rt: ${{ steps.get-sha.outputs.latest_rt }}
latest_rt_sha8: ${{ steps.get-sha.outputs.latest_rt_sha8 }}
steps:
- name: Check git ref
id: check-git-ref
# if PR
# else if manual PR
# else (push)
run: |
if [[ -n "${{ github.event.pull_request.head.sha }}" ]]; then
echo "git_branch=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_OUTPUT
echo "git_ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
elif [[ -n "${{ github.event.inputs.pull_request }}" ]]; then
echo "git_branch=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_OUTPUT
echo "git_ref=refs/pull/${{ github.event.inputs.pull_request }}/head" >> $GITHUB_OUTPUT
else
echo "git_branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
echo "git_ref=$GITHUB_REF" >> $GITHUB_OUTPUT
fi
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ steps.check-git-ref.outputs.git_ref }}
- name: Get Latest RT Release
id: get-latest-rt
run: |
LATEST_RUNTIME_RELEASE=$(curl -s https://api.github.com/repos/moondance-labs/tanssi/releases | jq -r '.[] | select(.name | test("runtime";"i")) | .tag_name' | head -n 1 | tr -d '[:blank:]') && [[ ! -z "${LATEST_RUNTIME_RELEASE}" ]]
echo $LATEST_RUNTIME_RELEASE
echo "latest_rt=$LATEST_RUNTIME_RELEASE" >> $GITHUB_OUTPUT
- name: Get Sha
id: get-sha
run: |
echo "sha=$(git log -1 --format='%H')" >> $GITHUB_OUTPUT
echo "sha8=$(git log -1 --format='%H' | cut -c1-8)" >> $GITHUB_OUTPUT
ENDPOINT="https://api.github.com/repos/moondance-labs/tanssi/git/refs/tags/${{ steps.get-latest-rt.outputs.latest_rt }}"
RESPONSE=$(curl -s -H "Accept: application/vnd.github.v3+json" $ENDPOINT)
TYPE=$(echo $RESPONSE | jq -r '.object.type')
if [[ $TYPE == "commit" ]]
then
LATEST_RT_SHA8=$(echo $RESPONSE | jq -r '.object.sha' | cut -c -8)
elif [[ $TYPE == "tag" ]]
then
URL=$(echo $RESPONSE | jq -r '.object.url')
TAG_RESPONSE=$(curl -s -H "Accept: application/vnd.github.v3+json" $URL)
TAG_RESPONSE_CLEAN=$(echo $TAG_RESPONSE | tr -d '\000-\037')
LATEST_RT_SHA8=$(echo $TAG_RESPONSE_CLEAN | jq -r '.object.sha' | cut -c -8)
fi
echo $LATEST_RT_SHA8
echo "latest_rt_sha8=$LATEST_RT_SHA8" >> $GITHUB_OUTPUT
- name: Check existing docker image
id: check-docker-image
run: |
TAG=sha-${{ steps.get-sha.outputs.sha8 }}
echo "image_exists=$(docker image inspect moondancelabs/tanssi:$TAG > /dev/null && echo "true" || echo "false")" >> $GITHUB_OUTPUT
- name: Display variables
run: |
echo git_ref: ${{ steps.check-git-ref.outputs.git_ref }}
echo sha: ${{ steps.get-sha.outputs.sha }}
echo sha8: ${{ steps.get-sha.outputs.sha8 }}
echo image_exists: ${{ steps.check-docker-image.outputs.image_exists }}
echo latest_rt: ${{ steps.get-latest-rt.outputs.latest_rt }}
echo latest_rt_sha8: ${{ steps.get-sha.outputs.latest_rt_sha8 }}
check-copyright:
runs-on: ubuntu-latest
needs: ["set-tags"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Find un-copyrighted files
run: |
find . \! -name '*.expanded.rs' -name '*.rs' -exec grep -H -E -o -c Copyright {} \; | grep ':0' || true
FILECOUNT=$(find . \! -name '*.expanded.rs' -name '*.rs' -exec grep -H -E -o -c Copyright {} \; | grep -c ':0' || true)
if [[ $FILECOUNT -eq 0 ]]; then
true
else
false
fi
check-rust-fmt:
name: "Check with rustfmt"
runs-on: ubuntu-latest
needs: ["set-tags"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
# With rustup's nice new toml format, we just need to run rustup show to install the toolchain
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659
- name: Setup Rust toolchain
run: rustup show
- name: Format code with rustfmt
run: cargo fmt --all --check
####### Static Analyses #######
cargo-clippy:
runs-on: self-hosted
needs: ["set-tags"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Setup Rust toolchain
run: rustup show
- name: Check for duplicate git dependencies
run: ./.github/scripts/check_duplicate_git_dependencies.sh
- name: Find toml files with lints key not set
run: ./.github/scripts/check_toml_lints.sh
- name: Clippy
run: SKIP_WASM_BUILD=1 cargo clippy --all-targets --locked --workspace --features try-runtime,runtime-benchmarks
cargo-toml-feature-propagation:
runs-on: ubuntu-latest
needs: ["set-tags"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Setup Rust toolchain
run: rustup show
- name: Install zepter
run: cargo install --locked -f zepter --version 1.1.0
- name: Run zepter
run: zepter run check
toml-formatting:
runs-on: ubuntu-latest
needs: ["set-tags"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Setup Rust toolchain
run: rustup show
- name: Install toml-maid
run: cargo install --locked -f toml-maid
- name: Run toml-maid
run: toml-maid --check
typescript-formatting:
runs-on: ubuntu-latest
needs: ["set-tags"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 9
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: "Formatting check"
run: |
cd test
pnpm install
pnpm run fmt
typescript-linting:
runs-on: ubuntu-latest
needs: ["set-tags"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 9
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: "Linting check"
run: |
cd test
pnpm install
pnpm run lint
####### Building and Testing binaries #######
build:
runs-on: self-hosted
needs: ["set-tags"]
env:
TMP_TARGET: "/tmp/target"
CARGO_TARGET_DIR: "target"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Setup Variables
shell: bash
run: |
echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "SCCACHE_CACHE_SIZE=100GB" >> $GITHUB_ENV
# Set RUSTFLAGS if not already set
if [ -z "$RUSTFLAGS" ]; then
echo "RUSTFLAGS=-C opt-level=3 -D warnings -C linker=clang -C link-arg=-fuse-ld=$(pwd)/mold/bin/mold" >> $GITHUB_ENV
fi
- name: Setup Mold Linker
shell: bash
run: |
mkdir -p mold
curl -L --retry 10 --silent --show-error https://github.com/rui314/mold/releases/download/v2.30.0/mold-2.30.0-$(uname -m)-linux.tar.gz | tar -C $(realpath mold) --strip-components=1 -xzf -
- name: Setup Rust toolchain
run: rustup show
- name: Build
run: cargo build --features=fast-runtime --release --all
- name: Save runtime wasm
run: |
mkdir -p runtimes
cp $CARGO_TARGET_DIR/release/wbuild/container-chain-template-simple-runtime/container_chain_template_simple_runtime.compact.compressed.wasm runtimes/;
cp $CARGO_TARGET_DIR/release/wbuild/container-chain-template-frontier-runtime/container_chain_template_frontier_runtime.compact.compressed.wasm runtimes/;
cp $CARGO_TARGET_DIR/release/wbuild/dancebox-runtime/dancebox_runtime.compact.compressed.wasm runtimes/;
cp $CARGO_TARGET_DIR/release/wbuild/flashbox-runtime/flashbox_runtime.compact.compressed.wasm runtimes/;
- name: Upload runtimes
uses: actions/upload-artifact@v4
with:
name: runtimes
path: runtimes
- name: Save tanssi and template binaries
run: |
mkdir -p binaries
cp $CARGO_TARGET_DIR/release/tanssi-node binaries/tanssi-node;
cp $CARGO_TARGET_DIR/release/tanssi-relay binaries/tanssi-relay;
cp $CARGO_TARGET_DIR/release/tanssi-relay-prepare-worker binaries/tanssi-relay-prepare-worker;
cp $CARGO_TARGET_DIR/release/tanssi-relay-execute-worker binaries/tanssi-relay-execute-worker;
cp $CARGO_TARGET_DIR/release/container-chain-frontier-node binaries/container-chain-frontier-node;
cp $CARGO_TARGET_DIR/release/container-chain-simple-node binaries/container-chain-simple-node;
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: binaries
path: binaries
rust-test:
runs-on: self-hosted
needs: ["set-tags", "build"]
env:
TMP_TARGET: "/tmp/target"
CARGO_TARGET_DIR: "target"
RUSTC_WRAPPER: "sccache"
CARGO_INCREMENTAL: "0"
SCCACHE_CACHE_SIZE: "100GB"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Setup Variables
shell: bash
run: |
echo "RUSTFLAGS=-C opt-level=3 -D warnings -C linker=clang -C link-arg=-fuse-ld=$(pwd)/mold/bin/mold" >> $GITHUB_ENV
- name: Setup Mold Linker
shell: bash
run: |
mkdir -p mold
curl -L --retry 10 --silent --show-error https://github.com/rui314/mold/releases/download/v2.30.0/mold-2.30.0-$(uname -m)-linux.tar.gz | tar -C $(realpath mold) --strip-components=1 -xzf -
- name: Setup Rust toolchain
run: rustup show
- name: Unit tests
run: cargo test --release --all
- name: Run sccache stat for check pre test
run: ${SCCACHE_PATH} --show-stats
check-api-augment:
runs-on: ubuntu-latest
needs: ["set-tags", "build"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 9
- name: "Download binaries"
uses: actions/download-artifact@v4
with:
name: binaries
path: target/release
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: "Generate Local interfaces"
run: |
chmod uog+x target/release/tanssi-node
cd typescript-api
pnpm install
pnpm create-local-interfaces
- name: Check for changes
run: |
git diff --exit-code || (echo "There are uncommitted changes after running typegen script.\n Please make sure to run the command before pushing." && exit 1)
typescript-tests:
runs-on: ubuntu-latest
needs: ["set-tags", "build"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 9
- name: "Download binaries"
uses: actions/download-artifact@v4
with:
name: binaries
path: target/release
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: "Generate typescript api"
run: |
chmod uog+x target/release/tanssi-node
cd typescript-api
pnpm install
pnpm create-local-interfaces
- name: "Run Dev tests"
run: |
chmod uog+x target/release/tanssi-node
cd test
pnpm moonwall test dev_tanssi
typescript-tests-flashbox:
runs-on: ubuntu-latest
needs: ["set-tags", "build"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 9
- name: "Download binaries"
uses: actions/download-artifact@v4
with:
name: binaries
path: target/release
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: "Generate typescript api"
run: |
chmod uog+x target/release/tanssi-node
cd typescript-api
pnpm install
pnpm create-local-interfaces
- name: "Run Flashbox tests"
run: |
chmod uog+x target/release/tanssi-node
cd test
pnpm moonwall test dev_flashbox
typescript-tests-frontier:
runs-on: ubuntu-latest
needs: ["set-tags", "build"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 9
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: "Download binaries"
uses: actions/download-artifact@v4
with:
name: binaries
path: target/release
- name: "Generate typescript api"
run: |
chmod uog+x target/release/tanssi-node
cd typescript-api
pnpm install
pnpm create-local-interfaces
- name: "Run Frontier tests"
run: |
chmod uog+x target/release/container-chain-frontier-node
cd test
pnpm moonwall test dev_frontier_template
typescript-tests-simple-template:
runs-on: ubuntu-latest
needs: ["set-tags", "build"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 9
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: "Download binaries"
uses: actions/download-artifact@v4
with:
name: binaries
path: target/release
- name: "Generate typescript api"
run: |
chmod uog+x target/release/tanssi-node
cd typescript-api
pnpm install
pnpm create-local-interfaces
- name: "Run Simple Template tests"
run: |
chmod uog+x target/release/container-chain-simple-node
cd test
pnpm moonwall test dev_simple_template
typescript-dancebox-specs:
runs-on: ubuntu-latest
needs: ["set-tags", "build"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 9
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: "Download binaries"
uses: actions/download-artifact@v4
with:
name: binaries
path: target/release
- name: "Install and run upgrade test"
run: |
chmod uog+x target/release/tanssi-node
cd test
pnpm install
pnpm moonwall test dev_dancebox_specs
typescript-tests-relay:
runs-on: ubuntu-latest
needs: ["set-tags", "build"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 9
- name: "Download binaries"
uses: actions/download-artifact@v4
with:
name: binaries
path: target/release
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: "Generate typescript api"
run: |
chmod uog+x target/release/tanssi-node
cd typescript-api
pnpm install
pnpm create-local-interfaces
- name: "Run Dev tests"
run: |
chmod uog+x target/release/tanssi-node
chmod uog+x target/release/tanssi-relay
chmod uog+x target/release/tanssi-relay-execute-worker
chmod uog+x target/release/tanssi-relay-prepare-worker
cd test
pnpm moonwall test dev_tanssi_relay
zombienet-tests:
runs-on: self-hosted
needs: ["set-tags", "build"]
strategy:
fail-fast: false
matrix:
test_name: [zombie_tanssi, zombie_tanssi_parathreads, zombie_tanssi_rotation, zombie_tanssi_warp_sync, zombie_tanssi_relay, zombie_data_preservers]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Run Zombienet Test ${{ matrix.test_name }}
uses: ./.github/workflow-templates/zombienet-tests
with:
test_name: ${{ matrix.test_name }}
chopsticks-upgrade-test:
runs-on:
labels: ubuntu-latest
needs: ["set-tags", "build"]
strategy:
fail-fast: false
matrix:
chains: [
{ chain: "stagenet_dancebox", runtime: "dancebox" },
{ chain: "flashbox", runtime: "flashbox" },
{ chain: "dancebox", runtime: "dancebox" },
{ chain: "frontier_template", runtime: "container-chain-template-frontier" },
]
env:
GH_WORKFLOW_MATRIX_CHAIN: ${{ matrix.chains.chain }}
DEBUG_COLORS: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- uses: pnpm/action-setup@v4.0.0
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: Create local folders
run: |
mkdir -p target/release/wbuild/${{ matrix.chains.runtime }}-runtime/
mkdir -p test/tmp
- name: "Download runtime"
uses: actions/download-artifact@v4
with:
name: runtimes
path: target/release/wbuild/${{ matrix.chains.runtime }}-runtime/
- name: "Install and run upgrade test"
run: |
cd test
pnpm install
pnpm moonwall test chopsticks_${{ matrix.chains.chain }}_upgrade
zombienet-test-upgrade:
runs-on: self-hosted
needs: ["set-tags", "build"]
strategy:
fail-fast: false
matrix:
chain: ["dancebox"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 9
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: Create local folders
run: |
mkdir -p target/release/wbuild/${{ matrix.chain }}-runtime/
mkdir -p test/tmp
- name: "Download binaries"
uses: actions/download-artifact@v4
with:
name: binaries
path: target/release
- name: "Download branch built runtime"
uses: actions/download-artifact@v4
with:
name: runtimes
path: target/release/wbuild/${{ matrix.chain }}-runtime/
- name: Retrieve tanssi binary from docker (for plainSpec generation)
run: |
TANSSI_COMMIT=${{ needs.set-tags.outputs.latest_rt_sha8 }}
DOCKER_TAG="moondancelabs/tanssi:sha-$TANSSI_COMMIT"
docker rm -f tanssi_container 2> /dev/null | true
docker create --name tanssi_container $DOCKER_TAG bash
docker cp tanssi_container:tanssi/tanssi-node test/tmp/tanssi_rt
docker rm -f tanssi_container
- name: "Run zombie upgrade test"
run: |
chmod uog+x target/release/tanssi-node
cd test
pnpm install
chmod uog+x tmp/tanssi_rt
tmp/tanssi_rt build-spec --chain ${{ matrix.chain }}-local > tmp/${{ matrix.chain }}-plain-spec.json
pnpm tsx scripts/modify-plain-specs.ts process tmp/${{ matrix.chain }}-plain-spec.json tmp/${{ matrix.chain }}-modified-spec.json
tmp/tanssi_rt build-spec --chain tmp/${{ matrix.chain }}-modified-spec.json --raw > tmp/${{ matrix.chain }}-raw-spec.json
## Run tests
pnpm moonwall test zombie_${{ matrix.chain }}_upgrade
- name: Zip and Upload Node Logs on Failure
if: failure()
run: |
TIMESTAMP=$(date +%Y%m%d%H%M%S)
export NODE_LOGS_ZIP="node_logs_$TIMESTAMP.zip"
MOST_RECENT_ZOMBIE_DIR=$(ls -td /tmp/zombie-* | head -n 1)
find $MOST_RECENT_ZOMBIE_DIR -maxdepth 1 -type f -name '*.log' -exec zip -r $NODE_LOGS_ZIP {} \;
echo "NODE_LOGS_ZIP=${NODE_LOGS_ZIP}" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
if: failure()
with:
name: failed-node-logs
path: ${{ env.NODE_LOGS_ZIP }}
zombienet-test-upgrade-containers:
runs-on: self-hosted
needs: ["set-tags", "build"]
strategy:
fail-fast: false
matrix:
chains: [
{ chain: "frontier_template", runtime: "container-chain-template-frontier" },
{ chain: "simple_template", runtime: "container-chain-template-simple" },
]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- name: Pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 9
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: Create local folders
run: |
mkdir -p target/release/wbuild/${{ matrix.chains.runtime }}-runtime/
mkdir -p test/tmp
- name: "Download binaries"
uses: actions/download-artifact@v4
with:
name: binaries
path: target/release
- name: "Download runtime"
uses: actions/download-artifact@v4
with:
name: runtimes
path: target/release/wbuild/${{ matrix.chains.runtime }}-runtime/
- name: "Install and run upgrade test"
run: |
cd test
pnpm install
pnpm moonwall test zombie_${{ matrix.chains.chain }}_upgrade
docker-tanssi:
runs-on: ubuntu-latest
needs: ["set-tags", "build"]
strategy:
fail-fast: false
matrix:
image: ["tanssi", "container-chain-simple-template", "container-chain-evm-template"]
if: ${{ (needs.set-tags.outputs.image_exists == 'false') && (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push') }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.set-tags.outputs.git_ref }}
- uses: actions/download-artifact@v4
with:
name: binaries
path: build
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=moondancelabs/${{matrix.image}}
TAGS="${DOCKER_IMAGE}:sha-${{ needs.set-tags.outputs.sha8 }}-fast-runtime"
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver-opts: |
image=moby/buildkit:master
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/${{matrix.image}}.Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.prep.outputs.tags }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}