1234name: nodes-only update567on:8 workflow_call:9101112jobs:1314 prepare-execution-matrix:1516 name: execution matrix1718 runs-on: self-hosted-ci19 outputs:20 matrix: ${{ steps.create_matrix.outputs.matrix }}2122 steps:2324 - name: Clean Workspace25 uses: AutoModality/action-clean@v1.1.02627 28 - uses: actions/checkout@v3.1.029 with:30 ref: ${{ github.head_ref }} 3132 - name: Read .env file33 uses: xom9ikk/dotenv@v23435 - name: Create Execution matrix36 uses: CertainLach/create-matrix-action@v437 id: create_matrix38 with:39 matrix: |40 network {opal}, mainnet_branch {${{ env.OPAL_MAINNET_BRANCH }}}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}, runtime_features {opal-runtime}41 network {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_BRANCH }}}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}, runtime_features {quartz-runtime}42 network {unique}, mainnet_branch {${{ env.UNIQUE_MAINNET_BRANCH }}}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}, runtime_features {unique-runtime}4344 node-only-update:4546 needs: prepare-execution-matrix47 48 runs-on: [self-hosted-ci]4950 timeout-minutes: 2880 5152 name: ${{ matrix.network }}5354 continue-on-error: true 5556 strategy:57 matrix:58 include: ${{fromJson(needs.prepare-execution-matrix.outputs.matrix)}}5960 steps:6162 - name: Skip if pull request is in Draft63 if: github.event.pull_request.draft == true64 run: exit 16566 - name: Clean Workspace67 uses: AutoModality/action-clean@v1.1.06869 70 - uses: actions/checkout@v3.1.071 with:72 ref: ${{ github.head_ref }} 7374 75 - name: Prepare SHA76 uses: ./.github/actions/prepare7778 - name: Read .env file79 uses: xom9ikk/dotenv@v28081 - name: Log in to Docker Hub82 uses: docker/login-action@v2.1.083 with:84 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}85 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}8687 - name: Generate ENV related extend Dockerfile file for POLKADOT88 uses: cuchi/jinja2-action@v1.2.089 with:90 template: .docker/Dockerfile-polkadot.j291 output_file: .docker/Dockerfile-polkadot.${{ matrix.relay_branch }}.yml92 variables: |93 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}94 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}95 96 - name: Prepare polkadot97 uses: ./.github/actions/buildContainer98 id: polkadot99 with:100 container: uniquenetwork/builder-polkadot101 tag: ${{ matrix.relay_branch }}102 context: .docker103 dockerfile: Dockerfile-polkadot.${{ matrix.relay_branch }}.yml104 dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}105 dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }}106107 - name: Prepare mainnet108 uses: ./.github/actions/buildContainer109 id: mainnet110 with:111 container: uniquenetwork/ci-node-only-${{ matrix.network }}112 tag: ${{ matrix.mainnet_branch }}113 context: .docker114 dockerfile: Dockerfile-unique-release115 args: |116 --build-arg RUNTIME_FEATURES=${{ matrix.runtime_features }}117 --build-arg RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}118 --build-arg UNIQUE_VERSION=${{ matrix.mainnet_branch }}119 dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}120 dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }}121122 - name: Prepare latest123 uses: ./.github/actions/buildContainer124 id: latest125 with:126 container: uniquenetwork/ci-node-only-${{ matrix.network }}127 tag: ${{ env.REF_SLUG }}-${{ env.BUILD_SHA }}128 context: .129 dockerfile: .docker/Dockerfile-unique130 args: |131 --build-arg RUNTIME_FEATURES=${{ matrix.runtime_features }}132 --build-arg RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}133 dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}134 dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }}135136 - name: Checkout at '${{ matrix.mainnet_branch }}' branch137 uses: actions/checkout@master138 with:139 140 ref: ${{ matrix.mainnet_branch }} 141 path: ${{ matrix.mainnet_branch }}142143 - uses: actions/setup-node@v3.5.1144 with:145 node-version: 18.17.1 146147 - name: Install baedeker148 uses: UniqueNetwork/baedeker-action/setup@built149150 - name: Setup library151 run: mkdir -p .baedeker/vendor/ && git clone https://github.com/UniqueNetwork/baedeker-library .baedeker/vendor/baedeker-library152153 - name: Start network154 uses: UniqueNetwork/baedeker-action@built155 id: bdk156 with:157 jpath: |158 .baedeker/vendor159 tla-str: |160 relay_spec=${{ env.RELAY_CHAIN_TYPE }}-local161 inputs: |162 .baedeker/node-only.jsonnet163 snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadot':{dockerImage:'${{ steps.polkadot.outputs.name }}'}})164 ephemeral:snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.mainnet.outputs.name }}'}})165166 - name: Run Parallel tests before Node Parachain upgrade167 working-directory: ${{ matrix.mainnet_branch }}/tests168 if: success()169 run: |170 yarn171 yarn add mochawesome172 # TODO: Update to new script structure after mainnet will have it173 ./scripts/wait_for_first_block.sh174 echo "Ready to start tests"175 NOW=$(date +%s) && yarn testParallel --reporter mochawesome --reporter-options reportFilename=test-parallel-${NOW}176 env:177 RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}178179 - name: Run Sequential tests before Node Parachain upgrade180 if: success() || failure()181 working-directory: ${{ matrix.mainnet_branch }}/tests182 run: NOW=$(date +%s) && yarn testSequential --reporter mochawesome --reporter-options reportFilename=test-sequential-${NOW}183 env:184 RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}185186 - name: "Reconcile: only one old node"187 if: success() || failure()188 uses: UniqueNetwork/baedeker-action/reconcile@built189 with:190 baedeker: ${{ steps.bdk.outputs.baedeker }}191 192 inputs: |193 snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.latest.outputs.name }}'}}, leave = 1, for_chain = false)194 snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.mainnet.outputs.name }}'}}, for_chain = false)195 snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.mainnet.outputs.name }}'}})196197 - name: Ensure network is alive198 if: success()199 run: |200 ./js-packages/scripts/wait_for_first_block.sh201 env:202 RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}203204 - name: "Reconcile: all nodes are updated"205 if: success() || failure()206 uses: UniqueNetwork/baedeker-action/reconcile@built207 with:208 baedeker: ${{ steps.bdk.outputs.baedeker }}209 210 inputs: |211 snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.latest.outputs.name }}'}}, for_chain = false)212 snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.mainnet.outputs.name }}'}})213214 - name: Run Parallel tests after Node Parachain upgrade215 working-directory: ${{ matrix.mainnet_branch }}/tests216 if: success() || failure() 217 run: |218 yarn install219 yarn add mochawesome220 # TODO: Update to new script structure after mainnet will have it221 ./scripts/wait_for_first_block.sh222 echo "Ready to start tests"223 NOW=$(date +%s) && yarn testParallel --reporter mochawesome --reporter-options reportFilename=test-parallel-${NOW}224 env:225 RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}226227 - name: Run Sequential tests after Node Parachain upgrade228 if: success() || failure()229 working-directory: ${{ matrix.mainnet_branch }}/tests230 run: NOW=$(date +%s) && yarn testSequential --reporter mochawesome --reporter-options reportFilename=test-sequential-${NOW}231 env:232 RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}233234 - name: Remove builder cache235 if: always() 236 run: |237 docker system prune -f