1name: testnet-image-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: [self-hosted-ci,medium]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@v3.1.032 with:33 ref: ${{ github.head_ref }} 3435 - name: Read .env file36 uses: xom9ikk/dotenv@v23738 - name: Create Execution matrix39 uses: CertainLach/create-matrix-action@v440 id: create_matrix41 with:42 matrix: |43 network {opal}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}44 network {quartz}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}45 network {unique}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}4647 testnet-build:48 needs: prepare-execution-marix49 50 runs-on: [self-hosted-ci,medium]5152 timeout-minutes: 6005354 name: ${{ matrix.network }}5556 continue-on-error: true 5758 strategy:59 matrix:60 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}6162 steps:63 - name: Skip if pull request is in Draft64 if: github.event.pull_request.draft == true65 run: exit 16667 - name: Clean Workspace68 uses: AutoModality/action-clean@v1.1.06970 71 - uses: actions/checkout@v3.1.072 with:73 ref: ${{ github.head_ref }} 7475 - name: Read .env file76 uses: xom9ikk/dotenv@v27778 - name: Generate ENV related extend file for docker-compose79 uses: cuchi/jinja2-action@v1.2.080 with:81 template: .docker/Dockerfile-testnet.j282 output_file: .docker/Dockerfile-testnet.${{ matrix.network }}.yml83 variables: |84 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}85 NETWORK=${{ matrix.network }}86 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}87 POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }}88 NETWORK=${{ matrix.network }}89 BRANCH=${{ github.head_ref }}9091 - name: Show build configuration92 run: cat .docker/Dockerfile-testnet.${{ matrix.network }}.yml9394 - name: Show launch-config configuration95 run: cat launch-config.json9697 - name: Run find-and-replace to remove slashes from branch name98 uses: mad9000/actions-find-and-replace-string@499 id: branchname100 with:101 source: ${{ github.head_ref }}102 find: '/'103 replace: '-'104105 - name: Log in to Docker Hub106 uses: docker/login-action@v2.1.0107 with:108 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}109 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}110111 - name: Pull polkadot docker image112 run: docker pull uniquenetwork/builder-polkadot:${{ matrix.relay_branch }} 113114 - name: Build the stack115 run: cd .docker/ && docker build --file ./Dockerfile-testnet.${{ matrix.network }}.yml --tag uniquenetwork/${{ matrix.network }}-testnet-local-nightly:nightly-${{ steps.branchname.outputs.value }}-${{ github.sha }} . 116117 - name: Push docker version image118 run: docker push uniquenetwork/${{ matrix.network }}-testnet-local-nightly:nightly-${{ steps.branchname.outputs.value }}-${{ github.sha }}119120 - name: Clean Workspace121 if: always()122 uses: AutoModality/action-clean@v1.1.0123124 - name: Remove builder cache125 if: always() 126 run: |127 docker builder prune -f128 docker system prune -f