git.delta.rocks / unique-network / refs/commits / f48afb4f7913

difftreelog

source

.github/workflows/node-only-update.yml10.1 KiBsourcehistory
1# https://cryptousetech.atlassian.net/wiki/spaces/CI/pages/2586837028/Nodes+only+update2# Node only update with restart polkadot-launch process.34name: node-only-update56# Triger: only call from main workflow(re-usable workflows)7on:8  workflow_call:9  workflow_dispatch:101112# A workflow run is made up of one or more jobs that can run sequentially or in parallel13jobs:1415  prepare-execution-matrix:1617    name: execution matrix1819    runs-on: [ self-hosted-ci ]20    outputs:21      matrix: ${{ steps.create_matrix.outputs.matrix }}2223    steps:2425      - name: Clean Workspace26        uses: AutoModality/action-clean@v1.1.02728      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it29      - uses: actions/checkout@v4.1.730        with:31          ref: ${{ github.head_ref }}  #Checking out head commit3233      - name: Read .env file34        uses: xom9ikk/dotenv@v2.3.03536      - name: Create Execution matrix37        uses: CertainLach/create-matrix-action@v438        id: create_matrix39        with:40          matrix: |41            network {opal}, mainnet_branch {${{ env.OPAL_MAINNET_BRANCH }}}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}42            network {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_BRANCH }}}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}43            network {unique}, mainnet_branch {${{ env.UNIQUE_MAINNET_BRANCH }}}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}4445  node-only-update:4647    needs: prepare-execution-matrix48    # The type of runner that the job will run on49    runs-on: [ self-hosted-ci ]5051    timeout-minutes: 2880           # 48 hours for execution jobs.5253    name: ${{ matrix.network }}5455    continue-on-error: true         #Do not stop testing of matrix runs failed.  As it decided during PR review - it required 50/50& Let's check it with false.5657    strategy:58      matrix:59        include: ${{fromJson(needs.prepare-execution-matrix.outputs.matrix)}}6061    steps:6263      - name: Skip if pull request is in Draft64        if: github.event.pull_request.draft == true65        run: exit 16667      - name: Clean Workspace68        uses: AutoModality/action-clean@v1.1.06970      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it71      - uses: actions/checkout@v4.1.772        with:73          ref: ${{ github.head_ref }}  #Checking out head commit7475      # Prepare SHA  76      - name: Prepare SHA77        uses: ./.github/actions/prepare7879      - name: Read .env file80        uses: xom9ikk/dotenv@v2.3.08182      - name: Log in to Docker Hub83        uses: docker/login-action@v3.2.084        with:85          username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}86          password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}8788      - name: Check and pull polkadot image89        id: polkadot90        uses: cloudposse/github-action-docker-image-exists@main91        with:92          registry: registry.hub.docker.com93          organization: parity94          repository: polkadot95          login: ${{ secrets.CORE_DOCKERHUB_USERNAME }}96          password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}97          tag: ${{ matrix.relay_branch }}9899      - name: Prepare mainnet100        uses: ./.github/actions/buildContainer101        id: mainnet102        with:103          container: uniquenetwork/ci-node-only-${{ matrix.network }}104          tag: ${{ matrix.mainnet_branch }}105          context: .docker106          dockerfile: Dockerfile-unique-release107          args: |108            --build-arg FEATURES=${{ matrix.network }}-runtime109            --build-arg UNIQUE_VERSION=${{ matrix.mainnet_branch }}110          dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}111          dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }}112113      - name: Prepare latest114        uses: ./.github/actions/buildContainer115        id: latest116        with:117          container: uniquenetwork/ci-node-only-${{ matrix.network }}118          tag: ${{ env.REF_SLUG }}-${{ env.BUILD_SHA }}119          context: .120          dockerfile: .docker/Dockerfile-unique121          args: |122            --build-arg FEATURES=${{ matrix.network }}-runtime123          dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}124          dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }}125126      - name: Checkout at '${{ matrix.mainnet_branch }}' branch127        uses: actions/checkout@v4.1.7128        with:129          #ref: ${{ github.head_ref }}130          ref: ${{ matrix.mainnet_branch }}  #Checking out head commit131          path: ${{ matrix.mainnet_branch }}132133      - uses: actions/setup-node@v4.0.2134        with:135          node-version: 20136137      - name: Install baedeker138        uses: UniqueNetwork/baedeker-action/setup@v1-no-debug-output139        with:140          useCache: false        141142      - name: Setup library143        run: mkdir -p .baedeker/vendor/ && git clone https://github.com/UniqueNetwork/baedeker-library .baedeker/vendor/baedeker-library144145      - name: Start network146        uses: UniqueNetwork/baedeker-action@v1-no-debug-output147        if: success()148        id: bdk149        with:150          jpath: |151            .baedeker/vendor152          tla-str: |153            relay_spec=${{ env.RELAY_CHAIN_TYPE }}-local154          inputs: |155            .baedeker/node-only.jsonnet156            snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadot':{dockerImage:'${{ steps.polkadot.outputs.image }}:${{ steps.polkadot.outputs.tag }}'}})157            ephemeral:snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.mainnet.outputs.name }}'}}, extra_node_mixin={extraArgs: []})158159      - name: Ensure network is alive160        working-directory: ${{ matrix.mainnet_branch }}/js-packages/tests161        id: alive1162        if: ${{ !cancelled() && steps.bdk.outcome == 'success' }}163        run: |164          yarn165          yarn add mochawesome166          ../scripts/wait_for_first_block.sh167        env:168          RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}169170      - name: Run Parallel tests before Node Parachain upgrade171        working-directory: ${{ matrix.mainnet_branch }}/js-packages/tests172        if: ${{ !cancelled() && steps.alive1.outcome == 'success' }}173        run: |174          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: ${{ !cancelled() && steps.alive1.outcome == 'success' }}181        working-directory: ${{ matrix.mainnet_branch }}/js-packages/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: ${{ !cancelled() && steps.alive1.outcome == 'success' }}188        id: reconcile1189        uses: UniqueNetwork/baedeker-action/reconcile@v1-no-debug-output190        with:191          baedeker: ${{ steps.bdk.outputs.baedeker }}192          # Chain should always be built with the mainnet spec, this we first set binary for all nodes expect one, then set mainnet binary for the last node, and then force chainspec to be still generated from mainnet193          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        working-directory: ${{ matrix.mainnet_branch }}/js-packages/tests200        id: alive2201        if: ${{ !cancelled() && steps.reconcile1.outcome == 'success' }}202        run: |203          ../scripts/wait_for_first_block.sh204        env:205          RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}206207      - name: "Reconcile: all nodes are updated"208        if: ${{ !cancelled() && steps.alive2.outcome == 'success' }}209        id: reconcile2210        uses: UniqueNetwork/baedeker-action/reconcile@v1-no-debug-output211        with:212          baedeker: ${{ steps.bdk.outputs.baedeker }}213          # Chain should always be built with the mainnet spec, this we first set binary for all nodes, and then force chainspec to be still generated from mainnet214          inputs: |215            snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.latest.outputs.name }}'}}, for_chain = false)216            snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.mainnet.outputs.name }}'}})217218      - name: Ensure network is alive219        working-directory: ${{ matrix.mainnet_branch }}/js-packages/tests220        id: alive3221        if: ${{ !cancelled() && steps.reconcile2.outcome == 'success' }}222        run: |223          ../scripts/wait_for_first_block.sh224        env:225          RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}226227      - name: Run Parallel tests after Node Parachain upgrade228        working-directory: ${{ matrix.mainnet_branch }}/js-packages/tests229        if: ${{ !cancelled() && steps.alive3.outcome == 'success' }}230        run: |231          echo "Ready to start tests"232          NOW=$(date +%s) && yarn testParallel --reporter mochawesome --reporter-options reportFilename=test-parallel-${NOW}233        env:234          RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}235236      - name: Run Sequential tests after Node Parachain upgrade237        if: ${{ !cancelled() && steps.alive3.outcome == 'success' }}238        working-directory: ${{ matrix.mainnet_branch }}/js-packages/tests239        run: NOW=$(date +%s) && yarn testSequential --reporter mochawesome --reporter-options reportFilename=test-sequential-${NOW}240        env:241          RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}242243      - name: Remove builder cache244        if: always()                   # run this step always245        run: |246          docker system prune -f