-
Notifications
You must be signed in to change notification settings - Fork 19
1045 lines (1027 loc) · 40.9 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
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Release
run-name: Cut Release ${{github.event.inputs.release-version || github.ref_name}}
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: false
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # ex. v1.0.0
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" # ex. v1.1.0-rc1
- "v0.0.1" # used for testing only
- "v0.0.1-rc[0-9]+" # used for testing only
workflow_dispatch:
inputs:
release-version:
description: "Release version (v#.#.#[-rc#])"
required: true
permissions:
contents: write
statuses: write
env:
NEW_RELEASE_TAG_FROM_UI: ${{github.event.inputs.release-version}}
NEW_RELEASE_TAG: ${{github.event.inputs.release-version || github.ref_name}}
RELEASE_BRANCH_NAME: release-${{github.event.inputs.release-version || github.ref_name}}
LATEST_FULL_RELEASE_TAG: _LATEST-FULL-RELEASE
TEST_RUN: ${{startsWith(github.event.inputs.release-version || github.ref_name, 'v0.0.1')}}
RUST_TOOLCHAIN: "1.76.0" # Match to /rust-toolchain.toml
jobs:
validate-release-version:
name: Validate Release Version
runs-on: ubuntu-22.04
steps:
- name: Validate
if: env.NEW_RELEASE_TAG_FROM_UI != ''
shell: bash
run: |
version=${{env.NEW_RELEASE_TAG_FROM_UI}}
echo "Release version entered in UI: $version"
regex='^v([0-9]+)\.(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))(-rc[1-9][0-9]*)?$'
if [[ ! $version =~ $regex ]]; then
echo "ERROR: Entered version $version is not valid."
echo "Please use v#.#.#[-rc#] format."
exit 1
fi
create-release-branch:
needs: validate-release-version
name: Create Release Branch
runs-on: ubuntu-22.04
steps:
- name: Check Out Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Release Branch?
id: create-release-branch
run: |
set -x
full_branch=remotes/origin/${{env.RELEASE_BRANCH_NAME}}
branch_hash=$(git rev-parse --verify --quiet $full_branch || echo "")
create_branch=$([ -z $branch_hash ] && echo 'true' || echo 'false')
echo "create_branch: $create_branch"
echo "create=$create_branch" >> $GITHUB_OUTPUT
- name: Create Release Branch
if: steps.create-release-branch.outputs.create == 'true'
run: |
git status -s
git checkout -b ${{env.RELEASE_BRANCH_NAME}}
git push origin ${{env.RELEASE_BRANCH_NAME}} -u
run-all-benchmarks:
needs: create-release-branch
name: Run All Benchmarks
runs-on: [self-hosted, Linux, X64, benchmark]
steps:
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.RELEASE_BRANCH_NAME}}
- name: Full Release?
id: is-full-release
uses: ./.github/workflows/common/is-full-release
with:
version-tag: ${{env.NEW_RELEASE_TAG}}
- name: Install Required Packages
if: steps.is-full-release.outputs.is-full-release == 'true'
run: |
sudo apt-get update
sudo apt install -y protobuf-compiler libclang-dev clang cmake
- name: Install Rust Toolchain
if: steps.is-full-release.outputs.is-full-release == 'true'
# Match installation steps to CI base docker image
run: |
curl https://sh.rustup.rs -sSf | HOME=`pwd` bash -s -- -y
echo "PATH=`pwd`/.cargo/bin:$PATH" >> $GITHUB_ENV
- name: Update Weights for All Pallets
if: steps.is-full-release.outputs.is-full-release == 'true'
run: |
rustup show
make benchmarks
git status -s
git diff
- name: Commit Updated Weights
if: steps.is-full-release.outputs.is-full-release == 'true'
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842
with:
commit_message: "Update weights for release ${{env.NEW_RELEASE_TAG}}"
file_pattern: "pallets/**/*.rs runtime/common/src/weights/*"
version-code:
needs: run-all-benchmarks
name: Version Code
runs-on: ubuntu-22.04
steps:
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.RELEASE_BRANCH_NAME}}
fetch-depth: 0
- name: Version Code
shell: bash
run: |
release_version=${{env.NEW_RELEASE_TAG}}
make version v=${release_version:1}
- name: Print Updated Version
run: |
git status
git diff
- name: Commit Updated Version
id: commit-updated-version
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842
with:
commit_message: "Update versions for release ${{env.NEW_RELEASE_TAG}}"
- name: Update Release Version Tag
uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72
with:
tag: ${{env.NEW_RELEASE_TAG}}
force_push_tag: true
message: "Release version tag"
commit_sha: ${{steps.commit-updated-version.outputs.commit_hash}}
build-binaries:
needs: version-code
name: Build ${{matrix.arch}} Binary for ${{matrix.network}}
strategy:
fail-fast: true
matrix:
network: [dev, local, testnet, mainnet]
arch: [amd64]
include:
- network: dev
spec: frequency-no-relay
build-profile: release
release-file-name-prefix: frequency-dev
- network: local
spec: frequency-local
build-profile: release
release-file-name-prefix: frequency-local
- network: testnet
spec: frequency-testnet
build-profile: release
release-file-name-prefix: frequency-testnet
- network: mainnet
spec: frequency
build-profile: release
release-file-name-prefix: frequency
runs-on: ubicloud-standard-8
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1
env:
SIGNING_SUBKEY_FINGERPRINT: B6327D1474C6392032870E8EFA4FD1E73A0FE707
steps:
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.RELEASE_BRANCH_NAME}}
- name: Set Env Vars
run: |
echo "BIN_DIR=target/${{matrix.build-profile}}" >> $GITHUB_ENV
echo "BUILT_BIN_FILENAME=frequency" >> $GITHUB_ENV
echo "RELEASE_BIN_FILENAME=${{matrix.release-file-name-prefix}}.${{matrix.arch}}" >> $GITHUB_ENV
- name: Compile for ${{matrix.network}}
run: |
CARGO_INCREMENTAL=0 RUSTFLAGS="-D warnings" cargo build \
--locked \
--features ${{matrix.spec}} \
--profile ${{matrix.build-profile}}
- name: Run Sanity Checks
run: |
file ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} && \
${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} --version
- name: Rename Binary
run: |
cp -p ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} \
${{env.BIN_DIR}}/${{env.RELEASE_BIN_FILENAME}}
- name: Generate Binary Hash
working-directory: ${{env.BIN_DIR}}
run: sha256sum ${{env.RELEASE_BIN_FILENAME}} > ${{env.RELEASE_BIN_FILENAME}}.sha256
- name: Import GPG key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4
with:
gpg_private_key: ${{secrets.FREQUENCY_PGP_SECRET_SUBKEYS}}
passphrase: ${{secrets.FREQUENCY_PGP_MASTER_KEY_PASSWORD}}
fingerprint: ${{env.SIGNING_SUBKEY_FINGERPRINT}}
- name: List GPG Keys
run: gpg -k; gpg -K
# The error in this step may be due to expired signing subkey
# See https://github.com/frequency-chain/frequency/issues/1695
- name: Generate Binary Signature
working-directory: ${{env.BIN_DIR}}
run: |
gpg --version
gpg --local-user ${{env.SIGNING_SUBKEY_FINGERPRINT}} \
--sign --armor \
--pinentry-mode=loopback \
--passphrase="${{secrets.FREQUENCY_PGP_MASTER_KEY_PASSWORD}}" \
--detach-sig \
${{env.RELEASE_BIN_FILENAME}}
- name: Verify Binary
working-directory: ${{env.BIN_DIR}}
run: gpg --verify ${{env.RELEASE_BIN_FILENAME}}.asc
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-binary-${{matrix.network}}-${{github.run_id}}
path: |
${{env.BIN_DIR}}/${{env.RELEASE_BIN_FILENAME}}
${{env.BIN_DIR}}/${{env.RELEASE_BIN_FILENAME}}.sha256
${{env.BIN_DIR}}/${{env.RELEASE_BIN_FILENAME}}.asc
if-no-files-found: error
build-runtimes:
needs: version-code
name: Build Runtime for ${{matrix.network}}
outputs:
runtime_filename_dev: ${{steps.set-env-vars.outputs.runtime_filename_dev}}
runtime_filename_paseo: ${{steps.set-env-vars.outputs.runtime_filename_paseo}}
runtime_filename_mainnet: ${{steps.set-env-vars.outputs.runtime_filename_mainnet}}
# env:
# HOME: /root
strategy:
fail-fast: true
matrix:
# Remember, runtimes are separate for each relay chain
# We do not release frequency-*-local runtimes however
network: [dev, paseo, mainnet]
include:
- network: dev
build-profile: release
package: frequency-runtime
runtime-dir: runtime/frequency
built-wasm-file-name-prefix: frequency_runtime
release-wasm-file-name-prefix: frequency-dev_runtime
features: frequency-no-relay
wasm-core-version: frequency-testnet
- network: paseo
build-profile: release
package: frequency-runtime
runtime-dir: runtime/frequency
built-wasm-file-name-prefix: frequency_runtime
release-wasm-file-name-prefix: frequency-paseo_runtime
features: frequency-testnet
wasm-core-version: frequency-testnet
- network: mainnet
build-profile: release
package: frequency-runtime
runtime-dir: runtime/frequency
built-wasm-file-name-prefix: frequency_runtime
release-wasm-file-name-prefix: frequency_runtime
features: frequency
wasm-core-version: frequency
runs-on: ubicloud-standard-8
steps:
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.RELEASE_BRANCH_NAME}}
- name: Install Rust Toolchain
# Match installation steps to CI base docker image
run: |
curl https://sh.rustup.rs -sSf | bash -s -- -y
echo "PATH=$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV
- name: Extract Runtime Spec Version
run: |
echo "RUNTIME_SPEC_VERSION=$(awk '/spec_version:/ {match($0, /[0-9]+/); print substr($0, RSTART, RLENGTH); exit}' \
${{matrix.runtime-dir}}/src/lib.rs)" >> $GITHUB_ENV
- name: Validate Extracted Version
shell: bash
run: |
echo "Runtime Spec Version: ${{env.RUNTIME_SPEC_VERSION}}"
[[ $RUNTIME_SPEC_VERSION == ?(-)+([0-9]) ]] || \
(echo "ERROR: \"${{env.RUNTIME_SPEC_VERSION}}\" is not a valid integer" && exit 1)
- name: Set Env Vars
id: set-env-vars
run: |
echo "WASM_DIR=${{matrix.runtime-dir}}/target/srtool/${{matrix.build-profile}}/wbuild/${{matrix.package}}" >> $GITHUB_ENV
echo "BUILT_WASM_FILENAME=${{matrix.built-wasm-file-name-prefix}}.compact.compressed.wasm" >> $GITHUB_ENV
release_wasm_filename=${{matrix.release-wasm-file-name-prefix}}-v${{env.RUNTIME_SPEC_VERSION}}.${{env.NEW_RELEASE_TAG}}.compact.compressed.wasm
echo "RELEASE_WASM_FILENAME=$release_wasm_filename" >> $GITHUB_ENV
echo "runtime_filename_${{matrix.network}}=$release_wasm_filename" >> $GITHUB_OUTPUT
- name: Build Deterministic WASM
id: srtool_build
uses: ./.github/workflows/common/srtool
env:
BUILD_OPTS: "--features on-chain-release-build,no-metadata-docs,${{matrix.features}}"
with:
profile: ${{matrix.build-profile}}
package: ${{matrix.package}}
chain: ${{matrix.chain}}
tag: "1.77.0"
runtime_dir: ${{ matrix.runtime-dir }}
- name: Rename WASM file
run: |
cp -p ${{ steps.srtool_build.outputs.wasm_compressed }} \
./${{env.WASM_DIR}}/${{env.RELEASE_WASM_FILENAME}}
- name: Install Subwasm
run: |
cargo install --locked --git https://github.com/chevdor/subwasm --tag v0.20.0 --force
subwasm --version
- name: Test WASM file
run: |
file ${{env.WASM_DIR}}/${{env.RELEASE_WASM_FILENAME}}
subwasm info ${{env.WASM_DIR}}/${{env.RELEASE_WASM_FILENAME}}
subwasm info ${{env.WASM_DIR}}/${{env.RELEASE_WASM_FILENAME}} | grep "Core version:.*${{matrix.wasm-core-version}}-${{env.RUNTIME_SPEC_VERSION}}" || \
(echo "ERROR: WASM Core version didn't match ${{matrix.wasm-core-version}}-${{env.RUNTIME_SPEC_VERSION}}" && exit 1)
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: artifacts-wasm-${{matrix.network}}-${{github.run_id}}
path: ${{env.WASM_DIR}}/${{env.RELEASE_WASM_FILENAME}}
if-no-files-found: error
build-rust-developer-docs:
needs: version-code
name: Build Rust Developer Docs
runs-on: ubicloud-standard-4
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1
steps:
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.RELEASE_BRANCH_NAME}}
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build Docs
run: |
RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo doc --no-deps --workspace --features frequency
- name: Fix file permissions
shell: sh
run: |
chmod -c -R +rX "target/doc" |
while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload Docs
uses: actions/upload-pages-artifact@v3
with:
path: ./target/doc
build-js-api-augment:
needs: build-binaries
name: Build JS API Augment
env:
NETWORK: local
BUILD_PROFILE: release
BIN_DIR: target/release
RELEASE_FILENAME_PREFIX: frequency-local
ARCH: amd64
runs-on: ubuntu-22.04
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1
steps:
- name: Set Env Vars
run: |
echo "BIN_DIR=target/${{env.BUILD_PROFILE}}" >> $GITHUB_ENV
echo "RELEASE_BIN_FILENAME=${{env.RELEASE_FILENAME_PREFIX}}.${{env.ARCH}}" >> $GITHUB_ENV
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.RELEASE_BRANCH_NAME}}
- name: Set up NodeJs
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: js/api-augment/package-lock.json
- name: Install
run: npm install # DO NOT use `npm ci` as we want the latest polkadot/api possible
working-directory: js/api-augment
- name: Download Binaries
id: download-binaries
uses: actions/download-artifact@v4
with:
pattern: artifacts-binary-${{env.NETWORK}}-${{github.run_id}}
path: .
- name: Extract and List Downloaded Binaries
run: |
download_dir=${{steps.download-binaries.outputs.download-path}}
mv "${download_dir}"/artifacts*/* "${download_dir}"
echo "Download dir: $download_dir"
echo "Downloaded binaries: $(ls -l $download_dir)"
- name: Move Binary to Target Dir
run: |
mkdir -p ${{env.BIN_DIR}}
mv ${{env.RELEASE_BIN_FILENAME}} ${{env.BIN_DIR}}
chmod 755 ${{env.BIN_DIR}}/${{env.RELEASE_BIN_FILENAME}}
- name: Output Metadata
run: ${{env.BIN_DIR}}/${{env.RELEASE_BIN_FILENAME}} export-metadata --chain=frequency-paseo-local --tmp ./js/api-augment/metadata.json
- name: Build
run: npm run build
working-directory: js/api-augment
- name: Upload Dist Dir
uses: actions/upload-artifact@v4
with:
name: js-api-augment-${{github.run_id}}
path: js/api-augment/dist
if-no-files-found: error
test-version-matches-release:
needs: build-binaries
name: Test Version Matches Release
strategy:
fail-fast: true
matrix:
os: [ubuntu-22.04]
network: [mainnet]
include:
- network: mainnet
spec: frequency
build-profile: release
release-file-name-prefix: frequency
- os: ubuntu-22.04
arch: amd64
runs-on: ${{matrix.os}}
steps:
- name: Set Env Vars
run: |
echo "BIN_DIR=target/${{matrix.build-profile}}" >> $GITHUB_ENV
echo "BUILT_BIN_FILENAME=frequency" >> $GITHUB_ENV
echo "RELEASE_BIN_FILENAME=${{matrix.release-file-name-prefix}}.${{matrix.arch}}" >> $GITHUB_ENV
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.RELEASE_BRANCH_NAME}}
fetch-depth: 0
- name: Download Binaries
id: download-binaries
uses: actions/download-artifact@v4
with:
pattern: artifacts-binary-${{matrix.network}}-${{github.run_id}}
path: .
- name: Extract and List Downloaded Binaries
run: |
download_dir=${{steps.download-binaries.outputs.download-path}}
mv "${download_dir}"/artifacts*/* "${download_dir}"
echo "Download dir: $download_dir"
echo "Downloaded binaries: $(ls -l $download_dir)"
- name: Move Binary to Target Dir
run: |
mkdir -p ${{env.BIN_DIR}}
mv ${{env.RELEASE_BIN_FILENAME}} ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}}
chmod +x ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}}
- name: Testing Version Match
if: env.TEST_RUN != 'true'
shell: bash
run: |
EXPECTED_VERSION="${{env.NEW_RELEASE_TAG}}+polkadot$(make version-polkadot)"
ACTUAL_VERSION="v$(${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} --version | cut -d " " -f 2)"
echo "Expected: ${EXPECTED_VERSION}"
echo " Actual: ${ACTUAL_VERSION%-*}"
[[ ${ACTUAL_VERSION%-*} == ${EXPECTED_VERSION} ]]
# Could not port this job to container because the reference node will be started in a
# parallel container to the job polkadot-js-tools container and the latter will not
# be able to connect to the former without runner supporting DinD mode first.
# See https://github.com/frequency-chain/frequency/issues/1543
compare-metadata:
needs: build-binaries
name: Compare Metadata
runs-on: ubuntu-22.04
env:
NETWORK: mainnet
BIN_DIR: target/release
BIN_FILENAME: frequency.amd64
TEST_BIN_FILENAME: frequency.amd64
TEST_DOWNLOAD_DIR: download-test
REF_BIN_FILENAME: frequency-ref.amd64
REF_DOWNLOAD_DIR: download-ref
OUTPUT_DIR: target/release
FREQUENCY_PROCESS_NAME: frequency
steps:
- name: Set Env Vars
run: |
echo "OUTPUT_FILENAME=metadata-compare-$NETWORK.txt" >> $GITHUB_ENV
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.RELEASE_BRANCH_NAME}}
fetch-depth: 0
- name: Get Previous Full Release Version
id: get-previous-full-release-version
uses: ./.github/workflows/common/get-previous-full-release-version
with:
full-release-version-tag: ${{env.LATEST_FULL_RELEASE_TAG}}
- name: Fetch Reference Binary
uses: robinraju/release-downloader@c39a3b234af58f0cf85888573d361fb6fa281534
with:
tag: ${{steps.get-previous-full-release-version.outputs.version}}
fileName: ${{env.BIN_FILENAME}}
out-file-path: ${{env.REF_DOWNLOAD_DIR}}
- name: Download Test Binary
id: download-binaries
uses: actions/download-artifact@v4
with:
pattern: artifacts-binary-${{env.NETWORK}}-${{github.run_id}}
path: ${{env.TEST_DOWNLOAD_DIR}}
- name: Rename and Move Binaries
run: |
download_dir=${{steps.download-binaries.outputs.download-path}}
mv "${download_dir}"/artifacts*/* "${download_dir}"
echo "Download dir: $download_dir"
echo "Downloaded binaries: $(ls -l $download_dir)"
mkdir -p ${{env.BIN_DIR}}
mv ${{env.REF_DOWNLOAD_DIR}}/${{env.BIN_FILENAME}} ${{env.BIN_DIR}}/${{env.REF_BIN_FILENAME}}
mv ${{env.TEST_DOWNLOAD_DIR}}/${{env.BIN_FILENAME}} ${{env.BIN_DIR}}/${{env.TEST_BIN_FILENAME}}
- name: Set Binary Permissions
working-directory: ${{env.BIN_DIR}}
run: |
chmod 755 $TEST_BIN_FILENAME
chmod 755 $REF_BIN_FILENAME
- name: Docker network
run: docker network create net-${{env.RELEASE_BRANCH_NAME}}
- name: Start Test Node
working-directory: ${{env.BIN_DIR}}
run: |
docker run -d --rm --net=net-${{env.RELEASE_BRANCH_NAME}} \
-v `pwd`:/app \
--name test-node \
ubuntu:22.04 \
/bin/sh -c "chmod +x /app/${{env.TEST_BIN_FILENAME}} && /app/${{env.TEST_BIN_FILENAME}} \
--chain=frequency-bench \
--rpc-external \
--rpc-cors=all \
--rpc-methods=Unsafe \
--no-telemetry \
--no-prometheus \
--reserved-only \
--no-hardware-benchmarks \
--tmp \
-- \
--reserved-only"
- name: Start Reference Node
working-directory: ${{env.BIN_DIR}}
run: |
docker run -d --rm --net=net-${{env.RELEASE_BRANCH_NAME}} \
-v `pwd`:/app \
--name ref-node \
ubuntu:22.04 \
/bin/sh -c "chmod +x /app/${{env.REF_BIN_FILENAME}} && /app/${{env.REF_BIN_FILENAME}} \
--chain=frequency-bench \
--rpc-external \
--rpc-cors=all \
--rpc-methods=Unsafe \
--no-telemetry \
--no-prometheus \
--reserved-only \
--no-hardware-benchmarks \
--tmp \
-- \
--reserved-only"
- name: Prepare Output
working-directory: ${{env.OUTPUT_DIR}}
run: |
REF_VERSION=$(./${{env.REF_BIN_FILENAME}} --version)
BIN_VERSION=$(./${{env.TEST_BIN_FILENAME}} --version)
echo "Metadata comparison against previous full release:" >> ${{env.OUTPUT_FILENAME}}
echo "Date: $(date)" >> ${{env.OUTPUT_FILENAME}}
echo "Ref. version: $REF_VERSION" >> ${{env.OUTPUT_FILENAME}}
echo "Test version: $BIN_VERSION" >> ${{env.OUTPUT_FILENAME}}
echo "----------------------------------------------------------------------" >> ${{env.OUTPUT_FILENAME}}
- name: Compare Metadata
timeout-minutes: 10
run: |
CMD="docker run --pull always --net=net-${{env.RELEASE_BRANCH_NAME}} jacogr/polkadot-js-tools:0.57.1 metadata ws://ref-node:9944 ws://test-node:9944"
echo -e "Running:\n$CMD"
$CMD >> ${{env.OUTPUT_DIR}}/${{env.OUTPUT_FILENAME}}
cat ${{env.OUTPUT_DIR}}/${{env.OUTPUT_FILENAME}} | egrep -n -i ''
SUMMARY=$(./tools/ci/scripts/extrinsic-ordering-filter.sh ${{env.OUTPUT_DIR}}/${{env.OUTPUT_FILENAME}})
echo -e "$SUMMARY"
echo -e "$SUMMARY" >> ${{env.OUTPUT_DIR}}/${{env.OUTPUT_FILENAME}}
- name: Show Result
working-directory: ${{env.OUTPUT_DIR}}
run: |
cat ${{env.OUTPUT_FILENAME}}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: artifacts-metadata-${{github.run_id}}
path: ${{env.OUTPUT_DIR}}/${{env.OUTPUT_FILENAME}}
if-no-files-found: error
- name: Stop Local Nodes
if: always()
run: |
echo "Attempting to kill all frequency processes..."
docker stop ref-node || true
docker stop test-node || true
docker network rm net-${{env.RELEASE_BRANCH_NAME}}
wait-for-all-builds:
needs:
[
build-binaries,
build-runtimes,
compare-metadata,
test-version-matches-release,
build-rust-developer-docs,
build-js-api-augment,
]
name: Wait for All Builds to Finish
runs-on: ubuntu-22.04
outputs:
runtime_filename_dev: ${{needs.build-runtimes.outputs.runtime_filename_dev}}
runtime_filename_mainnet: ${{needs.build-runtimes.outputs.runtime_filename_mainnet}}
runtime_filename_paseo: ${{needs.build-runtimes.outputs.runtime_filename_paseo}}
steps:
- name: Proceed Forward
run: echo "All build jobs have finished, proceeding with the release"
release-artifacts:
needs: wait-for-all-builds
name: Release Built Artifacts
runs-on: ubuntu-22.04
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1
permissions:
contents: write
steps:
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.RELEASE_BRANCH_NAME}}
fetch-depth: 0
- name: Full Release?
id: is-full-release
uses: ./.github/workflows/common/is-full-release
with:
version-tag: ${{env.NEW_RELEASE_TAG}}
- name: Get Previous Full Release Version
id: get-previous-full-release-version
uses: ./.github/workflows/common/get-previous-full-release-version
with:
full-release-version-tag: ${{env.LATEST_FULL_RELEASE_TAG}}
- name: Set Env Vars
run: |
echo "PREVIOUS_RELEASE_TAG=${{steps.get-previous-full-release-version.outputs.version}}" >> $GITHUB_ENV
- name: Install Tera CLI
run: |
cargo install --locked --git https://github.com/chevdor/tera-cli
echo "PATH=$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV
- name: Verify Tera CLI Install
run: |
which tera
tera --version
- name: Build Changelog
id: build-changelog
uses: mikepenz/release-changelog-builder-action@f3fc77b47b74e78971fffecb2102ae6eac9a44d6
env:
GITHUB_TOKEN: ${{ github.token }}
with:
fromTag: ${{env.PREVIOUS_RELEASE_TAG}}
toTag: ${{env.NEW_RELEASE_TAG}}
configurationJson: |
{
"categories": [
{
"title": "### Breaking Changes|n|",
"labels": ["change/breaking"]
},
{
"title": "### Major Changes|n|",
"labels": ["change/major"]
},
{
"title": "### Storage Migrations|n|",
"labels": ["change/storage-migration"]
}
],
"template": "#{{CHANGELOG}}|n||n|### Additional Changes|n||n| #{{UNCATEGORIZED}}",
"pr_template": "- #{{TITLE}} ##{{NUMBER}}",
"empty_template": "- No changes",
"transformers": [
{
"pattern": "- (.*)",
"target": "- $1|n|"
}
]
}
- name: Sanitize Changelog
id: sanitize-changelog
shell: bash
env:
CHANGELOG: ${{steps.build-changelog.outputs.changelog}}
run: |
echo "-------------------------------------------------"
clean="${CHANGELOG//[\`\[\]$'\n']/}"
echo "sanitized: $clean"
echo "sanitized=$clean" >> $GITHUB_OUTPUT
- name: Get Polkadot Version
id: polkadot-version
run: echo "version=$(make version-polkadot)" >> $GITHUB_OUTPUT
- name: Download Artifacts
id: download
uses: actions/download-artifact@v4
with:
pattern: artifacts-*-${{github.run_id}}
path: /tmp
merge-multiple: true
- name: List Downloaded Artifacts
working-directory: /tmp
run: |
ls -la
- name: Install subwasm
run: |
cargo install --locked --git https://github.com/chevdor/subwasm --tag v0.19.1 --force
subwasm --version
- name: Get Runtimes Info
id: get-runtimes-info
working-directory: /tmp
# Do NOT produce the dev version. That doesn't need to be part of the release notes, just in the artifacts
run: |
runtime_filename_paseo=${{needs.wait-for-all-builds.outputs.runtime_filename_paseo}}
runtime_info_paseo=$(subwasm info $runtime_filename_paseo | sed -Ez '$ s/\n+$//' | tr '\n' '|')
echo "runtime_info_paseo=$runtime_info_paseo" >> $GITHUB_OUTPUT
runtime_filename_mainnet=${{needs.wait-for-all-builds.outputs.runtime_filename_mainnet}}
runtime_info_mainnet=$(subwasm info $runtime_filename_mainnet | sed -Ez '$ s/\n+$//' | tr '\n' '|')
echo "runtime_info_mainnet=$runtime_info_mainnet" >> $GITHUB_OUTPUT
- name: Generate Release Notes
working-directory: tools/ci/release-notes
env:
CHANGELOG: ${{steps.sanitize-changelog.outputs.sanitized}}
RUNTIME_INFO_PASEO: ${{steps.get-runtimes-info.outputs.runtime_info_paseo}}
RUNTIME_INFO_MAINNET: ${{steps.get-runtimes-info.outputs.runtime_info_mainnet}}
IS_FULL_RELEASE: ${{steps.is-full-release.outputs.is-full-release}}
run: |
./build-release-notes.sh '${{steps.polkadot-version.outputs.version}}' \
"${CHANGELOG}" \
"${RUNTIME_INFO_MAINNET}" \
"${RUNTIME_INFO_PASEO}" \
"${IS_FULL_RELEASE}" \
"/tmp/metadata-compare-mainnet.txt" \
> release-notes.md
- name: Publish Release Candidate on GitHub
if: steps.is-full-release.outputs.is-full-release != 'true'
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191
with:
name: "[Release Candidate] ${{env.NEW_RELEASE_TAG}}"
prerelease: true
body_path: tools/ci/release-notes/release-notes.md
tag_name: ${{env.NEW_RELEASE_TAG}}
files: |
/tmp/frequency*.*
/tmp/metadata-compare-*
- name: Publish Full Release on GitHub
if: steps.is-full-release.outputs.is-full-release == 'true'
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564
with:
body_path: tools/ci/release-notes/release-notes.md
tag_name: ${{env.NEW_RELEASE_TAG}}
files: |
/tmp/frequency*.*
/tmp/metadata-compare-*
- name: Get Latest Commit
id: get-latest-commit
run: |
set -x
latest_commit_sha=$(git rev-parse HEAD)
echo "sha=$latest_commit_sha" >> $GITHUB_OUTPUT
- name: Update Git Latest Tag
if: |
steps.is-full-release.outputs.is-full-release == 'true' &&
env.TEST_RUN != 'true'
uses: rickstaa/action-create-tag@88dbf7ff6fe2405f8e8f6c6fdfd78829bc631f83
with:
commit_sha: ${{steps.get-latest-commit.outputs.sha}}
tag: ${{env.LATEST_FULL_RELEASE_TAG}}
force_push_tag: true
message: Latest full release
- name: Dispatch Auto-signer Workflow
if: env.TEST_RUN != 'true'
uses: actions/github-script@v7
with:
github-token: ${{secrets.GHA_WORKFLOW_TRIGGER}}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'frequency-chain',
repo: 'metadata-portal',
workflow_id: 'auto-sign.yml',
ref: 'main'
})
release-node-images:
needs: wait-for-all-builds
name: Release ${{matrix.arch}} Node Docker Image for ${{matrix.network}}
strategy:
fail-fast: true
matrix:
arch: [amd64]
network: [testnet, mainnet]
include:
- network: testnet
build-profile: release
release-file-name-prefix: frequency-testnet
- network: mainnet
build-profile: release
release-file-name-prefix: frequency
- arch: amd64
docker-platform: linux/amd64
env:
DOCKER_HUB_PROFILE: frequencychain
IMAGE_NAME: parachain-node
runs-on: ubuntu-22.04
steps:
- name: Set Env Vars
run: |
echo "BIN_DIR=target/${{matrix.build-profile}}" >> $GITHUB_ENV
echo "BUILT_BIN_FILENAME=frequency" >> $GITHUB_ENV
echo "RELEASE_BIN_FILENAME=${{matrix.release-file-name-prefix}}.${{matrix.arch}}" >> $GITHUB_ENV
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.RELEASE_BRANCH_NAME}}
- name: Full Release?
id: is-full-release
uses: ./.github/workflows/common/is-full-release
with:
version-tag: ${{env.NEW_RELEASE_TAG}}
- name: Download Binaries
id: download-binaries
uses: actions/download-artifact@v4
with:
pattern: artifacts-binary-${{matrix.network}}-${{github.run_id}}
path: .
- name: Extract and List Downloaded Binaries
run: |
download_dir=${{steps.download-binaries.outputs.download-path}}
mv "${download_dir}"/artifacts*/* "${download_dir}"
echo "Download dir: $download_dir"
echo "Downloaded binaries: $(ls -l $download_dir)"
- name: Move Binary to Target Dir
run: |
mkdir -p ${{env.BIN_DIR}}
mv ${{env.RELEASE_BIN_FILENAME}} ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}}
chmod +x ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{matrix.arch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
- name: Build and Push Parachain Image
uses: docker/build-push-action@v6
with:
context: .
platforms: ${{matrix.docker-platform}}
push: ${{env.TEST_RUN != 'true'}}
file: ./docker/${{env.IMAGE_NAME}}.dockerfile
tags: |
${{env.DOCKER_HUB_PROFILE}}/${{env.IMAGE_NAME}}-${{matrix.network}}:${{env.NEW_RELEASE_TAG}}
- name: Update DockerHub Latest Tag
if: steps.is-full-release.outputs.is-full-release == 'true'
uses: docker/build-push-action@v6
with:
context: .
platforms: ${{matrix.docker-platform}}
push: ${{env.TEST_RUN != 'true'}}
file: ./docker/${{env.IMAGE_NAME}}.dockerfile
tags: |
${{env.DOCKER_HUB_PROFILE}}/${{env.IMAGE_NAME}}-${{matrix.network}}:latest
- name: Update DockerHub Description
if: env.TEST_RUN != 'true'
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
repository: ${{env.DOCKER_HUB_PROFILE}}/${{env.IMAGE_NAME}}-${{matrix.network}}
readme-filepath: docker/${{env.IMAGE_NAME}}-${{matrix.network}}.overview.md
release-dev-images:
needs: wait-for-all-builds
name: Release Dev Docker Image for ${{matrix.node}}
strategy:
fail-fast: true
matrix:
arch: [amd64]
node: [collator-node-local, standalone-node]
include:
- node: collator-node-local
network: local
build-profile: release
release-file-name-prefix: frequency-local
- node: standalone-node
network: dev
build-profile: release
release-file-name-prefix: frequency-dev
env:
DOCKER_HUB_PROFILE: frequencychain
runs-on: ubuntu-22.04
steps:
- name: Set Env Vars
run: |
echo "BIN_DIR=target/${{matrix.build-profile}}" >> $GITHUB_ENV
echo "BUILT_BIN_FILENAME=frequency" >> $GITHUB_ENV
echo "RELEASE_BIN_FILENAME=${{matrix.release-file-name-prefix}}.${{matrix.arch}}" >> $GITHUB_ENV
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.RELEASE_BRANCH_NAME}}
- name: Full Release?
id: is-full-release
uses: ./.github/workflows/common/is-full-release
with:
version-tag: ${{env.NEW_RELEASE_TAG}}
- name: Download Binaries
id: download-binaries
uses: actions/download-artifact@v4
with:
pattern: artifacts-binary-${{matrix.network}}-${{github.run_id}}
path: .
- name: Extract and List Downloaded Binaries
run: |
download_dir=${{steps.download-binaries.outputs.download-path}}
mv "${download_dir}"/artifacts*/* "${download_dir}"
echo "Download dir: $download_dir"
echo "Downloaded binaries: $(ls -l $download_dir)"
- name: Move Binary to Target Dir
run: |
mkdir -p ${{env.BIN_DIR}}
mv ${{env.RELEASE_BIN_FILENAME}} ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}}
chmod +x ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{matrix.arch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
- name: Build and Push Dev Image
# if: env.TEST_RUN != 'true'
uses: docker/build-push-action@v6
with:
context: .
platforms: ${{matrix.docker-platform}}
push: ${{env.TEST_RUN != 'true'}}
file: ./docker/${{matrix.node}}.dockerfile
tags: |
${{env.DOCKER_HUB_PROFILE}}/${{matrix.node}}:${{env.NEW_RELEASE_TAG}}
- name: Update DockerHub Latest Tag
if: steps.is-full-release.outputs.is-full-release == 'true'
uses: docker/build-push-action@v6
with:
context: .
platforms: ${{matrix.docker-platform}}
push: ${{env.TEST_RUN != 'true'}}
file: ./docker/${{matrix.node}}.dockerfile
tags: |
${{env.DOCKER_HUB_PROFILE}}/${{matrix.node}}:latest
- name: Update DockerHub Description
if: env.TEST_RUN != 'true'
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
repository: ${{env.DOCKER_HUB_PROFILE}}/${{matrix.node}}
readme-filepath: docker/${{matrix.node}}.overview.md
# Published to https://frequency-chain.github.io/frequency/
release-rust-developer-docs:
needs: wait-for-all-builds
name: Release Rust Developer Docs
runs-on: ubuntu-22.04
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps: