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

difftreelog

source

.github/workflows/collator-selection.yml6.1 KiBsourcehistory
1name: collator-selection-test-run23# Triger: only call from main workflow(re-usable workflows)4on:5  workflow_call:67# A workflow run is made up of one or more jobs that can run sequentially or in parallel8jobs:9  execution-marix:10    name: Prepare execution matrix1112    runs-on: self-hosted-ci13    outputs:14      matrix: ${{ steps.create_matrix.outputs.matrix }}1516    steps:1718      - name: Clean Workspace19        uses: AutoModality/action-clean@v1.1.02021      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it22      - uses: actions/checkout@v323        with:24          ref: ${{ github.head_ref }}  #Checking out head commit2526      - name: Read .env file27        uses: xom9ikk/dotenv@v22829      - name: Create Execution matrix30        uses: CertainLach/create-matrix-action@v331        id: create_matrix32        with:33          matrix: |34            network {quartz}, wasm_name {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_BRANCH }}}, replica_from_address {${{ env.QUARTZ_REPLICA_FROM }}}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}35            network {sapphire}, wasm_name {quartz}, mainnet_branch {${{ env.SAPPHIRE_MAINNET_BRANCH }}}, replica_from_address {${{ env.SAPPHIRE_REPLICA_FROM }}}, relay_branch {${{ env.UNIQUEEAST_MAINNET_BRANCH }}}3637  collator-selection:38    needs: execution-marix39    # The type of runner that the job will run on40    runs-on: [self-hosted-ci,large]41    timeout-minutes: 13804243    name: ${{ matrix.network }}44    strategy:45      matrix:46        include: ${{fromJson(needs.execution-marix.outputs.matrix)}}4748    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.4950    steps:51      - name: Clean Workspace52        uses: AutoModality/action-clean@v1.1.05354      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it55      - uses: actions/checkout@v356        with:57          ref: ${{ github.head_ref }}  #Checking out head commit5859      - name: Read .env file60        uses: xom9ikk/dotenv@v26162      - name: Generate ENV related extend file for docker-compose63        uses: cuchi/jinja2-action@v1.2.064        with:65          template: .docker/docker-compose.tmp-collators.j266          output_file: .docker/docker-compose.collators.${{ matrix.network }}.yml67          variables: |68            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}69            POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}70            POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }}71            NETWORK=${{ matrix.network }}72            BRANCH=${{ github.head_ref }}7374      - name: Show build configuration75        run: cat .docker/docker-compose.collators.${{ matrix.network }}.yml7677      - name: Show launch-config configuration78        run: cat launch-config.json7980      - name: Build the stack81        run: docker-compose -f ".docker/docker-compose.collators.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 3008283      #  🚀 POLKADOT LAUNCH COMPLETE 🚀84      - name: Check if docker logs consist messages related to testing of collator tests 85        if: success()86        run: |87          counter=16088          function check_container_status {89                docker inspect -f {{.State.Running}} parachain-collators90          }91          function do_docker_logs {92                docker logs --details parachain-collators  2>&193          }94          function is_started {95                if [ "$(check_container_status)" == "true" ]; then96                        echo "Container: collator-${{ matrix.network }}-testnet-local RUNNING";97                        echo "Check Docker logs"98                        DOCKER_LOGS=$(do_docker_logs)99                        if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then100                                echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"101                                return 0102                        else103                                echo "Message not found in logs output, repeating..."104                                return 1105                        fi106                else107                        echo "Container collator-${{ matrix.network }}-testnet-local NOT RUNNING"108                        echo "Halting all future checks"109                        exit 1110                fi111          echo "something goes wrong"112          exit 1113          }114          while ! is_started; do115                echo "Waiting for special message in log files "116                sleep 30s117                counter=$(( $counter - 1 ))118                echo "Counter: $counter"119                if [ "$counter" -gt "0" ]; then120                         continue121                else122                         break123                fi124          done125          echo "Halting script"126          exit 0127        shell: bash128129      - uses: actions/setup-node@v3130        with:131          node-version: 16132133      - name: Run Collator tests134        working-directory: tests135        if: success() || failure()136        run: |137          yarn install138          yarn add mochawesome139          node scripts/readyness.js140          echo "Ready to start tests"141          yarn polkadot-types142          NOW=$(date +%s) && yarn testCollators --reporter mochawesome --reporter-options reportFilename=test-collators-${NOW}143        env:144          RPC_URL: http://127.0.0.1:9933/145146      - name: Test Report Collator147        uses: phoenix-actions/test-reporting@v8148        id: test-report-collator149        if: success() || failure()    # run this step even if previous step failed150        with:151          name: Report Collator tests results - ${{ matrix.network }}            # Name of the check run which will be created152          path: tests/mochawesome-report/test-collators-*.json    # Path to test results153          reporter: mochawesome-json154          fail-on-error: 'false'155156      - name: Stop running containers157        if: always()                   # run this step always158        run: docker-compose -f ".docker/docker-compose.collators.${{ matrix.network }}.yml" down159160      - name: Remove builder cache161        if: always()                   # run this step always162        run: |163          docker builder prune -f -a164          docker system prune -f