12345on:6 workflow_call:78910jobs:1112 prepare-execution-marix:1314 name: Prepare 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@v3.1.027 with:28 ref: ${{ github.head_ref }} 2930 - name: Read .env file31 uses: xom9ikk/dotenv@v23233 - name: Create Execution matrix34 uses: CertainLach/create-matrix-action@v435 id: create_matrix36 with:37 38 matrix: |39 network {quartz}, wasm_name {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_BRANCH }}}, replica_from_address {${{ env.QUARTZ_REPLICA_FROM }}}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}, extra_features {,state-version-0}40 network {unique}, wasm_name {unique}, mainnet_branch {${{ env.UNIQUE_MAINNET_BRANCH }}}, replica_from_address {${{ env.UNIQUE_REPLICA_FROM }}}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}, extra_features {,state-version-0}41 network {opal}, wasm_name {opal}, mainnet_branch {${{ env.OPAL_MAINNET_BRANCH }}}, replica_from_address {${{ env.OPAL_REPLICA_FROM }}}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}, extra_features {,state-version-0}42 network {sapphire}, wasm_name {quartz}, mainnet_branch {${{ env.SAPPHIRE_MAINNET_BRANCH }}}, replica_from_address {${{ env.SAPPHIRE_REPLICA_FROM }}}, relay_branch {${{ env.UNIQUEEAST_MAINNET_BRANCH }}}, extra_features {,state-version-0}4344 forkless-data-build:45 needs: prepare-execution-marix46 47 runs-on: [self-hosted-ci,large]48 timeout-minutes: 13804950 name: ${{ matrix.network }}-data-build51 strategy:52 matrix:53 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}5455 continue-on-error: true 5657 steps:58 - name: Clean Workspace59 uses: AutoModality/action-clean@v1.1.06061 62 - uses: actions/checkout@v3.1.063 with:64 ref: ${{ github.head_ref }} 6566 - name: Read .env file67 uses: xom9ikk/dotenv@v26869 70 - name: Prepare SHA71 uses: ./.github/actions/prepare7273 74 - name: Generate ENV related extend Dockerfile file75 uses: cuchi/jinja2-action@v1.2.076 with:77 template: .docker/Dockerfile-parachain-upgrade-data.j278 output_file: .docker/Dockerfile-parachain-upgrade-data.${{ matrix.network }}.yml79 variables: |80 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}81 NETWORK=${{ matrix.network }}82 MAINNET_BRANCH=${{ matrix.mainnet_branch }}83 WASM_NAME=${{ matrix.wasm_name }}84 RELAY_CHAIN_TYPE=${{ env.RELAY_CHAIN_TYPE }}85 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}86 REPLICA_FROM=${{ matrix.replica_from_address }}87 CHAINQL=${{ env.CHAINQL }}88 EXTRA_FEATURES=${{ matrix.extra_features }}8990 - name: Show build configuration91 run: cat .docker/Dockerfile-parachain-upgrade-data.${{ matrix.network }}.yml9293 - name: Generate zombienet-forkless-data.toml94 uses: cuchi/jinja2-action@v1.2.095 with:96 template: .docker/forkless-config/zombienet-forkless-data.j297 output_file: .docker/forkless-config/zombienet-forkless-data.toml98 variables: |99 RELAY_CHAIN_TYPE=${{ env.RELAY_CHAIN_TYPE }}100 REPLICA_FROM=${{ matrix.replica_from_address }} 101102 - name: Show zombienet-forkless-data configuration103 run: cat .docker/forkless-config/zombienet-forkless-data.toml104105 - name: Run find-and-replace to remove slashes from branch name106 uses: mad9000/actions-find-and-replace-string@4107 id: branchname108 with:109 source: ${{ github.head_ref }}110 find: '/'111 replace: '-'112113 - name: Set build SHA114 shell: bash115 run: |116 echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV117118 - name: Build the stack119 run: cd .docker/ && docker build --no-cache --file ./Dockerfile-parachain-upgrade-data.${{ matrix.network }}.yml --tag uniquenetwork/ci-forkless-data-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA ../120121 - name: Log in to Docker Hub122 uses: docker/login-action@v2.1.0123 with:124 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}125 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}126127 - name: Push docker image version128 run: docker push uniquenetwork/ci-forkless-data-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA129130 - name: Remove builder cache131 if: always() 132 run: |133 docker builder prune -f134 docker system prune -f135136 forkless-data-tests:137 needs: [prepare-execution-marix, forkless-data-build]138 139 runs-on: [self-hosted-ci, large]140141 timeout-minutes: 600142143 name: ${{ matrix.network }}-data-tests144145 continue-on-error: true 146147 strategy:148 matrix:149 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}150151 steps:152 - name: Skip if pull request is in Draft153 if: github.event.pull_request.draft == true154 run: exit 1155156 - name: Clean Workspace157 uses: AutoModality/action-clean@v1.1.0158159 160 - uses: actions/checkout@v3.1.0161 with:162 ref: ${{ github.head_ref }} 163164 - name: Prepare165 uses: ./.github/actions/prepare166167 - name: Set build SHA168 shell: bash169 run: |170 echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV171172 - name: Run find-and-replace to remove slashes from branch name173 uses: mad9000/actions-find-and-replace-string@4174 id: branchname175 with:176 source: ${{ github.head_ref }}177 find: '/'178 replace: '-'179180 - name: Read .env file181 uses: xom9ikk/dotenv@v2182183 - name: Generate ENV related extend file for docker-compose184 uses: cuchi/jinja2-action@v1.2.0185 with:186 template: .docker/docker-compose.forkless-data.j2187 output_file: .docker/docker-compose.forkless-data.${{ matrix.network }}.yml188 variables: |189 NETWORK=${{ matrix.network }}190 BUILD_TAG=${{ steps.branchname.outputs.value }}-$BUILD_SHA191192 - name: Show build configuration193 run: cat .docker/docker-compose.forkless-data.${{ matrix.network }}.yml194195 - name: Log in to Docker Hub196 uses: docker/login-action@v2.1.0197 with:198 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}199 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}200201 - name: Build the stack202 run: docker-compose -f ".docker/docker-compose.forkless-data.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300203204 - uses: actions/setup-node@v3.5.1205 with:206 node-version: 16207208 - name: Check if docker logs consist logs related to Runtime Upgrade testing.209 if: success()210 run: |211 counter=160212 function check_container_status {213 docker inspect -f {{.State.Running}} forkless-data214 }215 function do_docker_logs {216 docker logs --details forkless-data 2>&1217 }218 function is_started {219 if [ "$(check_container_status)" == "true" ]; then220 echo "Container: forkless-data RUNNING";221 echo "Check Docker logs"222 DOCKER_LOGS=$(do_docker_logs)223 if [[ ${DOCKER_LOGS} = *"🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"* ]];then224 echo "🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"225 return 0226 elif [[ ${DOCKER_LOGS} = *"🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"* ]];then227 echo "🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"228 return 1229 else230 echo "Message not found in logs output, repeating..."231 return 1232 fi233 else234 echo "Container forkless-data not RUNNING"235 echo "Halting all future checks"236 exit 1237 fi238 exit 0239 }240 while ! is_started; do241 echo "Waiting for special message in log files "242 sleep 30s243 counter=$(( $counter - 1 ))244 echo "Counter: $counter"245 if [ "$counter" -gt "0" ]; then246 continue247 else248 echo "Counter reached zero, yet upgrade is not finished"249 exit 1250 fi251 done252 echo "Halting script"253 exit 0254 shell: bash255256 - name: Collect Docker Logs257 if: success() || failure()258 uses: jwalton/gh-docker-logs@v2.2.1259 with:260 dest: './forkless-parachain-upgrade-data-logs.${{ matrix.network }}'261262 - name: Show Docker logs263 if: success() || failure()264 run: cat './forkless-parachain-upgrade-data-logs.${{ matrix.network }}/forkless-data.log'265266 - name: Stop running containers267 if: always() 268 run: docker-compose -f ".docker/docker-compose.forkless-data.${{ matrix.network }}.yml" down --volumes269270 - name: Remove builder cache271 if: always() 272 run: |273 docker builder prune -f -a274 docker system prune -f275 docker image prune -f -a