-
Notifications
You must be signed in to change notification settings - Fork 0
268 lines (243 loc) · 9.02 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
name: Release
on:
push:
branches:
- release/[0-9]+.[0-9]+.[0-9]+
tags:
- v[0-9]+.[0-9]+.[0-9]+-?[a-z0-9]*
env:
CARGO_TERM_COLOR: always
jobs:
release-check:
if: startsWith(github.ref, 'refs/heads/release')
name: Check for release
runs-on: ubuntu-latest
strategy:
matrix:
runtime: [bajun]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get crate and release versions
run: |
echo "CRATE_VERSIONS=$(cargo tree --depth=0 --workspace | egrep -o '[0-9]+\.[0-9]+\.[0-9]+' | uniq)" >> $GITHUB_ENV
echo "RELEASE_VERSION=${GITHUB_REF_NAME#release/}" >> $GITHUB_ENV
- name: Check release version is bumped
run: |
[ -z "$(git tag --list)" ] && {
echo "skipping as there are no tags yet"
exit 0
}
TAG=$(git describe --tags --abbrev=0 | tr -d v)
echo "previous release version: $TAG"
echo "current release version: ${{ env.RELEASE_VERSION }}"
[ $TAG -eq ${{ env.RELEASE_VERSION }} ] && {
echo "release version must be bumped"
exit 1
}
exit 0
- name: Check crate and release versions match
run: |
[ $(echo ${{ env.CRATE_VERSIONS }} | wc -w | xargs) -ne 1 ] && {
echo "all crate versions should be equal"
exit 1
}
[ "${{ env.CRATE_VERSIONS }}" != "${{ env.RELEASE_VERSION }}" ] && {
echo "release version (${{ env.CRATE_VERSIONS }}) is not equal to crate versions (${{ env.CRATE_VERSIONS }})"
exit 1
}
echo "crate version: ${{ env.CRATE_VERSIONS }}"
echo "release version: ${{ env.RELEASE_VERSION }}"
exit 0
- name: Check spec version match
run: |
RELEASE_VERSION=$(echo ${{ env.RELEASE_VERSION }} | tr -d .)
RELEASE_VERSION_INTEGER=$((10#$RELEASE_VERSION))
SPEC_VERSION=$(grep "spec_version" runtime/${{ matrix.runtime }}/**/lib.rs | egrep -o "[0-9]+")
echo "release version as integer: $RELEASE_VERSION_INTEGER"
echo "spec version: $SPEC_VERSION"
exit 0
- run: sudo apt-get install -y protobuf-compiler
- name: Check wasm build
run: cargo check --all-features --all-targets --release -p ${{ matrix.runtime }}-runtime
release-check-try-runtime:
if: startsWith(github.ref, 'refs/heads/release')
needs: [release-check]
name: Check release in try-runtime
runs-on: ubuntu-latest
strategy:
matrix:
runtime: [bajun]
include:
- runtime: bajun
uri: "ws://rpc-rococo.bajun.network:9944"
env:
TRY_RUNTIME_VER: v0.5.0
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create testing directories
run: mkdir -p try-runtime-tests
- name: Build try-runtime compatible binary
run: |
sudo apt-get install -y protobuf-compiler
cargo build-${{ matrix.runtime }} --features try-runtime
cp target/release/wbuild/${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.compressed.wasm try-runtime-tests/runtime.wasm
- name: Install try-runtime tool
run: |
cd try-runtime-tests
wget -q "https://github.com/paritytech/try-runtime-cli/releases/download/${{ env.TRY_RUNTIME_VER }}/try-runtime-x86_64-unknown-linux-musl"
chmod +x try-runtime-x86_64-unknown-linux-musl && mv try-runtime-x86_64-unknown-linux-musl try-runtime
./try-runtime --version
- name: Run try-runtime checks
run: |
cd try-runtime-tests
./try-runtime --runtime=runtime.wasm --wasm-execution=compiled on-runtime-upgrade --checks "try-state" live --uri=${{ matrix.uri }}
release-check-zombienet:
if: startsWith(github.ref, 'refs/heads/release')
needs: [release-check, release-check-try-runtime]
name: Check release in zombienet
runs-on: ubuntu-latest
strategy:
matrix:
runtime: [bajun]
env:
ZOMBIENET_VERSION: v1.3.82
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create testing directories
run: mkdir -p zombienet-tests/bin
- name: Setup zombienet binaries
run: |
cd zombienet-tests/bin
wget -q "https://github.com/paritytech/zombienet/releases/download/${{ env.ZOMBIENET_VERSION }}/zombienet-linux-x64"
chmod +x zombienet-linux-x64
mv zombienet-linux-x64 zombienet
./zombienet setup polkadot -y || :
./zombienet version
- name: Copy network config and tests
run: cp .maintain/zombienet-* zombienet-tests/
- name: Build and copy collator binary to zombienet binaries
run: |
sudo apt-get install -y protobuf-compiler
cargo build-${{ matrix.runtime }}
cp target/release/${{ matrix.runtime }}-para zombienet-tests/bin/collator
- name: Run zombienet tests
run: ./zombienet-tests/bin/zombienet -l "text" -p native test ./zombienet-tests/zombienet-tests.zndsl
release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
strategy:
matrix:
runtime: [bajun]
env:
SUBWASM_VERSION: v0.20.0
steps:
- uses: actions/checkout@v4
- id: srtool_build
uses: chevdor/srtool-actions@v0.9.2
with:
image: paritytech/srtool
chain: ${{ matrix.runtime }}
tag: 1.74.0-0.13.0
- name: Install subwasm {{ env.SUBWASM_VERSION }}
run: |
wget https://github.com/chevdor/subwasm/releases/download/${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_${{ env.SUBWASM_VERSION }}.deb -O subwasm.deb
sudo dpkg -i subwasm.deb
- name: Run subwasm info
run: |
echo "\`\`\`" > ${{ matrix.runtime }}-info.txt
echo -e "${{ matrix.runtime }}-runtime:\n" >> ${{ matrix.runtime }}-info.txt
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} \
| sed -E 's/^Running subwasm.+$//' \
| sed '/^$/d' \
>> ${{ matrix.runtime }}-info.txt
echo "\`\`\`" >> ${{ matrix.runtime }}-info.txt
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.runtime }}-artifact
path: |
${{ steps.srtool_build.outputs.wasm_compressed }}
${{ matrix.runtime }}-info.txt
if-no-files-found: error
release-draft:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
- run: |
echo "## Subwasm Info" > runtime-info.txt
cat **/*-info.txt >> runtime-info.txt
echo "---" >> runtime-info.txt
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
generate_release_notes: true
append_body: true
body_path: runtime-info.txt
files: "**/*_runtime.compact.compressed.wasm"
release-docker:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
strategy:
matrix:
image:
- {
name: parachain-bajun,
build_arg_bin: bajun-node,
}
outputs:
image_tag: ${{ steps.set_image_tag.outputs.image_tag }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- uses: docker/metadata-action@v4
id: meta
with:
images: ${{ matrix.image.name }}
- name: Get image tag from the tag name
id: set_image_tag
run: |
IMAGE_TAG="${GITHUB_REF#refs/tags/v}"
echo "image_tag=$IMAGE_TAG" >> $GITHUB_ENV
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v3
with:
context: .
file: docker/Dockerfile
push: true
tags: |
ajuna/${{ matrix.image.name }}:${{ env.image_tag }}
ajuna/${{ matrix.image.name }}:latest
build-args: |
bin=${{ matrix.image.build_arg_bin }}
cache-from: type=registry,ref=ajuna/${{ matrix.image.name }}:buildcache
cache-to: type=registry,ref=ajuna/${{ matrix.image.name }}:buildcache,mode=max
release-onf:
needs: release-docker
runs-on: ubuntu-latest
strategy:
matrix:
runtime: [bajun]
include:
- runtime: bajun
network_key: ONF_BAJUN_NETWORK_KEY
steps:
- uses: OnFinality-io/action-onf-release@v1
with:
onf-access-key: ${{ secrets.ONF_ACCESS_KEY }}
onf-secret-key: ${{ secrets.ONF_SECRET_KEY }}
onf-workspace-id: ${{ secrets.ONF_WORKSPACE_ID }}
onf-network-key: ${{ secrets[matrix.network_key] }}
onf-sub-command: image
onf-action: add
image-version: ${{ needs.release-docker.outputs.image_tag }}