1name: xcm-tests234on:5 6 workflow_run:7 workflows: ["xcm-testnet-build"]8 types: [requested] 9 10 pull_request:11 branches:12 - master13 types:14 - opened15 - reopened16 - synchronize 17 - ready_for_review1819 20 workflow_dispatch:212223env:24 REPO_URL: ${{ github.server_url }}/${{ github.repository }}2526concurrency:27 group: ${{ github.workflow }}-${{ github.head_ref }}28 cancel-in-progress: true293031jobs:3233 prepare-execution-marix:3435 name: Prepare execution matrix3637 runs-on: XL38 outputs:39 matrix: ${{ steps.create_matrix.outputs.matrix }}4041 steps:4243 - name: Clean Workspace44 uses: AutoModality/action-clean@v1.1.04546 47 - uses: actions/checkout@v348 with:49 ref: ${{ github.head_ref }} 5051 - name: Read .env file52 uses: xom9ikk/dotenv@v1.0.25354 - name: Create Execution matrix55 uses: fabiocaccamo/create-matrix-action@v256 id: create_matrix57 with:58 matrix: |59 network {opal}, runtime {opal}, features {opal-runtime}, runtest {testXcmOpal}60 network {quartz}, runtime {quartz}, features {quartz-runtime}, runtest {testXcmQuartz}61 network {unique}, runtime {unique}, features {unique-runtime}, runtest {testXcmUnique}6263 xcm-tests:64 needs: prepare-execution-marix65 66 runs-on: [XL]6768 timeout-minutes: 6006970 name: ${{ matrix.network }}7172 continue-on-error: true 7374 strategy:75 matrix:76 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}777879 steps:80 - name: Skip if pull request is in Draft81 if: github.event.pull_request.draft == true82 run: exit 18384 - name: Clean Workspace85 uses: AutoModality/action-clean@v1.1.08687 88 - uses: actions/checkout@v389 with:90 ref: ${{ github.head_ref }} 9192 - name: Read .env file93 uses: xom9ikk/dotenv@v1.0.29495 - name: Generate ENV related extend file for docker-compose96 uses: cuchi/jinja2-action@v1.2.097 with:98 template: .docker/docker-compose.tmp-xcm-tests.j299 output_file: .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml100 variables: |101 NETWORK=${{ matrix.network }}102103 - name: Show build configuration104 run: cat .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml105106 - uses: actions/setup-node@v3107 with:108 node-version: 16109110 - name: Build the stack111 run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300112113 114 - name: Check if docker logs consist messages related to testing of xcm tests 115 if: success()116 run: |117 counter=160118 function check_container_status {119 docker inspect -f {{.State.Running}} xcm-${{ matrix.network }}-testnet-local120 }121 function do_docker_logs {122 docker logs --details xcm-${{ matrix.network }}-testnet-local 2>&1123 }124 function is_started {125 if [ "$(check_container_status)" == "true" ]; then126 echo "Container: xcm-${{ matrix.network }}-testnet-local RUNNING";127 echo "Check Docker logs"128 DOCKER_LOGS=$(do_docker_logs)129 if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then130 echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"131 return 0132 else133 echo "Message not found in logs output, repeating..."134 return 1135 fi136 else137 echo "Container xcm-${{ matrix.network }}-testnet-local NOT RUNNING"138 echo "Halting all future checks"139 exit 1140 fi141 echo "something goes wrong"142 exit 1143 }144 while ! is_started; do145 echo "Waiting for special message in log files "146 sleep 30s147 counter=$(( $counter - 1 ))148 echo "Counter: $counter"149 if [ "$counter" -gt "0" ]; then150 continue151 else152 break153 fi154 done155 echo "Halting script"156 exit 0157 shell: bash158159 - name: Run XCM tests 160 working-directory: tests161 run: |162 yarn install163 yarn add mochawesome164 echo "Ready to start tests"165 NOW=$(date +%s) && yarn ${{ matrix.runtest }} --reporter mochawesome --reporter-options reportFilename=test-${NOW}166167 - name: XCM Test Report168 uses: phoenix-actions/test-reporting@v8169 id: test-report170 if: success() || failure() 171 with:172 name: XCM Tests ${{ matrix.network }} 173 path: tests/mochawesome-report/test-*.json 174 reporter: mochawesome-json175 fail-on-error: 'false'176177 - name: Stop running containers178 if: always() 179 run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" down180181 - name: Remove builder cache182 if: always() 183 run: |184 docker system prune -a -f185186 - name: Clean Workspace187 if: always()188 uses: AutoModality/action-clean@v1.1.0