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 # extra_node_mixin due to mainnet unique node not supporting --increase-future-pool165 ephemeral:snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.mainnet.outputs.name }}'}}, extra_node_mixin={extraArgs: []})166167 - name: Run Parallel tests before Node Parachain upgrade168 working-directory: ${{ matrix.mainnet_branch }}/tests169 if: success()170 run: |171 yarn172 yarn add mochawesome173 # TODO: Update to new script structure after mainnet will have it174 ./scripts/wait_for_first_block.sh175 echo "Ready to start tests"176 NOW=$(date +%s) && yarn testParallel --reporter mochawesome --reporter-options reportFilename=test-parallel-${NOW}177 env:178 RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}179180 - name: Run Sequential tests before Node Parachain upgrade181 if: success() || failure()182 working-directory: ${{ matrix.mainnet_branch }}/tests183 run: NOW=$(date +%s) && yarn testSequential --reporter mochawesome --reporter-options reportFilename=test-sequential-${NOW}184 env:185 RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}186187 - name: "Reconcile: only one old node"188 if: success() || failure()189 uses: UniqueNetwork/baedeker-action/reconcile@built190 with:191 baedeker: ${{ steps.bdk.outputs.baedeker }}192 193 inputs: |194 snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.latest.outputs.name }}'}}, leave = 1, for_chain = false)195 snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.mainnet.outputs.name }}'}}, for_chain = false)196 snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.mainnet.outputs.name }}'}})197198 - name: Ensure network is alive199 if: success()200 run: |201 ./js-packages/scripts/wait_for_first_block.sh202 env:203 RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}204205 - name: "Reconcile: all nodes are updated"206 if: success() || failure()207 uses: UniqueNetwork/baedeker-action/reconcile@built208 with:209 baedeker: ${{ steps.bdk.outputs.baedeker }}210 211 inputs: |212 snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.latest.outputs.name }}'}}, for_chain = false)213 snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.mainnet.outputs.name }}'}})214215 - name: Run Parallel tests after Node Parachain upgrade216 working-directory: ${{ matrix.mainnet_branch }}/tests217 if: success() || failure() 218 run: |219 yarn install220 yarn add mochawesome221 # TODO: Update to new script structure after mainnet will have it222 ./scripts/wait_for_first_block.sh223 echo "Ready to start tests"224 NOW=$(date +%s) && yarn testParallel --reporter mochawesome --reporter-options reportFilename=test-parallel-${NOW}225 env:226 RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}227228 - name: Run Sequential tests after Node Parachain upgrade229 if: success() || failure()230 working-directory: ${{ matrix.mainnet_branch }}/tests231 run: NOW=$(date +%s) && yarn testSequential --reporter mochawesome --reporter-options reportFilename=test-sequential-${NOW}232 env:233 RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}234235 - name: Remove builder cache236 if: always() 237 run: |238 docker system prune -f