git.delta.rocks / unique-network / refs/commits / 3b4aae883c1e

difftreelog

source

.github/workflows/collator-selection.yml6.3 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 {opal}, wasm_name {opal}, mainnet_branch {${{ env.OPAL_MAINNET_BRANCH }}}, replica_from_address {${{ env.OPAL_REPLICA_FROM }}}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}35            network {quartz}, wasm_name {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_BRANCH }}}, replica_from_address {${{ env.QUARTZ_REPLICA_FROM }}}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}36            network {sapphire}, wasm_name {quartz}, mainnet_branch {${{ env.SAPPHIRE_MAINNET_BRANCH }}}, replica_from_address {${{ env.SAPPHIRE_REPLICA_FROM }}}, relay_branch {${{ env.UNIQUEEAST_MAINNET_BRANCH }}}3738  collator-selection:39    needs: execution-marix40    # The type of runner that the job will run on41    runs-on: [self-hosted-ci,large]42    timeout-minutes: 13804344    name: ${{ matrix.network }}45    strategy:46      matrix:47        include: ${{fromJson(needs.execution-marix.outputs.matrix)}}4849    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.5051    steps:52      - name: Clean Workspace53        uses: AutoModality/action-clean@v1.1.05455      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it56      - uses: actions/checkout@v357        with:58          ref: ${{ github.head_ref }}  #Checking out head commit5960      - name: Read .env file61        uses: xom9ikk/dotenv@v26263      - name: Generate ENV related extend file for docker-compose64        uses: cuchi/jinja2-action@v1.2.065        with:66          template: .docker/docker-compose.tmp-collators.j267          output_file: .docker/docker-compose.collators.${{ matrix.network }}.yml68          variables: |69            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}70            POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}71            POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }}72            NETWORK=${{ matrix.network }}73            BRANCH=${{ github.head_ref }}7475      - name: Show build configuration76        run: cat .docker/docker-compose.collators.${{ matrix.network }}.yml7778      - name: Show launch-config configuration79        run: cat launch-config.json8081      - name: Build the stack82        run: docker-compose -f ".docker/docker-compose.collators.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 3008384      #  🚀 POLKADOT LAUNCH COMPLETE 🚀85      - name: Check if docker logs consist messages related to testing of collator tests 86        if: success()87        run: |88          counter=16089          function check_container_status {90                docker inspect -f {{.State.Running}} parachain-collators91          }92          function do_docker_logs {93                docker logs --details parachain-collators  2>&194          }95          function is_started {96                if [ "$(check_container_status)" == "true" ]; then97                        echo "Container: collator-${{ matrix.network }}-testnet-local RUNNING";98                        echo "Check Docker logs"99                        DOCKER_LOGS=$(do_docker_logs)100                        if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then101                                echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"102                                return 0103                        else104                                echo "Message not found in logs output, repeating..."105                                return 1106                        fi107                else108                        echo "Container collator-${{ matrix.network }}-testnet-local NOT RUNNING"109                        echo "Halting all future checks"110                        exit 1111                fi112          echo "something goes wrong"113          exit 1114          }115          while ! is_started; do116                echo "Waiting for special message in log files "117                sleep 30s118                counter=$(( $counter - 1 ))119                echo "Counter: $counter"120                if [ "$counter" -gt "0" ]; then121                         continue122                else123                         break124                fi125          done126          echo "Halting script"127          exit 0128        shell: bash129130      - uses: actions/setup-node@v3131        with:132          node-version: 16133134      - name: Run Collator tests135        working-directory: tests136        if: success() || failure()137        run: |138          yarn install139          yarn add mochawesome140          node scripts/readyness.js141          echo "Ready to start tests"142          yarn polkadot-types143          NOW=$(date +%s) && yarn testCollators --reporter mochawesome --reporter-options reportFilename=test-collators-${NOW}144        env:145          RPC_URL: http://127.0.0.1:9933/146147      - name: Test Report Collator148        uses: phoenix-actions/test-reporting@v8149        id: test-report-collator150        if: success() || failure()    # run this step even if previous step failed151        with:152          name: Report Collator tests results - ${{ matrix.network }}            # Name of the check run which will be created153          path: tests/mochawesome-report/test-collators-*.json    # Path to test results154          reporter: mochawesome-json155          fail-on-error: 'false'156157      - name: Stop running containers158        if: always()                   # run this step always159        run: docker-compose -f ".docker/docker-compose.collators.${{ matrix.network }}.yml" down160161      - name: Remove builder cache162        if: always()                   # run this step always163        run: |164          docker builder prune -f -a165          docker system prune -f