-
Notifications
You must be signed in to change notification settings - Fork 19
161 lines (138 loc) · 5.03 KB
/
check-runtime-upgrade.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
name: Check runtime upgrade
# Check runtime upgradability of the released runtime.
# We do it in two ways:
# - by executing try-runtime-cli against the live chain
# - by simulating a runtime upgrade against the live chain
on:
release:
types: [released]
workflow_dispatch:
inputs:
release_tag:
description: runtime.wasm release_tag
required: false
env:
SUBWASM_VERSION: 0.19.1
RELEASE_TAG: ${{ github.event.inputs.release_tag || github.event.release.tag_name }}
jobs:
check-condition:
runs-on: ubuntu-22.04
outputs:
skip_simulation: ${{ steps.check.outputs.skip_simulation }}
steps:
- uses: actions/checkout@v4
- id: check
run: |
if [ -z "${{ env.RELEASE_TAG }}" ]; then
skip_simulation=true
else
skip_simulation=false
fi
echo "skip_simulation=$skip_simulation" | tee -a $GITHUB_OUTPUT
runtime-matrix:
runs-on: ubuntu-22.04
outputs:
runtime: ${{ steps.runtime.outputs.runtime }}
name: Parse runtime matrix
steps:
- uses: actions/checkout@v4
- id: runtime
run: |
TASKS=$(jq '[.[] | select(.uri != null)]' .github/runtime.json)
SKIPPED_TASKS=$(jq '[.[] | select(.uri == null)]' .github/runtime.json)
echo --- Running the following tasks ---
echo $TASKS
echo --- Skipping the following tasks due to not having a uri field ---
echo $SKIPPED_TASKS
TASKS=$(echo $TASKS | jq -c .)
echo "runtime=$TASKS" >> $GITHUB_OUTPUT
# simulate-runtime-upgrade:
# runs-on: ubuntu-22.04
# needs:
# - check-condition
# - runtime-matrix
# if: needs.check-condition.outputs.skip_simulation == 'false'
# timeout-minutes: 30
# strategy:
# fail-fast: false
# matrix:
# runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }}
# name: ${{ matrix.runtime.name }}
# steps:
# - name: Checkout codes on ${{ github.ref }}
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Enable corepack and pnpm
# run: corepack enable && corepack enable pnpm
# - name: Install subwasm ${{ env.SUBWASM_VERSION }}
# run: |
# wget https://github.com/chevdor/subwasm/releases/download/v${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb
# sudo dpkg -i subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb
# subwasm --version
# - name: Test runtime upgrade
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# timeout-minutes: 10
# run: |
# ./parachain/scripts/runtime-upgrade.sh ${{ matrix.runtime.name }} ${{ matrix.runtime.uri }} ${{ env.RELEASE_TAG }}
try-runtime:
runs-on: ubuntu-22.04
needs:
- check-condition
- runtime-matrix
strategy:
fail-fast: false
matrix:
runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }}
name: ${{ matrix.runtime.name }}
steps:
- name: Checkout codes on ${{ github.ref }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download try-runtime-cli
run: |
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.8.0/try-runtime-x86_64-unknown-linux-musl -o try-runtime
chmod +x ./try-runtime
mv try-runtime parachain
shell: bash
- name: Install Protoc
uses: arduino/[email protected]
with:
version: "3.6.1"
- name: Add wasm32-unknown-unknown target
run: rustup target add wasm32-unknown-unknown
shell: bash
- name: Add rust-src component
run: rustup component add rust-src
shell: bash
- name: Build ${{ matrix.runtime.name }}
run: |
cd parachain
cargo build --profile production -p ${{ matrix.runtime.package }} --features try-runtime -q --locked
shell: bash
- name: Check migrations
run: |
cd parachain
PACKAGE_NAME=${{ matrix.runtime.package }}
RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.compressed.wasm
RUNTIME_BLOB_PATH=./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME
export RUST_LOG=remote-ext=debug,runtime=debug
# Store the command in a variable so we can log it
COMMAND="./try-runtime \
--runtime $RUNTIME_BLOB_PATH \
on-runtime-upgrade --disable-mbm-checks --blocktime 12000000 \
live --uri ${{ imatrix.runtime.uri }}"
# Echo the command before running it, for debugging purposes
echo "Running command:"
echo "$COMMAND"
eval "$COMMAND"
shell: bash
# - name: Run ${{ matrix.runtime.name }} try-runtime check
# uses: BillyWooo/[email protected]
# with:
# runtime-package: ${{ matrix.runtime.package }}
# node-uri: ${{ matrix.runtime.uri }}
# checks: "all"
# extra-args: ""