From d76d3b4959fe589e481145d2f6c305967bad7139 Mon Sep 17 00:00:00 2001 From: Dimitri Huisman Date: Wed, 31 Aug 2022 18:17:45 +0000 Subject: [PATCH] Switch to ARM64 self-hosted for ARM build --- .github/workflows/build_test_deploy.yml | 62 ++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 403c57f6..55a68367 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -92,7 +92,8 @@ jobs: # This job builds all the images. The build cache is stored in the github actions cache. # In further jobs, this cache is used to quickly rebuild the images. build: - name: Build images + name: Build images for linux/amd64 + if: inputs.architecture == 'linux/amd64' needs: - targets strategy: @@ -145,6 +146,63 @@ jobs: *.cache-to=type=local,dest=/tmp/cache/${{ matrix.target }},mode=max *.platform=${{ inputs.architecture }} +# This job builds all the images. The build cache is stored in the github actions cache. +# In further jobs, this cache is used to quickly rebuild the images. + build-arm: + name: Build images for ARM64 & ARM/V7 + if: inputs.architecture != 'linux/amd64' + needs: + - targets + strategy: + fail-fast: false + matrix: + target: ${{ fromJson(needs.targets.outputs.matrix) }} + runs-on: self-hosted + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + - name: Retrieve global variables + shell: bash + run: | + echo "BRANCH=${{ inputs.branch }}" >> $GITHUB_ENV + echo "MAILU_VERSION=${{ inputs.mailu_version }}" >> $GITHUB_ENV + echo "PINNED_MAILU_VERSION=${{ inputs.pinned_mailu_version }}" >> $GITHUB_ENV + echo "DOCKER_ORG=${{ inputs.docker_org }}" >> $GITHUB_ENV + - name: Configure actions/cache@v3 action for storing build cache in the /tmp/cache folder + uses: actions/cache@v3 + with: + path: /tmp/cache/${{ matrix.target }} + key: ${{ github.ref }}-${{ inputs.mailu_version }}-${{ matrix.target }}-${{ github.run_id }} + restore-keys: | + ${{ github.ref }}-${{ inputs.mailu_version }}-${{ matrix.target }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - uses: crazy-max/ghaction-github-runtime@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.Docker_Login }} + password: ${{ secrets.Docker_Password }} + - name: Build all docker images + env: + DOCKER_ORG: ${{ env.DOCKER_ORG }} + MAILU_VERSION: ${{ env.MAILU_VERSION }} + PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }} + uses: docker/bake-action@v2 + with: + files: ${{env.HCL_FILE}} + targets: ${{ matrix.target }} + load: false + push: false + set: | + *.cache-from=type=local,src=/tmp/cache/${{ matrix.target }} + *.cache-to=type=local,dest=/tmp/cache/${{ matrix.target }},mode=max + *.platform=${{ inputs.architecture }} + # This job runs all the tests. tests: name: tests @@ -424,7 +482,7 @@ jobs: if: inputs.deploy == 'true' && inputs.architecture != 'linux/amd64' runs-on: ubuntu-latest needs: - - build + - build-arm steps: - uses: actions/checkout@v3 - name: Retrieve global variables