1name: xcm-testnet-build234on:5 workflow_call:6 7 8 workflow_dispatch:91011env:12 REPO_URL: ${{ github.server_url }}/${{ github.repository }}131415jobs:1617 prepare-execution-marix:1819 name: Prepare execution matrix2021 runs-on: [XL]22 outputs:23 matrix: ${{ steps.create_matrix.outputs.matrix }}2425 steps:2627 - name: Clean Workspace28 uses: AutoModality/action-clean@v1.1.02930 31 - uses: actions/checkout@v332 with:33 ref: ${{ github.head_ref }} 3435 - name: Read .env file36 uses: xom9ikk/dotenv@v1.0.23738 - name: Create Execution matrix39 uses: fabiocaccamo/create-matrix-action@v240 id: create_matrix41 with:42 matrix: |43 network {opal}, runtime {opal}, features {opal-runtime}, acala_version {${{ env.ACALA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONBEAM_BUILD_BRANCH }}}, cumulus_version {${{ env.WESTMINT_BUILD_BRANCH }}}44 network {quartz}, runtime {quartz}, features {quartz-runtime}, acala_version {${{ env.KARURA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONRIVER_BUILD_BRANCH }}}, cumulus_version {${{ env.STATEMINE_BUILD_BRANCH }}}45 network {unique}, runtime {unique}, features {unique-runtime}, acala_version {${{ env.ACALA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONBEAM_BUILD_BRANCH }}}, cumulus_version {${{ env.STATEMINT_BUILD_BRANCH }}}4647 xcm-build:48 49 needs: prepare-execution-marix50 51 runs-on: [XL]5253 timeout-minutes: 6005455 name: ${{ matrix.network }}5657 continue-on-error: true 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 72 - uses: actions/checkout@v373 with:74 ref: ${{ github.head_ref }} 7576 - name: Read .env file77 uses: xom9ikk/dotenv@v1.0.27879 - name: Log in to Docker Hub80 uses: docker/login-action@v2.0.081 with:82 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}83 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}8485 - name: Get autorization token from DOCKERHUB86 run: | 87 88 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)89 export $TOKEN9091 92 - name: Generate ENV related extend Dockerfile file for POLKADOT93 uses: cuchi/jinja2-action@v1.2.094 with:95 template: .docker/Dockerfile-polkadot.j296 output_file: .docker/Dockerfile-polkadot.${{ env.POLKADOT_BUILD_BRANCH }}.yml97 variables: |98 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}99 POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}100101 - name: Check if the dockerhub repository contains the needed version POLKADOT102 run: | 103 # Get TAGS from DOCKERHUB repository104 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"]')105 # Show TAGS106 echo "POLKADOT TAGS:"107 echo $POLKADOT_TAGS108 # Check correct version POLKADOT and build it if it doesn't exist in POLKADOT TAGS109 if [[ ${POLKADOT_TAGS[*]} =~ (^|[[:space:]])"${{ env.POLKADOT_BUILD_BRANCH }}"($|[[:space:]]) ]]; then110 echo "Repository has needed POLKADOT version";111 docker pull uniquenetwork/builder-polkadot:${{ env.POLKADOT_BUILD_BRANCH }}112 else113 echo "Repository has not needed POLKADOT version, so build it";114 cd .docker/ && docker build --no-cache --file ./Dockerfile-polkadot.${{ env.POLKADOT_BUILD_BRANCH }}.yml --tag uniquenetwork/builder-polkadot:${{ env.POLKADOT_BUILD_BRANCH }} .115 echo "Push needed POLKADOT version to the repository";116 docker push uniquenetwork/builder-polkadot:${{ env.POLKADOT_BUILD_BRANCH }}117 fi118 shell: bash119120 121 - name: Generate ENV related extend Dockerfile file for ACALA122 uses: cuchi/jinja2-action@v1.2.0123 with:124 template: .docker/Dockerfile-acala.j2125 output_file: .docker/Dockerfile-acala.${{ matrix.acala_version }}.yml126 variables: |127 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}128 ACALA_BUILD_BRANCH=${{ matrix.acala_version }}129130 - name: Check if the dockerhub repository contains the needed ACALA version131 run: | 132 # Get TAGS from DOCKERHUB repository133 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"]')134 # Show TAGS135 echo "ACALA TAGS:"136 echo $ACALA_TAGS137 # Check correct version ACALA and build it if it doesn't exist in ACALA TAGS138 if [[ ${ACALA_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.acala_version }}"($|[[:space:]]) ]]; then139 echo "Repository has needed ACALA version";140 docker pull uniquenetwork/builder-acala:${{ matrix.acala_version }}141 else142 echo "Repository has not needed ACALA version, so build it";143 cd .docker/ && docker build --no-cache --file ./Dockerfile-acala.${{ matrix.acala_version }}.yml --tag uniquenetwork/builder-acala:${{ matrix.acala_version }} .144 echo "Push needed ACALA version to the repository";145 docker push uniquenetwork/builder-acala:${{ matrix.acala_version }}146 fi147 shell: bash148149 150 - name: Generate ENV related extend Dockerfile file for MOONBEAM151 uses: cuchi/jinja2-action@v1.2.0152 with:153 template: .docker/Dockerfile-moonbeam.j2154 output_file: .docker/Dockerfile-moonbeam.${{ matrix.moonbeam_version }}.yml155 variables: |156 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}157 MOONBEAM_BUILD_BRANCH=${{ matrix.moonbeam_version }}158159 - name: Check if the dockerhub repository contains the needed MOONBEAM version160 run: | 161 # Get TAGS from DOCKERHUB repository162 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"]')163 # Show TAGS164 echo "MOONBEAM TAGS:"165 echo $MOONBEAM_TAGS166 # Check correct version MOONBEAM and build it if it doesn't exist in MOONBEAM TAGS167 if [[ ${MOONBEAM_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.moonbeam_version }}"($|[[:space:]]) ]]; then168 echo "Repository has needed MOONBEAM version";169 docker pull uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }}170 else171 echo "Repository has not needed MOONBEAM version, so build it";172 cd .docker/ && docker build --no-cache --file ./Dockerfile-moonbeam.${{ matrix.moonbeam_version }}.yml --tag uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }} .173 echo "Push needed MOONBEAM version to the repository";174 docker push uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }}175 fi176 shell: bash177178179 180 - name: Generate ENV related extend Dockerfile file for CUMULUS181 uses: cuchi/jinja2-action@v1.2.0182 with:183 template: .docker/Dockerfile-cumulus.j2184 output_file: .docker/Dockerfile-cumulus.${{ matrix.cumulus_version }}.yml185 variables: |186 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}187 CUMULUS_BUILD_BRANCH=${{ matrix.cumulus_version }}188189 - name: Check if the dockerhub repository contains the needed CUMULUS version190 run: | 191 # Get TAGS from DOCKERHUB repository192 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"]')193 # Show TAGS194 echo "CUMULUS TAGS:"195 echo $CUMULUS_TAGS196 # Check correct version CUMULUS and build it if it doesn't exist in CUMULUS TAGS197 if [[ ${CUMULUS_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.cumulus_version }}"($|[[:space:]]) ]]; then198 echo "Repository has needed CUMULUS version";199 docker pull uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }}200 else201 echo "Repository has not needed CUMULUS version, so build it";202 cd .docker/ && docker build --no-cache --file ./Dockerfile-cumulus.${{ matrix.cumulus_version }}.yml --tag uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }} .203 echo "Push needed CUMULUS version to the repository";204 docker push uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }}205 fi206 shell: bash207208209 210 - name: Generate ENV related extend Dockerfile file211 uses: cuchi/jinja2-action@v1.2.0212 with:213 template: .docker/Dockerfile-xcm.j2214 output_file: .docker/Dockerfile-xcm.${{ matrix.network }}.yml215 variables: |216 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}217 NETWORK=${{ matrix.network }}218 POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}219 POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }}220 FEATURE=${{ matrix.features }}221 RUNTIME=${{ matrix.runtime }}222 BRANCH=${{ github.head_ref }}223 ACALA_BUILD_BRANCH=${{ matrix.acala_version }}224 MOONBEAM_BUILD_BRANCH=${{ matrix.moonbeam_version }}225 CUMULUS_BUILD_BRANCH=${{ matrix.cumulus_version }}226227 - name: Show build Dockerfile228 run: cat .docker/Dockerfile-xcm.${{ matrix.network }}.yml229230 - name: Show launch-config-xcm-${{ matrix.network }} configuration231 run: cat .docker/xcm-config/launch-config-xcm-${{ matrix.network }}.json232233 - name: Run find-and-replace to remove slashes from branch name234 uses: mad9000/actions-find-and-replace-string@2235 id: branchname236 with:237 source: ${{ github.head_ref }}238 find: '/'239 replace: '-'240241 - name: Pull chainql docker image242 run: docker pull uniquenetwork/builder-chainql:latest243244 - name: Build the stack245 run: cd .docker/ && docker build --no-cache --file ./Dockerfile-xcm.${{ matrix.network }}.yml --tag uniquenetwork/xcm-${{ matrix.network }}-testnet-local:nightly-${{ steps.branchname.outputs.value }}-${{ github.sha }} --tag uniquenetwork/xcm-${{ matrix.network }}-testnet-local:latest .246247 - name: Push docker image version248 run: docker push uniquenetwork/xcm-${{ matrix.network }}-testnet-local:nightly-${{ steps.branchname.outputs.value }}-${{ github.sha }}249250 - name: Push docker image latest251 run: docker push uniquenetwork/xcm-${{ matrix.network }}-testnet-local:latest252253 - name: Clean Workspace254 if: always()255 uses: AutoModality/action-clean@v1.1.0256257 - name: Remove builder cache258 if: always() 259 run: |260 docker builder prune -f261 docker system prune -f262263264