xcm-testnet #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: [ 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/[email protected] | |
- name: Create Execution matrix | |
uses: CertainLach/create-matrix-action@v4 | |
id: create_matrix | |
with: | |
matrix: | | |
network {quartz}, relay_name {kusama}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}, assethub_version {${{ env.KUSAMA_ASSETHUB_BUILD_BRANCH }}}, acala_version {${{ env.KARURA_BUILD_BRANCH }}}, acala_repository {karura-node}, moonbeam_version {${{ env.MOONRIVER_BUILD_BRANCH }}}, astar_version {${{ env.SHIDEN_BUILD_BRANCH }}}, runtest {testXcmQuartz}, runs_on {L} | |
network {unique}, relay_name {polkadot}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}, assethub_version {${{ env.POLKADOT_ASSETHUB_BUILD_BRANCH }}}, acala_version {${{ env.ACALA_BUILD_BRANCH }}}, acala_repository {acala-node}, moonbeam_version {${{ env.MOONBEAM_BUILD_BRANCH }}}, astar_version {${{ env.ASTAR_BUILD_BRANCH }}}, runtest {testXcmUnique}, runs_on {XL} | |
xcm: | |
needs: prepare-execution-marix | |
# The type of runner that the job will run on | |
runs-on: ${{ matrix.runs_on }} | |
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/[email protected] | |
- name: Log in to Docker Hub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.CORE_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CORE_DOCKERHUB_TOKEN }} | |
- name: Check and pull polkadot image | |
id: polkadot | |
uses: cloudposse/github-action-docker-image-exists@main | |
with: | |
registry: registry.hub.docker.com | |
organization: parity | |
repository: polkadot | |
login: ${{ secrets.CORE_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CORE_DOCKERHUB_TOKEN }} | |
tag: ${{ matrix.relay_branch }} | |
- name: Check and pull acala image | |
id: acala | |
uses: cloudposse/github-action-docker-image-exists@main | |
with: | |
registry: registry.hub.docker.com | |
organization: acala | |
repository: ${{ matrix.acala_repository }} | |
login: ${{ secrets.CORE_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CORE_DOCKERHUB_TOKEN }} | |
tag: ${{ matrix.acala_version }} | |
- name: Check and pull MOONBEAM image | |
id: moonbeam | |
uses: cloudposse/github-action-docker-image-exists@main | |
with: | |
registry: registry.hub.docker.com | |
organization: moonbeamfoundation | |
repository: moonbeam | |
login: ${{ secrets.CORE_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CORE_DOCKERHUB_TOKEN }} | |
tag: ${{ matrix.moonbeam_version }} | |
- name: Check and pull ASSETHUB image | |
id: assethub | |
uses: cloudposse/github-action-docker-image-exists@main | |
with: | |
registry: registry.hub.docker.com | |
organization: parity | |
repository: polkadot-parachain | |
login: ${{ secrets.CORE_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CORE_DOCKERHUB_TOKEN }} | |
tag: ${{ matrix.assethub_version }} | |
- name: Check and pull ASTAR image | |
id: astar | |
uses: cloudposse/github-action-docker-image-exists@main | |
with: | |
registry: registry.hub.docker.com | |
organization: staketechnologies | |
repository: astar-collator | |
login: ${{ secrets.CORE_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CORE_DOCKERHUB_TOKEN }} | |
tag: ${{ matrix.astar_version }} | |
- name: Check and pull POLKADEX image | |
id: polkadex | |
uses: cloudposse/github-action-docker-image-exists@main | |
with: | |
registry: registry.hub.docker.com | |
organization: polkadex | |
repository: parachain | |
login: ${{ secrets.CORE_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CORE_DOCKERHUB_TOKEN }} | |
tag: ${{ env.POLKADEX_BUILD_BRANCH }} | |
- name: Check and pull HYDRADX image | |
id: hydradx | |
uses: cloudposse/github-action-docker-image-exists@main | |
with: | |
registry: registry.hub.docker.com | |
organization: galacticcouncil | |
repository: hydra-dx | |
login: ${{ secrets.CORE_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CORE_DOCKERHUB_TOKEN }} | |
tag: ${{ env.HYDRADX_BUILD_BRANCH }} | |
- name: Prepare target runtime | |
uses: ./.github/actions/buildContainer | |
id: runtime | |
with: | |
container: uniquenetwork/ci-xcm-local | |
tag: ${{ matrix.network }}-${{ env.REF_SLUG }}-${{ env.BUILD_SHA }} | |
context: . | |
dockerfile: .docker/Dockerfile-unique | |
args: | | |
--build-arg FEATURES=${{ matrix.network }}-runtime | |
dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }} | |
dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }} | |
- name: Prepare target node | |
uses: ./.github/actions/buildContainer | |
id: node | |
with: | |
container: uniquenetwork/ci-xcm-local | |
tag: ${{ matrix.network }}-${{ env.NODE_BRANCH }}-${{ env.NODE_HASH}} | |
context: .docker | |
dockerfile: Dockerfile-unique-release | |
args: | | |
--build-arg FEATURES=${{ matrix.network }}-runtime | |
--build-arg CODE_VERSION=${{ env.NODE_BRANCH}} | |
--build-arg CODE_HASH=${{ env.NODE_HASH}} | |
dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }} | |
dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }} | |
- uses: actions/[email protected] | |
with: | |
node-version: 20 | |
- name: Install baedeker | |
uses: UniqueNetwork/baedeker-action/[email protected] | |
with: | |
version: "v0.1.4" | |
useCache: false | |
- name: Setup library | |
run: mkdir -p .baedeker/vendor/ && git clone https://github.com/UniqueNetwork/baedeker-library .baedeker/vendor/baedeker-library | |
- name: Pull chain-spec-generator-latest image | |
run: | | |
docker pull uniquenetwork/services:chain-spec-generator-latest | |
- name: Build chain-spec file for assethub | |
run: | | |
docker run --rm uniquenetwork/services:chain-spec-generator-latest asset-hub-${{ matrix.relay_name }}-local > .baedeker/vendor/assethub-spec.json | |
- name: Start network | |
uses: UniqueNetwork/[email protected] | |
id: bdk | |
with: | |
jpath: | | |
.baedeker/vendor | |
tla-str: | | |
relay_spec=${{ env.RELAY_CHAIN_TYPE }}-local | |
tla-code: | | |
assethub_spec=import 'assethub-spec.json' | |
inputs: | | |
.baedeker/xcm-${{ matrix.network }}.jsonnet | |
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadot':{dockerImage:'${{ steps.polkadot.outputs.image }}:${{ steps.polkadot.outputs.tag }}'}}) | |
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.node.outputs.name }}'}}, extra_node_mixin={extraArgs: []}, for_chain = false) | |
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.runtime.outputs.name }}'}}, extra_node_mixin={extraArgs: []}) | |
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/acala':{dockerImage:'${{ steps.acala.outputs.image }}:${{ steps.acala.outputs.tag }}'}}) | |
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/moonbeam':{dockerImage:'${{ steps.moonbeam.outputs.image }}:${{ steps.moonbeam.outputs.tag }}'}}) | |
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/assethub':{dockerImage:'${{ steps.assethub.outputs.image }}:${{ steps.assethub.outputs.tag }}'}}) | |
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/astar':{dockerImage:'${{ steps.astar.outputs.image }}:${{ steps.astar.outputs.tag }}', docker:'/usr/local/bin/astar-collator'}}) | |
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadex':{dockerImage:'${{ steps.polkadex.outputs.image }}:${{ steps.polkadex.outputs.tag }}'}}) | |
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/hydradx':{dockerImage:'${{ steps.hydradx.outputs.image }}:${{ steps.hydradx.outputs.tag }}'}}) | |
- name: Upload network config | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.network }}-network-config | |
path: ${{ steps.bdk.outputs.composeProject }} | |
retention-days: 2 | |
- name: Ensure network is alive | |
working-directory: js-packages/tests | |
id: alive1 | |
if: ${{ !cancelled() && steps.bdk.outcome == 'success' }} | |
run: | | |
yarn | |
yarn add mochawesome | |
../scripts/wait_for_first_block.sh | |
env: | |
RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }} | |
- name: Call HRMP initialization | |
working-directory: js-packages/scripts | |
id: hrmp | |
if: ${{ !cancelled() && steps.alive1.outcome == 'success' }} | |
run: | | |
yarn node --no-warnings=ExperimentalWarning --loader ts-node/esm createHrmp.ts ${{matrix.network}} | |
- name: Run XCM tests | |
working-directory: js-packages/tests | |
id: tests | |
if: ${{ !cancelled() && steps.hrmp.outcome == 'success' }} | |
run: | | |
echo "Ready to start tests" | |
NOW=$(date +%s) && yarn ${{ matrix.runtest }} --reporter mochawesome --reporter-options reportFilename=test-${NOW} | |
env: | |
RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }} | |
- name: XCM Test Report | |
uses: phoenix-actions/test-reporting@v15 | |
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: Remove builder cache | |
if: always() | |
run: | | |
docker system prune -a -f |