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

difftreelog

source

.github/workflows/forkless-update-data.yml6.9 KiBsourcehistory
1# Forkless update with data replication2# https://cryptousetech.atlassian.net/wiki/spaces/CI/pages/2586869792/Forkless+update+with+data34# Triger: only call from main workflow(re-usable workflows)5name: forkless-update-data67on: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 }}}, fork_source {${{ env.OPAL_REPLICA_FROM }}}42            network {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_BRANCH }}}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}, fork_source {${{ env.QUARTZ_REPLICA_FROM }}}43            network {unique}, mainnet_branch {${{ env.UNIQUE_MAINNET_BRANCH }}}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}, fork_source {${{ env.UNIQUE_REPLICA_FROM }}}4445  forkless-data:4647    needs: prepare-execution-matrix48    # The type of runner that the job will run on49    runs-on: [ self-hosted-ci,large ]5051    timeout-minutes: 13805253    name: ${{ matrix.network }}-data5455    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: Clean Workspace64        uses: AutoModality/action-clean@v1.1.06566      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it67      - uses: actions/checkout@v4.1.768        with:69          ref: ${{ github.head_ref }}  #Checking out head commit7071      # Prepare SHA  72      - name: Prepare SHA73        uses: ./.github/actions/prepare7475      - name: Read .env file76        uses: xom9ikk/dotenv@v2.3.07778      - name: Log in to Docker Hub79        uses: docker/login-action@v3.2.080        with:81          username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}82          password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}8384      - name: Check and pull polkadot image85        id: polkadot86        uses: cloudposse/github-action-docker-image-exists@main87        with:88          registry: registry.hub.docker.com89          organization: parity90          repository: polkadot91          login: ${{ secrets.CORE_DOCKERHUB_USERNAME }}92          password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}93          tag: ${{ matrix.relay_branch }}9495      - name: Prepare latest96        uses: ./.github/actions/buildContainer97        id: latest98        with:99          container: uniquenetwork/ci-data-${{ matrix.network }}100          tag: ${{ env.REF_SLUG }}-${{ env.BUILD_SHA }}101          context: .102          dockerfile: .docker/Dockerfile-unique103          args: |104            --build-arg FEATURES=${{ matrix.network }}-runtime105          dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}106          dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }}107108      - name: Extract wasms109        uses: ./.github/actions/extractDocker110        id: wasms111        with:112          image: ${{ steps.latest.outputs.name }}113          directory: /wasm114115      - uses: actions/setup-node@v4.0.2116        with:117          node-version: 20118119      - name: Install baedeker120        uses: UniqueNetwork/baedeker-action/setup@v1-no-debug-output121        with:122          useCache: false        123124      - name: Setup library125        run: mkdir -p .baedeker/vendor/ && git clone https://github.com/UniqueNetwork/baedeker-library .baedeker/vendor/baedeker-library126127      - name: Start network128        uses: UniqueNetwork/baedeker-action@v1-no-debug-output129        if: success()130        id: bdk131        with:132          jpath: |133            .baedeker/vendor134          tla-str: |135            relay_spec=${{ env.RELAY_CHAIN_TYPE }}-local136            forked_spec=${{ matrix.network }}137            fork_source=${{ matrix.fork_source }}138          inputs: |139            .baedeker/forkless-data.jsonnet140            snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadot':{dockerImage:'${{ steps.polkadot.outputs.image }}:${{ steps.polkadot.outputs.tag }}'}})141            snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.latest.outputs.name }}'}})142143      - name: Ensure network is alive144        working-directory: js-packages/tests145        id: alive1146        if: ${{ !cancelled() && steps.bdk.outcome == 'success' }}147        run: |148          yarn        149          ../scripts/wait_for_first_block.sh150        env:151          RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}152153      - name: "Reconcile: runtime is upgraded"154        working-directory: js-packages/tests155        id: reconcile1156        if: ${{ !cancelled() && steps.alive1.outcome == 'success' }}157        run: |158          echo "Executing upgrade"159          yarn node --no-warnings=ExperimentalWarning --loader ts-node/esm ../scripts/authorizeEnactUpgrade.ts ${{ steps.wasms.outputs.dir }}/${{ matrix.network }}-runtime/${{ matrix.network }}_runtime.compact.compressed.wasm160        env:161          RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}162163      - name: Ensure network is alive164        working-directory: js-packages/tests165        id: alive2166        if: ${{ !cancelled() && steps.reconcile1.outcome == 'success' }}167        run: |168          yarn        169          ../scripts/wait_for_first_block.sh170        env:171          RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}172173      - name: Run Parallel tests after forkless upgrade174        working-directory: js-packages/tests175        if: ${{ !cancelled() && steps.alive2.outcome == 'success' }}176        run: |177          echo "Ready to start tests"178          NOW=$(date +%s) && yarn testParallel --reporter mochawesome --reporter-options reportFilename=test-parallel-${NOW}179        env:180          RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}181182      - name: Run Sequential tests after forkless upgrade183        working-directory: js-packages/tests184        if: ${{ !cancelled() && steps.alive2.outcome == 'success' }}185        run: |186          NOW=$(date +%s) && yarn testSequential --reporter mochawesome --reporter-options reportFilename=test-sequential-${NOW}187        env:188          RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}189190      - name: Remove builder cache191        if: always()                   # run this step always192        run: |193          docker system prune -f