git.delta.rocks / unique-network / refs/commits / 464a23ef439a

difftreelog

add build additional build images for xcm

Konstantin Astakhov2022-09-15parent: #ae09c8d.patch.diff
in: master

2 files changed

modified.github/workflows/xcm-testnet-build.ymldiffbeforeafterboth
--- a/.github/workflows/xcm-testnet-build.yml
+++ b/.github/workflows/xcm-testnet-build.yml
@@ -76,6 +76,156 @@
       - name: Read .env file
         uses: xom9ikk/dotenv@v1.0.2
 
+      - name: Log in to Docker Hub
+        uses: docker/login-action@v2.0.0
+        with:
+          username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
+          password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}
+
+      - name: Install jq
+        run: sudo apt install jq -y
+
+      # - name: Get autorization token from DOCKERHUB
+      #   run: |                 
+      #     # aquire token
+      #       TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
+      #       export TOKEN=$TOKEN
+
+      # Check POLKADOT version and build it if it doesn't exist in repository
+      - name: Generate ENV related extend Dockerfile file for POLKADOT
+        uses: cuchi/jinja2-action@v1.2.0
+        with:
+          template: .docker/Dockerfile-polkadot.j2
+          output_file: .docker/Dockerfile-polkadot.${{ env.POLKADOT_BUILD_BRANCH }}.yml
+          variables: |
+            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
+            POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}
+
+      - name: Check if the dockerhub repository contains the needed version POLKADOT
+        run: |
+          # aquire token
+            TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
+            export TOKEN=$TOKEN
+
+          # Get TAGS from DOCKERHUB POLKADOT repository
+            POLKADOT_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-polkadot/tags/?page_size=100 | jq -r '."results"[]["name"]')
+          # Show TAGS
+            echo "POLKADOT TAGS:"
+            echo $POLKADOT_TAGS
+          # Check correct version POLKADOT and build it if it doesn't exist in POLKADOT TAGS
+            if [[ ${POLKADOT_TAGS[*]} =~ (^|[[:space:]])"${{ env.POLKADOT_BUILD_BRANCH }}"($|[[:space:]]) ]]; then
+                echo "Repository has needed POLKADOT version";
+                docker pull uniquenetwork/builder-polkadot:${{ env.POLKADOT_BUILD_BRANCH }}
+            else
+                echo "Repository has not needed POLKADOT version, so build it";
+                cd .docker/ && docker build --no-cache --file ./Dockerfile-polkadot.${{ env.POLKADOT_BUILD_BRANCH }}.yml --tag uniquenetwork/builder-polkadot:${{ env.POLKADOT_BUILD_BRANCH }} .
+                echo "Push needed POLKADOT version to the repository";
+                docker push uniquenetwork/builder-polkadot:${{ env.POLKADOT_BUILD_BRANCH }}
+            fi
+        shell: bash
+
+      # Check ACALA version and build it if it doesn't exist in repository
+      - name: Generate ENV related extend Dockerfile file for ACALA
+        uses: cuchi/jinja2-action@v1.2.0
+        with:
+          template: .docker/Dockerfile-acala.j2
+          output_file: .docker/Dockerfile-acala.${{ matrix.acala_version }}.yml
+          variables: |
+            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
+            ACALA_BUILD_BRANCH=${{ matrix.acala_version }}
+
+      - name: Check if the dockerhub repository contains the needed ACALA version
+        run: |
+          # aquire token
+            TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
+            export TOKEN=$TOKEN
+
+          # Get TAGS from DOCKERHUB repository
+            ACALA_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-acala/tags/?page_size=100 | jq -r '."results"[]["name"]')
+          # Show TAGS
+            echo "ACALA TAGS:"
+            echo $ACALA_TAGS
+          # Check correct version ACALA and build it if it doesn't exist in ACALA TAGS
+            if [[ ${ACALA_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.acala_version }}"($|[[:space:]]) ]]; then
+                echo "Repository has needed ACALA version";
+                docker pull uniquenetwork/builder-acala:${{ matrix.acala_version }}
+            else
+                echo "Repository has not needed ACALA version, so build it";
+                cd .docker/ && docker build --no-cache --file ./Dockerfile-acala.${{ matrix.acala_version }}.yml --tag uniquenetwork/builder-acala:${{ matrix.acala_version }} .
+                echo "Push needed ACALA version to the repository";
+                docker push uniquenetwork/builder-acala:${{ matrix.acala_version }}
+            fi
+        shell: bash
+
+      # Check MOONBEAM version and build it if it doesn't exist in repository
+      - name: Generate ENV related extend Dockerfile file for MOONBEAM
+        uses: cuchi/jinja2-action@v1.2.0
+        with:
+          template: .docker/Dockerfile-moonbeam.j2
+          output_file: .docker/Dockerfile-moonbeam.${{ matrix.moonbeam_version }}.yml
+          variables: |
+            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
+            MOONBEAM_BUILD_BRANCH=${{ matrix.moonbeam_version }}
+
+      - name: Check if the dockerhub repository contains the needed MOONBEAM version
+        run: |
+          # aquire token
+            TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
+            export TOKEN=$TOKEN
+
+          # Get TAGS from DOCKERHUB repository
+            MOONBEAM_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-moonbeam/tags/?page_size=100 | jq -r '."results"[]["name"]')
+          # Show TAGS
+            echo "MOONBEAM TAGS:"
+            echo $MOONBEAM_TAGS
+          # Check correct version MOONBEAM and build it if it doesn't exist in MOONBEAM TAGS
+            if [[ ${MOONBEAM_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.moonbeam_version }}"($|[[:space:]]) ]]; then
+                echo "Repository has needed MOONBEAM version";
+                docker pull uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }}
+            else
+                echo "Repository has not needed MOONBEAM version, so build it";
+                cd .docker/ && docker build --no-cache --file ./Dockerfile-moonbeam.${{ matrix.moonbeam_version }}.yml --tag uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }} .
+                echo "Push needed MOONBEAM version to the repository";
+                docker push uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }}
+            fi
+        shell: bash
+
+
+      # Check CUMULUS version and build it if it doesn't exist in repository
+      - name: Generate ENV related extend Dockerfile file for CUMULUS
+        uses: cuchi/jinja2-action@v1.2.0
+        with:
+          template: .docker/Dockerfile-cumulus.j2
+          output_file: .docker/Dockerfile-cumulus.${{ matrix.cumulus_version }}.yml
+          variables: |
+            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
+            CUMULUS_BUILD_BRANCH=${{ matrix.cumulus_version }}
+
+      - name: Check if the dockerhub repository contains the needed CUMULUS version
+        run: |                 
+          # aquire token
+            TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
+            export TOKEN=$TOKEN
+
+          # Get TAGS from DOCKERHUB repository
+            CUMULUS_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-cumulus/tags/?page_size=100 | jq -r '."results"[]["name"]')
+          # Show TAGS
+            echo "CUMULUS TAGS:"
+            echo $CUMULUS_TAGS
+          # Check correct version CUMULUS and build it if it doesn't exist in CUMULUS TAGS
+            if [[ ${CUMULUS_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.cumulus_version }}"($|[[:space:]]) ]]; then
+                echo "Repository has needed CUMULUS version";
+                docker pull uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }}
+            else
+                echo "Repository has not needed CUMULUS version, so build it";
+                cd .docker/ && docker build --no-cache --file ./Dockerfile-cumulus.${{ matrix.cumulus_version }}.yml --tag uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }} .
+                echo "Push needed CUMULUS version to the repository";
+                docker push uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }}
+            fi
+        shell: bash
+
+
+      # Build main image for XCM   
       - name: Generate ENV related extend Dockerfile file
         uses: cuchi/jinja2-action@v1.2.0
         with:
