12345on:6 workflow_call:78910jobs:11 prepare-execution-marix:1213 name: Prepare execution matrix1415 runs-on: self-hosted-ci16 outputs:17 matrix: ${{ steps.create_matrix.outputs.matrix }}1819 steps:2021 - name: Clean Workspace22 uses: AutoModality/action-clean@v1.1.02324 25 - uses: actions/checkout@v3.1.026 with:27 ref: ${{ github.head_ref }} 2829 - name: Read .env file30 uses: xom9ikk/dotenv@v23132 - name: Create Execution matrix33 uses: CertainLach/create-matrix-action@v434 id: create_matrix35 with:36 matrix: |37 network {quartz}, wasm_name {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_BRANCH }}}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}38 network {unique}, wasm_name {unique}, mainnet_branch {${{ env.UNIQUE_MAINNET_BRANCH }}}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}39 network {opal}, wasm_name {opal}, mainnet_branch {${{ env.OPAL_MAINNET_BRANCH }}}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}40 network {sapphire}, wasm_name {quartz}, mainnet_branch {${{ env.SAPPHIRE_MAINNET_BRANCH }}}, relay_branch {${{ env.UNIQUEEAST_MAINNET_BRANCH }}}414243 forkless-nodata-build:44 needs: prepare-execution-marix45 46 runs-on: [self-hosted-ci,large]4748 timeout-minutes: 13804950 name: ${{ matrix.network }}-nodata-build5152 continue-on-error: true 5354 strategy:55 matrix:56 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}5758 steps:59 - name: Clean Workspace60 uses: AutoModality/action-clean@v1.1.06162 63 - uses: actions/checkout@v3.1.064 with:65 ref: ${{ github.head_ref }} 6667 - name: Read .env file68 uses: xom9ikk/dotenv@v26970 71 - name: Prepare SHA72 uses: ./.github/actions/prepare7374 - name: Log in to Docker Hub75 uses: docker/login-action@v2.1.076 with:77 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}78 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}7980 81 - name: Generate ENV related extend Dockerfile file82 uses: cuchi/jinja2-action@v1.2.083 with:84 template: .docker/Dockerfile-parachain-upgrade.j285 output_file: .docker/Dockerfile-parachain-upgrade.${{ matrix.network }}.yml86 variables: |87 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}88 NETWORK=${{ matrix.network }}89 MAINNET_BRANCH=${{ matrix.mainnet_branch }}90 WASM_NAME=${{ matrix.wasm_name }}91 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}92 POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }}9394 - name: Show build Dockerfile95 run: cat .docker/Dockerfile-parachain-upgrade.${{ matrix.network }}.yml9697 - name: Generate launch-config-forkless-nodata.json98 uses: cuchi/jinja2-action@v1.2.099 with:100 template: .docker/forkless-config/launch-config-forkless-nodata.j2101 output_file: .docker/forkless-config/launch-config-forkless-nodata.json102 variables: |103 WASM_NAME=${{ matrix.wasm_name }}104 RELAY_CHAIN_TYPE=${{ env.RELAY_CHAIN_TYPE }}105106 - name: Show launch-config-forkless configuration107 run: cat .docker/forkless-config/launch-config-forkless-nodata.json108109 - name: Run find-and-replace to remove slashes from branch name110 uses: mad9000/actions-find-and-replace-string@4111 id: branchname112 with:113 source: ${{ github.head_ref }}114 find: '/'115 replace: '-'116117 - name: Set build SHA118 shell: bash119 run: |120 echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV121122 - name: Build the stack123 run: cd .docker/ && docker build --no-cache --file ./Dockerfile-parachain-upgrade.${{ matrix.network }}.yml --tag uniquenetwork/ci-forkless-nodata-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA ../124125 - name: Push docker image version126 run: docker push uniquenetwork/ci-forkless-nodata-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA127128 - name: Remove builder cache129 if: always() 130 run: |131 docker builder prune -f132 docker system prune -f133134135 forkless-nodata-tests:136 needs: [prepare-execution-marix, forkless-nodata-build]137 138 runs-on: [self-hosted-ci, large]139140 timeout-minutes: 600141142 name: ${{ matrix.network }}-nodata-tests143144 continue-on-error: true 145146 strategy:147 matrix:148 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}149150 steps:151 - name: Skip if pull request is in Draft152 if: github.event.pull_request.draft == true153 run: exit 1154155 - name: Clean Workspace156 uses: AutoModality/action-clean@v1.1.0157158 159 - uses: actions/checkout@v3.1.0160 with:161 ref: ${{ github.head_ref }} 162163 - name: Prepare164 uses: ./.github/actions/prepare165166 - name: Set build SHA167 shell: bash168 run: |169 echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV170171 - name: Run find-and-replace to remove slashes from branch name172 uses: mad9000/actions-find-and-replace-string@4173 id: branchname174 with:175 source: ${{ github.head_ref }}176 find: '/'177 replace: '-'178179 - name: Read .env file180 uses: xom9ikk/dotenv@v2181182 - name: Generate ENV related extend file for docker-compose183 uses: cuchi/jinja2-action@v1.2.0184 with:185 template: .docker/docker-compose.forkless-nodata.j2186 output_file: .docker/docker-compose.forkless-nodata.${{ matrix.network }}.yml187 variables: |188 NETWORK=${{ matrix.network }}189 BUILD_TAG=${{ steps.branchname.outputs.value }}-$BUILD_SHA190191 - name: Show build configuration192 run: cat .docker/docker-compose.forkless-nodata.${{ matrix.network }}.yml193194 - name: Log in to Docker Hub195 uses: docker/login-action@v2.1.0196 with:197 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}198 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}199200 - name: Build the stack201 run: docker-compose -f ".docker/docker-compose.forkless-nodata.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300202203 - uses: actions/setup-node@v3.5.1204 with:205 node-version: 16206207 - name: Check if docker logs consist logs related to Runtime Upgrade testing.208 if: success()209 run: |210 counter=160211 function check_container_status {212 docker inspect -f {{.State.Running}} forkless-nodata213 }214 function do_docker_logs {215 docker logs --details forkless-nodata 2>&1216 }217 function is_started {218 if [ "$(check_container_status)" == "true" ]; then219 echo "Container: forkless-nodata RUNNING";220 echo "Check Docker logs"221 DOCKER_LOGS=$(do_docker_logs)222 if [[ ${DOCKER_LOGS} = *"🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"* ]];then223 echo "🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"224 return 0225 elif [[ ${DOCKER_LOGS} = *"🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"* ]];then226 echo "🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"227 return 1228 else229 echo "Message not found in logs output, repeating..."230 return 1231 fi232 else233 echo "Container forkless-nodata not RUNNING"234 echo "Halting all future checks"235 exit 1236 fi237 exit 0238 }239 while ! is_started; do240 echo "Waiting for special message in log files "241 sleep 30s242 counter=$(( $counter - 1 ))243 echo "Counter: $counter"244 if [ "$counter" -gt "0" ]; then245 continue246 else247 break248 fi249 done250 echo "Halting script"251 exit 0252 shell: bash253254 - name: Collect Docker Logs255 if: success() || failure()256 uses: jwalton/gh-docker-logs@v2.2.1257 with:258 dest: './forkless-parachain-upgrade-nodata-logs.${{ matrix.network }}'259260 - name: Show docker logs261 if: success() || failure()262 run: cat './forkless-parachain-upgrade-nodata-logs.${{ matrix.network }}/forkless-nodata.log'263264 - name: Run Parallel tests265 working-directory: tests266 run: |267 yarn install268 yarn add mochawesome269 ./scripts/wait_for_first_block.sh270 echo "Ready to start tests"271 NOW=$(date +%s) && yarn testParallel --reporter mochawesome --reporter-options reportFilename=test-parallel-${NOW}272 env:273 RPC_URL: http://127.0.0.1:9944/274275 - name: Test Report Parallel276 uses: phoenix-actions/test-reporting@v10277 id: test-report-parallel278 if: success() || failure() 279 with:280 name: Report Parallel tests results - ${{ matrix.network }} 281 path: tests/mochawesome-report/test-parallel-*.json 282 reporter: mochawesome-json283 fail-on-error: 'false'284285 - name: Run Sequential tests286 working-directory: tests287 if: success() || failure()288 run: |289 yarn install290 yarn add mochawesome291 ./scripts/wait_for_first_block.sh292 echo "Ready to start tests"293 NOW=$(date +%s) && yarn testSequential --reporter mochawesome --reporter-options reportFilename=test-sequential-${NOW}294 env:295 RPC_URL: http://127.0.0.1:9944/296297 - name: Test Report Sequential298 uses: phoenix-actions/test-reporting@v10299 id: test-report-sequential300 if: success() || failure() 301 with:302 name: Report Sequential tests results - ${{ matrix.network }} 303 path: tests/mochawesome-report/test-sequential-*.json 304 reporter: mochawesome-json305 fail-on-error: 'false'306307 - name: Stop running containers308 if: always() 309 run: docker-compose -f ".docker/docker-compose.forkless-nodata.${{ matrix.network }}.yml" down310311 - name: Remove builder cache312 if: always() 313 run: |314 docker builder prune -f -a315 docker system prune -f316 docker image prune -f -a