Skip to content

xcm-testnet

xcm-testnet #5

Workflow file for this run

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/[email protected]
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
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 }}}, hydradx_version {${{ env.HYDRADX_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 }}}, hydradx_version {${{ env.HYDRADX_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 }}}, hydradx_version {${{ env.HYDRADX_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/[email protected]
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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
# Check Hydradx version and build it if it doesn't exist in repository
- name: Generate ENV related extend Dockerfile file for Hydradx
uses: cuchi/[email protected]
with:
template: .docker/Dockerfile-hydradx.j2
output_file: .docker/Dockerfile-hydradx.${{ matrix.hydradx_version }}.yml
variables: |
RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
HYDRADX_BUILD_BRANCH=${{ matrix.hydradx_version }}
- name: Check if the dockerhub repository contains the needed HYDRADX 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
HYDRADX_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-hydradx/tags/?page_size=100 | jq -r '."results"[]["name"]')
# Show TAGS
echo "HYDRADX TAGS:"
echo $HYDRADX_TAGS
# Check correct version HYDRADX and build it if it doesn't exist in HYDRADX TAGS
if [[ ${HYDRADX_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.hydradx_version }}"($|[[:space:]]) ]]; then
echo "Repository has needed HYDRADX version";
docker pull uniquenetwork/builder-hydradx:${{ matrix.hydradx_version }}
else
echo "Repository has not needed HYDRADX version, so build it";
cd .docker/ && docker build --file ./Dockerfile-hydradx.${{ matrix.hydradx_version }}.yml --tag uniquenetwork/builder-hydradx:${{ matrix.hydradx_version }} .
echo "Push needed HYDRADX version to the repository";
docker push uniquenetwork/builder-hydradx:${{ matrix.hydradx_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/[email protected]
with:
node-version: 20
- 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 }}'}})
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/hydradx':{dockerImage:'uniquenetwork/builder-hydradx:${{ matrix.hydradx_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/scripts
run: |
yarn node --no-warnings=ExperimentalWarning --loader ts-node/esm 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/[email protected]
- name: Remove builder cache
if: always()
run: |
docker system prune -a -f