1name: xcm-tests234on:5 6 workflow_run:7 workflows: ["xcm-testnet-build"]8 types: 9 - completed 10 11 pull_request:12 branches:13 - master14 types:15 - opened16 - reopened17 - synchronize 18 - ready_for_review1920 21 workflow_dispatch:222324env:25 REPO_URL: ${{ github.server_url }}/${{ github.repository }}2627concurrency:28 group: ${{ github.workflow }}-${{ github.head_ref }}29 cancel-in-progress: true303132jobs:3334 prepare-execution-marix:3536 name: Prepare execution matrix3738 runs-on: XL39 outputs:40 matrix: ${{ steps.create_matrix.outputs.matrix }}4142 steps:4344 - name: Clean Workspace45 uses: AutoModality/action-clean@v1.1.04647 48 - uses: actions/checkout@v349 with:50 ref: ${{ github.head_ref }} 5152 - name: Read .env file53 uses: xom9ikk/dotenv@v1.0.25455 - name: Create Execution matrix56 uses: fabiocaccamo/create-matrix-action@v257 id: create_matrix58 with:59 matrix: |60 network {opal}, runtime {opal}, features {opal-runtime}, runtest {testXcmOpal}61 network {quartz}, runtime {quartz}, features {quartz-runtime}, runtest {testXcmQuartz}62 network {unique}, runtime {unique}, features {unique-runtime}, runtest {testXcmUnique}6364 xcm-tests:65 needs: prepare-execution-marix66 67 runs-on: [XL]6869 timeout-minutes: 6007071 name: ${{ matrix.network }}7273 continue-on-error: true 7475 strategy:76 matrix:77 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}787980 steps:81 82 83 8485 - name: Clean Workspace86 uses: AutoModality/action-clean@v1.1.08788 89 - uses: actions/checkout@v390 with:91 ref: ${{ github.head_ref }} 9293 - name: Read .env file94 uses: xom9ikk/dotenv@v1.0.29596 - name: Generate ENV related extend file for docker-compose97 uses: cuchi/jinja2-action@v1.2.098 with:99 template: .docker/docker-compose.tmp-xcm-tests.j2100 output_file: .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml101 variables: |102 NETWORK=${{ matrix.network }}103104 - name: Show build configuration105 run: cat .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml106107 - uses: actions/setup-node@v3108 with:109 node-version: 16110111 - name: Build the stack112 run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300113114 115 - name: Check if docker logs consist messages related to testing of xcm tests 116 if: success()117 run: |118 counter=160119 function check_container_status {120 docker inspect -f {{.State.Running}} xcm-${{ matrix.network }}-testnet-local121 }122 function do_docker_logs {123 docker logs --details xcm-${{ matrix.network }}-testnet-local 2>&1124 }125 function is_started {126 if [ "$(check_container_status)" == "true" ]; then127 echo "Container: xcm-${{ matrix.network }}-testnet-local RUNNING";128 echo "Check Docker logs"129 DOCKER_LOGS=$(do_docker_logs)130 if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then131 echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"132 return 0133 else134 echo "Message not found in logs output, repeating..."135 return 1136 fi137 else138 echo "Container xcm-${{ matrix.network }}-testnet-local NOT RUNNING"139 echo "Halting all future checks"140 exit 1141 fi142 echo "something goes wrong"143 exit 1144 }145 while ! is_started; do146 echo "Waiting for special message in log files "147 sleep 30s148 counter=$(( $counter - 1 ))149 echo "Counter: $counter"150 if [ "$counter" -gt "0" ]; then151 continue152 else153 break154 fi155 done156 echo "Halting script"157 exit 0158 shell: bash159160 - name: Run XCM tests 161 working-directory: tests162 run: |163 yarn install164 yarn add mochawesome165 echo "Ready to start tests"166 NOW=$(date +%s) && yarn ${{ matrix.runtest }} --reporter mochawesome --reporter-options reportFilename=test-${NOW}167168 - name: XCM Test Report169 uses: phoenix-actions/test-reporting@v8170 id: test-report171 if: success() || failure() 172 with:173 name: XCM Tests ${{ matrix.network }} 174 path: tests/mochawesome-report/test-*.json 175 reporter: mochawesome-json176 fail-on-error: 'false'177178 - name: Stop running containers179 if: always() 180 run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" down181182 - name: Clean Workspace183 if: always()184 uses: AutoModality/action-clean@v1.1.0185186 - name: Remove builder cache187 if: always() 188 run: |189 docker system prune -a -f190