12name: Integration tests345on:6 workflow_call:78910jobs:1112 nodes-execution-matrix:1314 name: execution matrix1516 runs-on: self-hosted-ci17 outputs:18 matrix: ${{ steps.create_matrix.outputs.matrix }}1920 steps:2122 - name: Clean Workspace23 uses: AutoModality/action-clean@v1.1.02425 26 - uses: actions/checkout@v327 with:28 ref: ${{ github.head_ref }} 2930 - name: Read .env file31 uses: xom9ikk/dotenv@v1.0.23233 - name: Create Execution matrix34 uses: fabiocaccamo/create-matrix-action@v235 id: create_matrix36 with:37 matrix: |38 network {opal}, runtime {opal}, features {opal-runtime}, mainnet_branch {${{ env.OPAL_MAINNET_TAG }}}39 network {quartz}, runtime {quartz}, features {quartz-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}40 network {unique}, runtime {unique}, features {unique-runtime}, mainnet_branch {${{ env.UNIQUE_MAINNET_TAG }}}41 42 parallel-test:43 needs: nodes-execution-matrix44 45 runs-on: [self-hosted-ci,large]46474849 timeout-minutes: 13805051 name: ${{ matrix.network }} - parallel5253 continue-on-error: true 5455 strategy:56 matrix:57 include: ${{fromJson(needs.nodes-execution-matrix.outputs.matrix)}}5859 steps:6061 - name: Clean Workspace62 uses: AutoModality/action-clean@v1.1.06364 65 - uses: actions/checkout@v366 with:67 ref: ${{ github.head_ref }} 6869 - name: Read .env file70 uses: xom9ikk/dotenv@v1.0.27172 - name: Generate ENV related extend file for docker-compose73 uses: cuchi/jinja2-action@v1.2.074 with:75 template: .docker/docker-compose.tmp-node.j276 output_file: .docker/docker-compose.node.${{ matrix.network }}.yml77 variables: |78 REPO_URL=${{ github.server_url }}/${{ github.repository }}.git79 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}80 POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}81 POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }} 82 POLKADOT_MAINNET_BRANCH=${{ env.POLKADOT_MAINNET_BRANCH }}83 MAINNET_TAG=${{ matrix.mainnet_tag }}84 MAINNET_BRANCH=${{ matrix.mainnet_branch }}85 FEATURE=${{ matrix.features }}86 RUNTIME=${{ matrix.runtime }}87 BRANCH=${{ github.head_ref }}88 89 - name: Show build configuration90 run: cat .docker/docker-compose.node.${{ matrix.network }}.yml9192 - name: Generate launch-config-forkless-nodata.json93 uses: cuchi/jinja2-action@v1.2.094 with:95 template: .docker/forkless-config/launch-config-node-update-only-v3.j296 output_file: .docker/launch-config-forkless-nodata.json97 variables: |98 FEATURE=${{ matrix.features }}99 RUNTIME=${{ matrix.runtime }}100 101 - name: Show launch-config-forkless configuration102 run: cat .docker/launch-config-forkless-nodata.json103104 - uses: actions/setup-node@v3105 with:106 node-version: 16107108 - name: Build the stack109 run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.node.${{ matrix.network }}.yml" up -d --build --remove-orphans --force-recreate --timeout 300110111 112 - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade.113 if: success()114 run: |115 counter=160116 function check_container_status {117 docker inspect -f {{.State.Running}} node-parachain118 }119 function do_docker_logs {120 docker logs --details node-parachain 2>&1121 }122 function is_started {123 if [ "$(check_container_status)" == "true" ]; then124 echo "Container: node-parachain RUNNING";125 echo "Check Docker logs"126 DOCKER_LOGS=$(do_docker_logs)127 if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then128 echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"129 return 0130 else131 echo "Message not found in logs output, repeating..."132 return 1133 fi134 else135 echo "Container node-parachain NOT RUNNING"136 echo "Halting all future checks"137 exit 1138 fi139 echo "something goes wrong"140 exit 1141 }142 while ! is_started; do143 echo "Waiting for special message in log files "144 sleep 30s145 counter=$(( $counter - 1 ))146 echo "Counter: $counter"147 if [ "$counter" -gt "0" ]; then148 continue149 else150 break151 fi152 done153 echo "Halting script"154 exit 0155 shell: bash156157 - name: Run Parallel tests on Node Parachain158 working-directory: tests159 run: |160 yarn install161 yarn add mochawesome162 echo "Ready to start tests"163 yarn polkadot-types164 NOW=$(date +%s) && yarn testParallel --reporter mochawesome --reporter-options reportFilename=test-parallel-${NOW}165 env:166 RPC_URL: http://127.0.0.1:9933/167168 - name: Parallel Tests report169 uses: phoenix-actions/test-reporting@v8170 id: test-report-parallel171 if: success() || failure() 172 with:173 name: Parallel Tests report - ${{ matrix.network }} 174 path: tests/mochawesome-report/test-parallel-*.json 175 reporter: mochawesome-json176 fail-on-error: 'false'177 178 179 - name: Stop running containers180 if: always() 181 run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.node.${{ matrix.network }}.yml" down --volumes182183 - name: Remove builder cache184 if: always() 185 run: |186 docker builder prune -f -a187 docker system prune -f188 docker image prune -f -a189 190 - name: List files in Workspace191 if: always()192 run: ls -la ./193194 sequential-test:195 needs: nodes-execution-matrix196 197 runs-on: [self-hosted-ci,large]198199 timeout-minutes: 1380200201 name: ${{ matrix.network }} - sequential202203 continue-on-error: true 204205 strategy:206 matrix:207 include: ${{fromJson(needs.nodes-execution-matrix.outputs.matrix)}}208209 steps:210211 - name: Clean Workspace212 uses: AutoModality/action-clean@v1.1.0213214 215 - uses: actions/checkout@v3216 with:217 ref: ${{ github.head_ref }} 218219 - name: Read .env file220 uses: xom9ikk/dotenv@v1.0.2221222 - name: Generate ENV related extend file for docker-compose223 uses: cuchi/jinja2-action@v1.2.0224 with:225 template: .docker/docker-compose.tmp-node.j2226 output_file: .docker/docker-compose.node.${{ matrix.network }}.yml227 variables: |228 REPO_URL=${{ github.server_url }}/${{ github.repository }}.git229 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}230 POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}231 POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }} 232 POLKADOT_MAINNET_BRANCH=${{ env.POLKADOT_MAINNET_BRANCH }}233 MAINNET_TAG=${{ matrix.mainnet_tag }}234 MAINNET_BRANCH=${{ matrix.mainnet_branch }}235 FEATURE=${{ matrix.features }}236 RUNTIME=${{ matrix.runtime }}237 BRANCH=${{ github.head_ref }}238 239 - name: Show build configuration240 run: cat .docker/docker-compose.node.${{ matrix.network }}.yml241242 - name: Generate launch-config-forkless-nodata.json243 uses: cuchi/jinja2-action@v1.2.0244 with:245 template: .docker/forkless-config/launch-config-node-update-only-v3.j2246 output_file: .docker/launch-config-forkless-nodata.json247 variables: |248 FEATURE=${{ matrix.features }}249 RUNTIME=${{ matrix.runtime }}250 251 - name: Show launch-config-forkless configuration252 run: cat .docker/launch-config-forkless-nodata.json253254 - uses: actions/setup-node@v3255 with:256 node-version: 16257258 - name: Build the stack259 run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.node.${{ matrix.network }}.yml" up -d --build --remove-orphans --force-recreate --timeout 300260261 262 - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade.263 if: success()264 run: |265 counter=160266 function check_container_status {267 docker inspect -f {{.State.Running}} node-parachain268 }269 function do_docker_logs {270 docker logs --details node-parachain 2>&1271 }272 function is_started {273 if [ "$(check_container_status)" == "true" ]; then274 echo "Container: node-parachain RUNNING";275 echo "Check Docker logs"276 DOCKER_LOGS=$(do_docker_logs)277 if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then278 echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"279 return 0280 else281 echo "Message not found in logs output, repeating..."282 return 1283 fi284 else285 echo "Container node-parachain NOT RUNNING"286 echo "Halting all future checks"287 exit 1288 fi289 echo "something goes wrong"290 exit 1291 }292 while ! is_started; do293 echo "Waiting for special message in log files "294 sleep 30s295 counter=$(( $counter - 1 ))296 echo "Counter: $counter"297 if [ "$counter" -gt "0" ]; then298 continue299 else300 break301 fi302 done303 echo "Halting script"304 exit 0305 shell: bash306307 - name: Run Sequential tests on Node Parachain308 working-directory: tests309 run: |310 yarn install311 yarn add mochawesome312 echo "Ready to start tests"313 yarn polkadot-types314 NOW=$(date +%s) && yarn testSequential --reporter mochawesome --reporter-options reportFilename=test-sequential-${NOW}315 env:316 RPC_URL: http://127.0.0.1:9933/317318 - name: Sequential Tests report319 uses: phoenix-actions/test-reporting@v8320 id: test-report-sequential321 if: success() || failure() 322 with:323 name: Parallel Tests report - ${{ matrix.network }} 324 path: tests/mochawesome-report/test-sequential-*.json 325 reporter: mochawesome-json326 fail-on-error: 'false'327 328 - name: Stop running containers329 if: always() 330 run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.node.${{ matrix.network }}.yml" down --volumes331332 - name: Remove builder cache333 if: always() 334 run: |335 docker builder prune -f -a336 docker system prune -f337 docker image prune -f -a338 339 - name: List files in Workspace340 if: always()341 run: ls -la ./