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}, mainnet_branch {${{ env.OPAL_MAINNET_TAG }}}39 network {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}40 network {unique}, 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 NETWORK=${{ matrix.network }}86 BRANCH=${{ github.head_ref }}87 88 - name: Show build configuration89 run: cat .docker/docker-compose.node.${{ matrix.network }}.yml9091 - name: Generate launch-config-forkless-nodata.json92 uses: cuchi/jinja2-action@v1.2.093 with:94 template: .docker/forkless-config/launch-config-node-update-only-v3.j295 output_file: .docker/launch-config-forkless-nodata.json96 variables: |97 NETWORK=${{ matrix.network }}98 99 - name: Show launch-config-forkless configuration100 run: cat .docker/launch-config-forkless-nodata.json101102 - uses: actions/setup-node@v3103 with:104 node-version: 16105106 - name: Build the stack107 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 300108109 110 - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade.111 if: success()112 run: |113 counter=160114 function check_container_status {115 docker inspect -f {{.State.Running}} node-parachain116 }117 function do_docker_logs {118 docker logs --details node-parachain 2>&1119 }120 function is_started {121 if [ "$(check_container_status)" == "true" ]; then122 echo "Container: node-parachain RUNNING";123 echo "Check Docker logs"124 DOCKER_LOGS=$(do_docker_logs)125 if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then126 echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"127 return 0128 else129 echo "Message not found in logs output, repeating..."130 return 1131 fi132 else133 echo "Container node-parachain NOT RUNNING"134 echo "Halting all future checks"135 exit 1136 fi137 echo "something goes wrong"138 exit 1139 }140 while ! is_started; do141 echo "Waiting for special message in log files "142 sleep 30s143 counter=$(( $counter - 1 ))144 echo "Counter: $counter"145 if [ "$counter" -gt "0" ]; then146 continue147 else148 break149 fi150 done151 echo "Halting script"152 exit 0153 shell: bash154155 - name: Run Parallel tests on Node Parachain156 working-directory: tests157 run: |158 yarn install159 yarn add mochawesome160 echo "Ready to start tests"161 yarn polkadot-types162 NOW=$(date +%s) && yarn testParallel --reporter mochawesome --reporter-options reportFilename=test-parallel-${NOW}163 env:164 RPC_URL: http://127.0.0.1:9933/165166 - name: Parallel Tests report167 uses: phoenix-actions/test-reporting@v8168 id: test-report-parallel169 if: success() || failure() 170 with:171 name: Parallel Tests report - ${{ matrix.network }} 172 path: tests/mochawesome-report/test-parallel-*.json 173 reporter: mochawesome-json174 fail-on-error: 'false'175 176 177 - name: Stop running containers178 if: always() 179 run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.node.${{ matrix.network }}.yml" down --volumes180181 - name: Remove builder cache182 if: always() 183 run: |184 docker builder prune -f -a185 docker system prune -f186 docker image prune -f -a187 188 - name: List files in Workspace189 if: always()190 run: ls -la ./191192 sequential-test:193 needs: nodes-execution-matrix194 195 runs-on: [self-hosted-ci,large]196197 timeout-minutes: 1380198199 name: ${{ matrix.network }} - sequential200201 continue-on-error: true 202203 strategy:204 matrix:205 include: ${{fromJson(needs.nodes-execution-matrix.outputs.matrix)}}206207 steps:208209 - name: Clean Workspace210 uses: AutoModality/action-clean@v1.1.0211212 213 - uses: actions/checkout@v3214 with:215 ref: ${{ github.head_ref }} 216217 - name: Read .env file218 uses: xom9ikk/dotenv@v1.0.2219220 - name: Generate ENV related extend file for docker-compose221 uses: cuchi/jinja2-action@v1.2.0222 with:223 template: .docker/docker-compose.tmp-node.j2224 output_file: .docker/docker-compose.node.${{ matrix.network }}.yml225 variables: |226 REPO_URL=${{ github.server_url }}/${{ github.repository }}.git227 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}228 POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}229 POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }} 230 POLKADOT_MAINNET_BRANCH=${{ env.POLKADOT_MAINNET_BRANCH }}231 MAINNET_TAG=${{ matrix.mainnet_tag }}232 MAINNET_BRANCH=${{ matrix.mainnet_branch }}233 NETWORK=${{ matrix.network }}234 BRANCH=${{ github.head_ref }}235 236 - name: Show build configuration237 run: cat .docker/docker-compose.node.${{ matrix.network }}.yml238239 - name: Generate launch-config-forkless-nodata.json240 uses: cuchi/jinja2-action@v1.2.0241 with:242 template: .docker/forkless-config/launch-config-node-update-only-v3.j2243 output_file: .docker/launch-config-forkless-nodata.json244 variables: |245 NETWORK=${{ matrix.network }}246 247 - name: Show launch-config-forkless configuration248 run: cat .docker/launch-config-forkless-nodata.json249250 - uses: actions/setup-node@v3251 with:252 node-version: 16253254 - name: Build the stack255 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 300256257 258 - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade.259 if: success()260 run: |261 counter=160262 function check_container_status {263 docker inspect -f {{.State.Running}} node-parachain264 }265 function do_docker_logs {266 docker logs --details node-parachain 2>&1267 }268 function is_started {269 if [ "$(check_container_status)" == "true" ]; then270 echo "Container: node-parachain RUNNING";271 echo "Check Docker logs"272 DOCKER_LOGS=$(do_docker_logs)273 if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then274 echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"275 return 0276 else277 echo "Message not found in logs output, repeating..."278 return 1279 fi280 else281 echo "Container node-parachain NOT RUNNING"282 echo "Halting all future checks"283 exit 1284 fi285 echo "something goes wrong"286 exit 1287 }288 while ! is_started; do289 echo "Waiting for special message in log files "290 sleep 30s291 counter=$(( $counter - 1 ))292 echo "Counter: $counter"293 if [ "$counter" -gt "0" ]; then294 continue295 else296 break297 fi298 done299 echo "Halting script"300 exit 0301 shell: bash302303 - name: Run Sequential tests on Node Parachain304 working-directory: tests305 run: |306 yarn install307 yarn add mochawesome308 echo "Ready to start tests"309 yarn polkadot-types310 NOW=$(date +%s) && yarn testSequential --reporter mochawesome --reporter-options reportFilename=test-sequential-${NOW}311 env:312 RPC_URL: http://127.0.0.1:9933/313314 - name: Sequential Tests report315 uses: phoenix-actions/test-reporting@v8316 id: test-report-sequential317 if: success() || failure() 318 with:319 name: Parallel Tests report - ${{ matrix.network }} 320 path: tests/mochawesome-report/test-sequential-*.json 321 reporter: mochawesome-json322 fail-on-error: 'false'323 324 - name: Stop running containers325 if: always() 326 run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.node.${{ matrix.network }}.yml" down --volumes327328 - name: Remove builder cache329 if: always() 330 run: |331 docker builder prune -f -a332 docker system prune -f333 docker image prune -f -a334 335 - name: List files in Workspace336 if: always()337 run: ls -la ./