git.delta.rocks / unique-network / refs/commits / 58bdab80d979

difftreelog

source

.github/workflows/xcm-tests.yml6.3 KiBsourcehistory
1name: xcm-tests23# 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      - master9    types:10      - opened11      - reopened12      - synchronize   #commit(s) pushed to the pull request13      - ready_for_review1415  # Allows you to run this workflow manually from the Actions tab16  workflow_dispatch:1718#Define Workflow variables19env:20  REPO_URL: ${{ github.server_url }}/${{ github.repository }}2122concurrency:23  group: ${{ github.workflow }}-${{ github.head_ref }}24  cancel-in-progress: true2526# A workflow run is made up of one or more jobs that can run sequentially or in parallel27jobs:2829  xcm-testnet-build:30    uses: ./.github/workflows/xcm-testnet-build.yml31    secrets: inherit3233  prepare-execution-marix:3435    name: Prepare execution matrix3637    needs: [xcm-testnet-build]3839    runs-on: XL40    outputs:41      matrix: ${{ steps.create_matrix.outputs.matrix }}4243    steps:4445      - name: Clean Workspace46        uses: AutoModality/action-clean@v1.1.04748      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it49      - uses: actions/checkout@v350        with:51          ref: ${{ github.head_ref }}  #Checking out head commit5253      - name: Read .env file54        uses: xom9ikk/dotenv@v1.0.25556      - name: Create Execution matrix57        uses: fabiocaccamo/create-matrix-action@v258        id: create_matrix59        with:60          matrix: |61            network {opal}, runtime {opal}, features {opal-runtime}, runtest {testXcmOpal}62            network {quartz}, runtime {quartz}, features {quartz-runtime}, runtest {testXcmQuartz}63            network {unique}, runtime {unique}, features {unique-runtime}, runtest {testXcmUnique}6465  xcm-tests:66    needs: prepare-execution-marix67    # The type of runner that the job will run on68    runs-on: [XL]6970    timeout-minutes: 6007172    name: ${{ matrix.network }}7374    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.7576    strategy:77      matrix:78        include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}798081    steps:82       - name: Skip if pull request is in Draft83        if: github.event.pull_request.draft == true84        run: exit 18586      - name: Clean Workspace87        uses: AutoModality/action-clean@v1.1.08889      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it90      - uses: actions/checkout@v391        with:92          ref: ${{ github.head_ref }}  #Checking out head commit9394      - name: Read .env file95        uses: xom9ikk/dotenv@v1.0.29697      - name: Generate ENV related extend file for docker-compose98        uses: cuchi/jinja2-action@v1.2.099        with:100          template: .docker/docker-compose.tmp-xcm-tests.j2101          output_file: .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml102          variables: |103            NETWORK=${{ matrix.network }}104105      - name: Show build configuration106        run: cat .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml107108      - uses: actions/setup-node@v3109        with:110          node-version: 16111112      - name: Build the stack113        run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300114115      #  🚀 POLKADOT LAUNCH COMPLETE 🚀116      - name: Check if docker logs consist messages related to testing of xcm tests 117        if: success()118        run: |119          counter=160120          function check_container_status {121                docker inspect -f {{.State.Running}} xcm-${{ matrix.network }}-testnet-local122          }123          function do_docker_logs {124                docker logs --details xcm-${{ matrix.network }}-testnet-local 2>&1125          }126          function is_started {127                if [ "$(check_container_status)" == "true" ]; then128                        echo "Container: xcm-${{ matrix.network }}-testnet-local RUNNING";129                        echo "Check Docker logs"130                        DOCKER_LOGS=$(do_docker_logs)131                        if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then132                                echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"133                                return 0134                        else135                                echo "Message not found in logs output, repeating..."136                                return 1137                        fi138                else139                        echo "Container xcm-${{ matrix.network }}-testnet-local NOT RUNNING"140                        echo "Halting all future checks"141                        exit 1142                fi143          echo "something goes wrong"144          exit 1145          }146          while ! is_started; do147                echo "Waiting for special message in log files "148                sleep 30s149                counter=$(( $counter - 1 ))150                echo "Counter: $counter"151                if [ "$counter" -gt "0" ]; then152                         continue153                else154                         break155                fi156          done157          echo "Halting script"158          exit 0159        shell: bash160161      - name: Run XCM tests 162        working-directory: tests163        run: |164          yarn install165          yarn add mochawesome166          echo "Ready to start tests"167          NOW=$(date +%s) && yarn ${{ matrix.runtest }} --reporter mochawesome --reporter-options reportFilename=test-${NOW}168169      - name: XCM Test Report170        uses: phoenix-actions/test-reporting@v8171        id: test-report172        if: success() || failure()    # run this step even if previous step failed173        with:174          name: XCM Tests ${{ matrix.network }}            # Name of the check run which will be created175          path: tests/mochawesome-report/test-*.json    # Path to test results176          reporter: mochawesome-json177          fail-on-error: 'false'178179      - name: Stop running containers180        if: always()                   # run this step always181        run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" down182183      - name: Clean Workspace184        if: always()185        uses: AutoModality/action-clean@v1.1.0186187      - name: Remove builder cache188        if: always()                   # run this step always189        run: |190          docker system prune -a -f191