@@ -107,24 +257,6 @@
           find: '/'
           replace: '-'
 
-      - name: Log in to Docker Hub
-        uses: docker/login-action@v2.0.0
-        with:
-          username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
-          password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}
-
-      - name: Pull acala docker image
-        run: docker pull uniquenetwork/builder-acala:${{ matrix.acala_version }}
-
-      - name: Pull moonbeam docker image
-        run: docker pull uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }}
-
-      - name: Pull cumulus docker image
-        run: docker pull uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }}
-
-      - name: Pull polkadot docker image
-        run: docker pull uniquenetwork/builder-polkadot:${{ env.POLKADOT_BUILD_BRANCH }}
-
       - name: Pull chainql docker image
         run: docker pull uniquenetwork/builder-chainql:latest
 
@@ -146,6 +278,4 @@
         run: |
           docker builder prune -f
           docker system prune -f
-
-
 
modified.github/workflows/xcm-tests_v2.ymldiffbeforeafterboth
before Β· .github/workflows/xcm-tests_v2.yml
1name: xcm-tests23# Controls when the action will run.4on:5  # Allows you to run this workflow manually from the Actions tab6  workflow_call:78#Define Workflow variables9env:10  REPO_URL: ${{ github.server_url }}/${{ github.repository }}111213# A workflow run is made up of one or more jobs that can run sequentially or in parallel14jobs:1516  prepare-execution-marix:1718    name: Prepare execution matrix1920#    needs: [xcm-testnet-build]2122    runs-on: XL23    outputs:24      matrix: ${{ steps.create_matrix.outputs.matrix }}2526    steps:2728      - name: Clean Workspace29        uses: AutoModality/action-clean@v1.1.03031      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it32      - uses: actions/checkout@v333        with:34          ref: ${{ github.head_ref }}  #Checking out head commit3536      - name: Read .env file37        uses: xom9ikk/dotenv@v1.0.23839      - name: Create Execution matrix40        uses: fabiocaccamo/create-matrix-action@v241        id: create_matrix42        with:43          matrix: |44            network {opal}, runtime {opal}, features {opal-runtime}, runtest {testXcmOpal}45            network {quartz}, runtime {quartz}, features {quartz-runtime}, runtest {testXcmQuartz}46            network {unique}, runtime {unique}, features {unique-runtime}, runtest {testXcmUnique}4748  xcm-tests:49    needs: prepare-execution-marix50    # The type of runner that the job will run on51    runs-on: [XL]5253    timeout-minutes: 6005455    name: ${{ matrix.network }}5657    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.5859    strategy:60      matrix:61        include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}6263    steps:64      - name: Skip if pull request is in Draft65        if: github.event.pull_request.draft == true66        run: exit 16768      - name: Clean Workspace69        uses: AutoModality/action-clean@v1.1.07071      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it72      - uses: actions/checkout@v373        with:74          ref: ${{ github.head_ref }}  #Checking out head commit7576      - name: Read .env file77        uses: xom9ikk/dotenv@v1.0.27879      - name: Generate ENV related extend file for docker-compose80        uses: cuchi/jinja2-action@v1.2.081        with:82          template: .docker/docker-compose.tmp-xcm-tests.j283          output_file: .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml84          variables: |85            NETWORK=${{ matrix.network }}8687      - name: Show build configuration88        run: cat .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml8990      - uses: actions/setup-node@v391        with:92          node-version: 169394      - name: Build the stack95        run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 3009697      #  πŸš€ POLKADOT LAUNCH COMPLETE πŸš€98      - name: Check if docker logs consist messages related to testing of xcm tests 99        if: success()100        run: |101          counter=160102          function check_container_status {103                docker inspect -f {{.State.Running}} xcm-${{ matrix.network }}-testnet-local104          }105          function do_docker_logs {106                docker logs --details xcm-${{ matrix.network }}-testnet-local 2>&1107          }108          function is_started {109                if [ "$(check_container_status)" == "true" ]; then110                        echo "Container: xcm-${{ matrix.network }}-testnet-local RUNNING";111                        echo "Check Docker logs"112                        DOCKER_LOGS=$(do_docker_logs)113                        if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then114                                echo "πŸš€ POLKADOT LAUNCH COMPLETE πŸš€"115                                return 0116                        else117                                echo "Message not found in logs output, repeating..."118                                return 1119                        fi120                else121                        echo "Container xcm-${{ matrix.network }}-testnet-local NOT RUNNING"122                        echo "Halting all future checks"123                        exit 1124                fi125          echo "something goes wrong"126          exit 1127          }128          while ! is_started; do129                echo "Waiting for special message in log files "130                sleep 30s131                counter=$(( $counter - 1 ))132                echo "Counter: $counter"133                if [ "$counter" -gt "0" ]; then134                         continue135                else136                         break137                fi138          done139          echo "Halting script"140          exit 0141        shell: bash142143      - name: Run XCM tests 144        working-directory: tests145        run: |146          yarn install147          yarn add mochawesome148          node scripts/readyness.js149          echo "Ready to start tests"150          NOW=$(date +%s) && yarn ${{ matrix.runtest }} --reporter mochawesome --reporter-options reportFilename=test-${NOW}151152      - name: XCM Test Report153        uses: phoenix-actions/test-reporting@v8154        id: test-report155        if: success() || failure()    # run this step even if previous step failed156        with:157          name: XCM Tests ${{ matrix.network }}            # Name of the check run which will be created158          path: tests/mochawesome-report/test-*.json    # Path to test results159          reporter: mochawesome-json160          fail-on-error: 'false'161162      - name: Stop running containers163        if: always()                   # run this step always164        run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" down165166      - name: Clean Workspace167        if: always()168        uses: AutoModality/action-clean@v1.1.0169170      - name: Remove builder cache171        if: always()                   # run this step always172        run: |173          docker system prune -a -f174
after Β· .github/workflows/xcm-tests_v2.yml
1name: xcm-tests23# Controls when the action will run.4on:5  # Allows you to run this workflow manually from the Actions tab6  workflow_call:78#Define Workflow variables9env:10  REPO_URL: ${{ github.server_url }}/${{ github.repository }}111213# A workflow run is made up of one or more jobs that can run sequentially or in parallel14jobs:1516  prepare-execution-marix:1718    name: Prepare execution matrix1920    #needs: [xcm-testnet-build]2122    runs-on: XL23    outputs:24      matrix: ${{ steps.create_matrix.outputs.matrix }}2526    steps:2728      - name: Clean Workspace29        uses: AutoModality/action-clean@v1.1.03031      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it32      - uses: actions/checkout@v333        with:34          ref: ${{ github.head_ref }}  #Checking out head commit3536      - name: Read .env file37        uses: xom9ikk/dotenv@v1.0.23839      - name: Create Execution matrix40        uses: fabiocaccamo/create-matrix-action@v241        id: create_matrix42        with:43          matrix: |44            network {opal}, runtime {opal}, features {opal-runtime}, runtest {testXcmOpal}45            network {quartz}, runtime {quartz}, features {quartz-runtime}, runtest {testXcmQuartz}46            network {unique}, runtime {unique}, features {unique-runtime}, runtest {testXcmUnique}4748  xcm-tests:49    needs: prepare-execution-marix50    # The type of runner that the job will run on51    runs-on: [XL]5253    timeout-minutes: 6005455    name: ${{ matrix.network }}5657    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.5859    strategy:60      matrix:61        include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}6263    steps:64      - name: Skip if pull request is in Draft65        if: github.event.pull_request.draft == true66        run: exit 16768      - name: Clean Workspace69        uses: AutoModality/action-clean@v1.1.07071      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it72      - uses: actions/checkout@v373        with:74          ref: ${{ github.head_ref }}  #Checking out head commit7576      - name: Read .env file77        uses: xom9ikk/dotenv@v1.0.27879      - name: Generate ENV related extend file for docker-compose80        uses: cuchi/jinja2-action@v1.2.081        with:82          template: .docker/docker-compose.tmp-xcm-tests.j283          output_file: .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml84          variables: |85            NETWORK=${{ matrix.network }}8687      - name: Show build configuration88        run: cat .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml8990      - uses: actions/setup-node@v391        with:92          node-version: 169394      - name: Build the stack95        run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 3009697      #  πŸš€ POLKADOT LAUNCH COMPLETE πŸš€98      - name: Check if docker logs consist messages related to testing of xcm tests 99        if: success()100        run: |101          counter=160102          function check_container_status {103                docker inspect -f {{.State.Running}} xcm-${{ matrix.network }}-testnet-local104          }105          function do_docker_logs {106                docker logs --details xcm-${{ matrix.network }}-testnet-local 2>&1107          }108          function is_started {109                if [ "$(check_container_status)" == "true" ]; then110                        echo "Container: xcm-${{ matrix.network }}-testnet-local RUNNING";111                        echo "Check Docker logs"112                        DOCKER_LOGS=$(do_docker_logs)113                        if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then114                                echo "πŸš€ POLKADOT LAUNCH COMPLETE πŸš€"115                                return 0116                        else117                                echo "Message not found in logs output, repeating..."118                                return 1119                        fi120                else121                        echo "Container xcm-${{ matrix.network }}-testnet-local NOT RUNNING"122                        echo "Halting all future checks"123                        exit 1124                fi125          echo "something goes wrong"126          exit 1127          }128          while ! is_started; do129                echo "Waiting for special message in log files "130                sleep 30s131                counter=$(( $counter - 1 ))132                echo "Counter: $counter"133                if [ "$counter" -gt "0" ]; then134                         continue135                else136                         break137                fi138          done139          echo "Halting script"140          exit 0141        shell: bash142143      - name: Run XCM tests 144        working-directory: tests145        run: |146          yarn install147          yarn add mochawesome148          node scripts/readyness.js149          echo "Ready to start tests"150          NOW=$(date +%s) && yarn ${{ matrix.runtest }} --reporter mochawesome --reporter-options reportFilename=test-${NOW}151152      - name: XCM Test Report153        uses: phoenix-actions/test-reporting@v8154        id: test-report155        if: success() || failure()    # run this step even if previous step failed156        with:157          name: XCM Tests ${{ matrix.network }}            # Name of the check run which will be created158          path: tests/mochawesome-report/test-*.json    # Path to test results159          reporter: mochawesome-json160          fail-on-error: 'false'161162      - name: Stop running containers163        if: always()                   # run this step always164        run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" down165166      - name: Clean Workspace167        if: always()168        uses: AutoModality/action-clean@v1.1.0169170      - name: Remove builder cache171        if: always()                   # run this step always172        run: |173          docker system prune -a -f174175176