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

difftreelog

source

.github/workflows/forkless-update-nodata.yml7.4 KiBsourcehistory
1name: Forkless Parachain update with no data23# Controls when the action will run.4on:5 # Triggers the workflow on push or pull request events but only for the master branch6  pull_request:7    branches:8      - develop9    types:10      - opened11      - reopened12      - synchronize   #commit(s) pushed to the pull request1314  # Allows you to run this workflow manually from the Actions tab15  workflow_dispatch:1617#Define Workflow variables18env:19  REPO_URL: ${{ github.server_url }}/${{ github.repository }}2021# A workflow run is made up of one or more jobs that can run sequentially or in parallel22jobs:2324  prepare-execution-marix:25    26    name: Prepare execution matrix27    28    runs-on: self-hosted-ci29    outputs:30      matrix: ${{ steps.create_matrix.outputs.matrix }}31    steps:32      33      - name: Clean Workspace34        uses: AutoModality/action-clean@v1.1.03536      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it37      - uses: actions/checkout@v338        with:39          ref: ${{ github.head_ref }}  #Checking out head commit4041      - name: Read .env file42        uses: xom9ikk/dotenv@v1.0.24344      - name: Create Execution matrix45        uses: fabiocaccamo/create-matrix-action@v246        id: create_matrix47        with:48          matrix: |49            network {Opal}, runtime {opal}, features {opal-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}50            network {Quartz}, runtime {quartz}, features {quartz-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}51            network {Unique}, runtime {unique}, features {unique-runtime}, mainnet_branch {${{ env.UNIQUE_MAINNET_TAG }}}52535455  forkless-update-nodata:56    needs: prepare-execution-marix57    # The type of runner that the job will run on58    runs-on: self-hosted-ci5960    name: Build Container, Spin it Up an test6162    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.6364    strategy:65      matrix:66        include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}676869    steps:70#      - name: Skip if pull request is in Draft71        # `if: github.event.pull_request.draft == true` should be kept here, at72        # the step level, rather than at the job level. The latter is not73        # recommended because when the PR is moved from "Draft" to "Ready to74        # review" the workflow will immediately be passing (since it was skipped),75        # even though it hasn't actually ran, since it takes a few seconds for76        # the workflow to start. This is also disclosed in:77        # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/1778        # That scenario would open an opportunity for the check to be bypassed:79        # 1. Get your PR approved80        # 2. Move it to Draft81        # 3. Push whatever commits you want82        # 4. Move it to "Ready for review"; now the workflow is passing (it was83        #    skipped) and "Check reviews" is also passing (it won't be updated84        #    until the workflow is finished)85#        if: github.event.pull_request.draft == true86#        run: exit 18788      - name: Clean Workspace89        uses: AutoModality/action-clean@v1.1.09091      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it92      - uses: actions/checkout@v393        with:94          ref: ${{ github.head_ref }}  #Checking out head commit9596      - name: Read .env file97        uses: xom9ikk/dotenv@v1.0.29899      - name: Generate ENV related extend file for docker-compose100        uses: cuchi/jinja2-action@v1.2.0101        with:102          template: .docker/docker-compose.tmp-forkless.j2103          output_file: .docker/docker-compose.${{ matrix.network }}.yml104          variables: |105            REPO_URL=${{ github.server_url }}/${{ github.repository }}.git106            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}107            POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}108            POLKADOT_MAINNET_BRANCH=${{ env.POLKADOT_MAINNET_BRANCH }}109            MAINNET_TAG=${{ matrix.mainnet_tag }}110            MAINNET_BRANCH=${{ matrix.mainnet_branch }}111            FEATURE=${{ matrix.features }}112            RUNTIME=${{ matrix.runtime }}113            BRANCH=${{ github.head_ref }}114115      - name: Show build configuration116        run: cat .docker/docker-compose.${{ matrix.network }}.yml117118      - name: Generate launch-config.json119        uses: cuchi/jinja2-action@v1.2.0120        with:121          template: .docker/launch-config.j2122          output_file: .docker/launch-config-forkless.json123          variables: |124            FEATURE=${{ matrix.features }}125            RUNTIME=${{ matrix.runtime }}126127      - name: Show launch-config-forkless configuration128        run: cat .docker/launch-config-forkless.json129130131      - name: Build the stack132        run: docker-compose -f ".docker/docker-compose-forkless.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build  --force-recreate --timeout 300133134      - name: Check if docker logs consist logs related to Runtime Upgrade testing.135        if: success()136        run: |137          counter=160138          function check_container_status {139                docker inspect -f {{.State.Running}} node-parachain140          }141          function do_docker_logs {142                docker logs --details node-parachain  2>&1143          }144          function is_started {145                if [ "$(check_container_status)" == "true" ]; then146                    echo "Container: node-parachain RUNNING";147                    echo "Check Docker logs"148                    DOCKER_LOGS=$(do_docker_logs)149                    if [[ ${DOCKER_LOGS} = *"🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"* ]];then150                        echo "🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"151                        return 0152                        exit 1153                    fi154                else155                    echo "Container node-parachain not RUNNING"156                    echo "Halting all future checks"157                    exit 1158                fi159                exit 0160          }161          while ! is_started; do162                echo "Waiting for special message in log files "163                sleep 30s164                counter=$(( $counter - 1 ))165                echo "Counter: $counter"166                if [ "$counter" -gt "0" ]; then167                    continue168                else169                    break170                fi171                done172           echo "Halting script"173           exit 1174        shell: bash175176      - name: Collect Docker Logs177        if: success() || failure()178        uses: jwalton/gh-docker-logs@v2.2.0179        with:180          dest: './forkless-parachain-update-nodata-logs.${{ matrix.features }}'181          images: 'node-parachain' 182183      - name: Tar logs184        if: success() || failure()185        run: tar cvzf ./forkless-parachain-update-nodata-logs.${{ matrix.features }}.tgz ./forkless-parachain-update-nodata-logs.${{ matrix.features }}186187      - name: Upload logs to GitHub188        if: success() || failure()189        uses: actions/upload-artifact@master190        with:191          name: forkless-parachain-update-nodata-logs.${{ matrix.features }}.tgz192          path: ./forkless-parachain-update-nodata-logs.${{ matrix.features }}.tgz193194#      - name: Stop running containers195#        if: always()                   # run this step always196#        run: docker-compose -f ".docker/docker-compose-forkless.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" down