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 DESTINATION_SPEC_VERSION=${{ env.DESTINATION_SPEC_VERSION }}86 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}87 REPLICA_FROM=${{ matrix.replica_from_address }}88 CHAINQL=${{ env.CHAINQL }}89 EXTRA_FEATURES=${{ matrix.extra_features }}9091 - name: Show build configuration92 run: cat .docker/Dockerfile-parachain-upgrade-data.${{ matrix.network }}.yml9394 - name: Run find-and-replace to remove slashes from branch name95 uses: mad9000/actions-find-and-replace-string@496 id: branchname97 with:98 source: ${{ github.head_ref }}99 find: '/'100 replace: '-'101102 - name: Set build SHA103 shell: bash104 run: |105 echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV106107 - name: Build the stack108 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 ../109110 - name: Log in to Docker Hub111 uses: docker/login-action@v2.1.0112 with:113 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}114 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}115116 - name: Push docker image version117 run: docker push uniquenetwork/ci-forkless-data-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA118119 - name: Remove builder cache120 if: always() 121 run: |122 docker builder prune -f123 docker system prune -f124125 forkless-data-tests:126 needs: [prepare-execution-marix, forkless-data-build]127 128 runs-on: [self-hosted-ci, large]129130 timeout-minutes: 600131132 name: ${{ matrix.network }}-data-tests133134 continue-on-error: true 135136 strategy:137 matrix:138 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}139140 steps:141 - name: Skip if pull request is in Draft142 if: github.event.pull_request.draft == true143 run: exit 1144145 - name: Clean Workspace146 uses: AutoModality/action-clean@v1.1.0147148 149 - uses: actions/checkout@v3.1.0150 with:151 ref: ${{ github.head_ref }} 152153 - name: Prepare154 uses: ./.github/actions/prepare155156 - name: Set build SHA157 shell: bash158 run: |159 echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV160161 - name: Run find-and-replace to remove slashes from branch name162 uses: mad9000/actions-find-and-replace-string@4163 id: branchname164 with:165 source: ${{ github.head_ref }}166 find: '/'167 replace: '-'168169 - name: Read .env file170 uses: xom9ikk/dotenv@v2171172 - name: Generate ENV related extend file for docker-compose173 uses: cuchi/jinja2-action@v1.2.0174 with:175 template: .docker/docker-compose.forkless-data.j2176 output_file: .docker/docker-compose.forkless-data.${{ matrix.network }}.yml177 variables: |178 NETWORK=${{ matrix.network }}179 BUILD_TAG=${{ steps.branchname.outputs.value }}-$BUILD_SHA180 DESTINATION_SPEC_VERSION=${{ env.DESTINATION_SPEC_VERSION }}181182 - name: Show build configuration183 run: cat .docker/docker-compose.forkless-data.${{ matrix.network }}.yml184185 - name: Log in to Docker Hub186 uses: docker/login-action@v2.1.0187 with:188 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}189 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}190191 - name: Build the stack192 run: docker-compose -f ".docker/docker-compose.forkless-data.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300193194 - uses: actions/setup-node@v3.5.1195 with:196 node-version: 16197198 - name: Check if docker logs consist logs related to Runtime Upgrade testing.199 if: success()200 run: |201 counter=160202 function check_container_status {203 docker inspect -f {{.State.Running}} forkless-data204 }205 function do_docker_logs {206 docker logs --details forkless-data 2>&1207 }208 function is_started {209 if [ "$(check_container_status)" == "true" ]; then210 echo "Container: forkless-data RUNNING";211 echo "Check Docker logs"212 DOCKER_LOGS=$(do_docker_logs)213 if [[ ${DOCKER_LOGS} = *"🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"* ]];then214 echo "🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"215 return 0216 elif [[ ${DOCKER_LOGS} = *"🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"* ]];then217 echo "🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"218 return 1219 else220 echo "Message not found in logs output, repeating..."221 return 1222 fi223 else224 echo "Container forkless-data not RUNNING"225 echo "Halting all future checks"226 exit 1227 fi228 exit 0229 }230 while ! is_started; do231 echo "Waiting for special message in log files "232 sleep 30s233 counter=$(( $counter - 1 ))234 echo "Counter: $counter"235 if [ "$counter" -gt "0" ]; then236 continue237 else238 echo "Counter reached zero, yet upgrade is not finished"239 exit 1240 fi241 done242 echo "Halting script"243 exit 0244 shell: bash245246 - name: Collect Docker Logs247 if: success() || failure()248 uses: jwalton/gh-docker-logs@v2.2.1249 with:250 dest: './forkless-parachain-upgrade-data-logs.${{ matrix.network }}'251252 - name: Show Docker logs253 if: success() || failure()254 run: cat './forkless-parachain-upgrade-data-logs.${{ matrix.network }}/forkless-data.log'255256 - name: Stop running containers257 if: always() 258 run: docker-compose -f ".docker/docker-compose.forkless-data.${{ matrix.network }}.yml" down --volumes259260 - name: Remove builder cache261 if: always() 262 run: |263 docker builder prune -f -a264 docker system prune -f265 docker image prune -f -a