-
Notifications
You must be signed in to change notification settings - Fork 11
366 lines (315 loc) · 19 KB
/
xcm.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
name: xcm-testnet
# Controls when the action will run.
on:
workflow_call:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
#Define Workflow variables
env:
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
prepare-execution-marix:
name: Prepare execution matrix
runs-on: [self-hosted-ci]
outputs:
matrix: ${{ steps.create_matrix.outputs.matrix }}
steps:
- name: Clean Workspace
uses: AutoModality/action-clean@v1.1.0
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3.1.0
with:
ref: ${{ github.head_ref }} #Checking out head commit
- name: Read .env file
uses: xom9ikk/dotenv@v2
- name: Create Execution matrix
uses: CertainLach/create-matrix-action@v4
id: create_matrix
with:
matrix: |
network {opal}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}, acala_version {${{ env.ACALA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONBEAM_BUILD_BRANCH }}}, cumulus_version {${{ env.WESTMINT_BUILD_BRANCH }}}, astar_version {${{ env.ASTAR_BUILD_BRANCH }}}, polkadex_version {${{ env.POLKADEX_BUILD_BRANCH }}}, runtest {testXcmOpal}, runtime_features {opal-runtime}
network {quartz}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}, acala_version {${{ env.KARURA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONRIVER_BUILD_BRANCH }}}, cumulus_version {${{ env.STATEMINE_BUILD_BRANCH }}}, astar_version {${{ env.SHIDEN_BUILD_BRANCH }}}, polkadex_version {${{ env.POLKADEX_BUILD_BRANCH }}}, runtest {testFullXcmQuartz}, runtime_features {quartz-runtime}
network {unique}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}, acala_version {${{ env.ACALA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONBEAM_BUILD_BRANCH }}}, cumulus_version {${{ env.STATEMINT_BUILD_BRANCH }}}, astar_version {${{ env.ASTAR_BUILD_BRANCH }}}, polkadex_version {${{ env.POLKADEX_BUILD_BRANCH }}}, runtest {testFullXcmUnique}, runtime_features {unique-runtime}
xcm:
needs: prepare-execution-marix
# The type of runner that the job will run on
runs-on: [XL]
timeout-minutes: 600
name: ${{ matrix.network }}
continue-on-error: true #Do not stop testing of matrix runs failed. As it decided during PR review - it required 50/50& Let's check it with false.
strategy:
matrix:
include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}
steps:
- name: Skip if pull request is in Draft
if: github.event.pull_request.draft == true
run: exit 1
- name: Clean Workspace
uses: AutoModality/action-clean@v1.1.0
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3.1.0
with:
ref: ${{ github.head_ref }} #Checking out head commit
# Prepare SHA
- name: Prepare SHA
uses: ./.github/actions/prepare
- name: Read .env file
uses: xom9ikk/dotenv@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}
# Check POLKADOT version and build it if it doesn't exist in repository
- name: Generate ENV related extend Dockerfile file for POLKADOT
uses: cuchi/jinja2-action@v1.2.0
with:
template: .docker/Dockerfile-polkadot.j2
output_file: .docker/Dockerfile-polkadot.${{ matrix.relay_branch }}.yml
variables: |
RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}
- name: Check if the dockerhub repository contains the needed version POLKADOT
run: |
# aquire token
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
export TOKEN=$TOKEN
# Get TAGS from DOCKERHUB POLKADOT repository
POLKADOT_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-polkadot/tags/?page_size=100 | jq -r '."results"[]["name"]')
# Show TAGS
echo "POLKADOT TAGS:"
echo $POLKADOT_TAGS
# Check correct version POLKADOT and build it if it doesn't exist in POLKADOT TAGS
if [[ ${POLKADOT_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.relay_branch }}"($|[[:space:]]) ]]; then
echo "Repository has needed POLKADOT version";
docker pull uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}
else
echo "Repository has not needed POLKADOT version, so build it";
cd .docker/ && docker build --file ./Dockerfile-polkadot.${{ matrix.relay_branch }}.yml --tag uniquenetwork/builder-polkadot:${{ matrix.relay_branch }} .
echo "Push needed POLKADOT version to the repository";
docker push uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}
fi
shell: bash
# Check ACALA version and build it if it doesn't exist in repository
- name: Generate ENV related extend Dockerfile file for ACALA
uses: cuchi/jinja2-action@v1.2.0
with:
template: .docker/Dockerfile-acala.j2
output_file: .docker/Dockerfile-acala.${{ matrix.acala_version }}.yml
variables: |
RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
ACALA_BUILD_BRANCH=${{ matrix.acala_version }}
- name: Check if the dockerhub repository contains the needed ACALA version
run: |
# aquire token
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
export TOKEN=$TOKEN
# Get TAGS from DOCKERHUB repository
ACALA_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-acala/tags/?page_size=100 | jq -r '."results"[]["name"]')
# Show TAGS
echo "ACALA TAGS:"
echo $ACALA_TAGS
# Check correct version ACALA and build it if it doesn't exist in ACALA TAGS
if [[ ${ACALA_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.acala_version }}"($|[[:space:]]) ]]; then
echo "Repository has needed ACALA version";
docker pull uniquenetwork/builder-acala:${{ matrix.acala_version }}
else
echo "Repository has not needed ACALA version, so build it";
cd .docker/ && docker build --file ./Dockerfile-acala.${{ matrix.acala_version }}.yml --tag uniquenetwork/builder-acala:${{ matrix.acala_version }} .
echo "Push needed ACALA version to the repository";
docker push uniquenetwork/builder-acala:${{ matrix.acala_version }}
fi
shell: bash
# Check MOONBEAM version and build it if it doesn't exist in repository
- name: Generate ENV related extend Dockerfile file for MOONBEAM
uses: cuchi/jinja2-action@v1.2.0
with:
template: .docker/Dockerfile-moonbeam.j2
output_file: .docker/Dockerfile-moonbeam.${{ matrix.moonbeam_version }}.yml
variables: |
RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
MOONBEAM_BUILD_BRANCH=${{ matrix.moonbeam_version }}
- name: Check if the dockerhub repository contains the needed MOONBEAM version
run: |
# aquire token
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
export TOKEN=$TOKEN
# Get TAGS from DOCKERHUB repository
MOONBEAM_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-moonbeam/tags/?page_size=100 | jq -r '."results"[]["name"]')
# Show TAGS
echo "MOONBEAM TAGS:"
echo $MOONBEAM_TAGS
# Check correct version MOONBEAM and build it if it doesn't exist in MOONBEAM TAGS
if [[ ${MOONBEAM_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.moonbeam_version }}"($|[[:space:]]) ]]; then
echo "Repository has needed MOONBEAM version";
docker pull uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }}
else
echo "Repository has not needed MOONBEAM version, so build it";
cd .docker/ && docker build --file ./Dockerfile-moonbeam.${{ matrix.moonbeam_version }}.yml --tag uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }} .
echo "Push needed MOONBEAM version to the repository";
docker push uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }}
fi
shell: bash
# Check CUMULUS version and build it if it doesn't exist in repository
- name: Generate ENV related extend Dockerfile file for CUMULUS
uses: cuchi/jinja2-action@v1.2.0
with:
template: .docker/Dockerfile-cumulus.j2
output_file: .docker/Dockerfile-cumulus.${{ matrix.cumulus_version }}.yml
variables: |
RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
CUMULUS_BUILD_BRANCH=${{ matrix.cumulus_version }}
- name: Check if the dockerhub repository contains the needed CUMULUS version
run: |
# aquire token
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
export TOKEN=$TOKEN
# Get TAGS from DOCKERHUB repository
CUMULUS_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-cumulus/tags/?page_size=100 | jq -r '."results"[]["name"]')
# Show TAGS
echo "CUMULUS TAGS:"
echo $CUMULUS_TAGS
# Check correct version CUMULUS and build it if it doesn't exist in CUMULUS TAGS
if [[ ${CUMULUS_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.cumulus_version }}"($|[[:space:]]) ]]; then
echo "Repository has needed CUMULUS version";
docker pull uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }}
else
echo "Repository has not needed CUMULUS version, so build it";
cd .docker/ && docker build --file ./Dockerfile-cumulus.${{ matrix.cumulus_version }}.yml --tag uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }} .
echo "Push needed CUMULUS version to the repository";
docker push uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }}
fi
shell: bash
# Check ASTAR version and build it if it doesn't exist in repository
- name: Generate ENV related extend Dockerfile file for ASTAR
uses: cuchi/jinja2-action@v1.2.0
with:
template: .docker/Dockerfile-astar.j2
output_file: .docker/Dockerfile-astar.${{ matrix.astar_version }}.yml
variables: |
RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
ASTAR_BUILD_BRANCH=${{ matrix.astar_version }}
- name: Check if the dockerhub repository contains the needed ASTAR version
run: |
# aquire token
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
export TOKEN=$TOKEN
# Get TAGS from DOCKERHUB repository
ASTAR_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-astar/tags/?page_size=100 | jq -r '."results"[]["name"]')
# Show TAGS
echo "ASTAR TAGS:"
echo $ASTAR_TAGS
# Check correct version ASTAR and build it if it doesn't exist in ASTAR TAGS
if [[ ${ASTAR_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.astar_version }}"($|[[:space:]]) ]]; then
echo "Repository has needed ASTAR version";
docker pull uniquenetwork/builder-astar:${{ matrix.astar_version }}
else
echo "Repository has not needed ASTAR version, so build it";
cd .docker/ && docker build --file ./Dockerfile-astar.${{ matrix.astar_version }}.yml --tag uniquenetwork/builder-astar:${{ matrix.astar_version }} .
echo "Push needed ASTAR version to the repository";
docker push uniquenetwork/builder-astar:${{ matrix.astar_version }}
fi
shell: bash
# Check POLKADEX version and build it if it doesn't exist in repository
- name: Generate ENV related extend Dockerfile file for POLKADEX
uses: cuchi/jinja2-action@v1.2.0
with:
template: .docker/Dockerfile-polkadex.j2
output_file: .docker/Dockerfile-polkadex.${{ matrix.polkadex_version }}.yml
variables: |
RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
POLKADEX_BUILD_BRANCH=${{ matrix.polkadex_version }}
- name: Check if the dockerhub repository contains the needed POLKADEX version
run: |
# aquire token
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
export TOKEN=$TOKEN
# Get TAGS from DOCKERHUB repository
POLKADEX_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-polkadex/tags/?page_size=100 | jq -r '."results"[]["name"]')
# Show TAGS
echo "POLKADEX TAGS:"
echo $POLKADEX_TAGS
# Check correct version POLKADEX and build it if it doesn't exist in POLKADEX TAGS
if [[ ${POLKADEX_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.polkadex_version }}"($|[[:space:]]) ]]; then
echo "Repository has needed POLKADEX version";
docker pull uniquenetwork/builder-polkadex:${{ matrix.polkadex_version }}
else
echo "Repository has not needed POLKADEX version, so build it";
cd .docker/ && docker build --file ./Dockerfile-polkadex.${{ matrix.polkadex_version }}.yml --tag uniquenetwork/builder-polkadex:${{ matrix.polkadex_version }} .
echo "Push needed POLKADEX version to the repository";
docker push uniquenetwork/builder-polkadex:${{ matrix.polkadex_version }}
fi
shell: bash
- name: Build unique-chain
run: |
docker build --file .docker/Dockerfile-unique \
--build-arg RUNTIME_FEATURES=${{ matrix.runtime_features }} \
--build-arg RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} \
--tag uniquenetwork/ci-xcm-local:${{ matrix.network }}-${{ env.REF_SLUG }}-${{ env.BUILD_SHA }} \
.
- name: Push docker image version
run: docker push uniquenetwork/ci-xcm-local:${{ matrix.network }}-${{ env.REF_SLUG }}-${{ env.BUILD_SHA }}
- uses: actions/setup-node@v3.5.1
with:
node-version: 18
- name: Install baedeker
uses: UniqueNetwork/baedeker-action/setup@built
- name: Setup library
run: mkdir -p .baedeker/vendor/ && git clone https://github.com/UniqueNetwork/baedeker-library .baedeker/vendor/baedeker-library
- name: Start network
uses: UniqueNetwork/baedeker-action@built
id: bdk
with:
jpath: |
.baedeker/vendor
tla-str: |
relay_spec=${{ env.RELAY_CHAIN_TYPE }}-local
inputs: |
.baedeker/xcm-${{ matrix.network }}.jsonnet
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadot':{dockerImage:'uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}'}})
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'uniquenetwork/ci-xcm-local:${{ matrix.network }}-${{ env.REF_SLUG }}-${{ env.BUILD_SHA }}'}})
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/acala':{dockerImage:'uniquenetwork/builder-acala:${{ matrix.acala_version }}'}})
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/moonbeam':{dockerImage:'uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }}'}})
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/cumulus':{dockerImage:'uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }}'}})
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/astar':{dockerImage:'uniquenetwork/builder-astar:${{ matrix.astar_version }}'}})
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadex':{dockerImage:'uniquenetwork/builder-polkadex:${{ matrix.polkadex_version }}'}})
- name: Upload network config
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.network }}-network-config
path: ${{ steps.bdk.outputs.composeProject }}
retention-days: 2
- name: Yarn install
working-directory: js-packages/tests
run: |
yarn install
yarn add mochawesome
- name: Call HRMP initialization
working-directory: js-packages/tests
run: |
yarn ts-node --esm util/createHrmp.ts ${{matrix.network}}
- name: Run XCM tests
working-directory: js-packages/tests
run: |
# Wanted by both wait_for_first_block
export RPC_URL="${RELAY_OPAL_HTTP_URL:-${RELAY_QUARTZ_HTTP_URL:-${RELAY_UNIQUE_HTTP_URL:-}}}"
../scripts/wait_for_first_block.sh
echo "Ready to start tests"
NOW=$(date +%s) && yarn ${{ matrix.runtest }} --reporter mochawesome --reporter-options reportFilename=test-${NOW}
- name: XCM Test Report
uses: phoenix-actions/test-reporting@v10
id: test-report
if: success() || failure()
with:
name: XCM Tests ${{ matrix.network }}
path: js-packages/tests/mochawesome-report/test-*.json
reporter: mochawesome-json
fail-on-error: 'false'
- name: Clean Workspace
if: always()
uses: AutoModality/action-clean@v1.1.0
- name: Remove builder cache
if: always()
run: |
docker system prune -a -f