From c4dd3c4bf188dec6499ce1905b6921bd49fe37b7 Mon Sep 17 00:00:00 2001 From: ktatarnikov Date: Thu, 2 Jan 2025 11:51:10 +0100 Subject: [PATCH] [aarch64 support] splitting docker and helm build, splitting docker build for different platforms --- .github/workflows/build.yaml | 82 +++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 524da363..6c19bb47 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -44,8 +44,8 @@ jobs: RUST_LOG: debug run: cargo test --all-features - build: - name: Build + build-helm-chart: + name: Build Helm Chart runs-on: ubuntu-latest needs: [test] @@ -64,11 +64,68 @@ jobs: - name: Install Helm uses: azure/setup-helm@v3 + - name: Make versions + run: | + cd "${{ github.workspace }}" + chmod +x ./version.sh + ./version.sh "${{ github.sha }}" "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" + echo "VERSION_APP=$(cat "./VERSION")" >> $GITHUB_ENV + echo "DOCKER_IMAGES=$(cat "./DOCKER_IMAGES")" >> $GITHUB_ENV + echo "DOCKER_TAGS=$(cat "./VERSION_DOCKER")" >> $GITHUB_ENV + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Create a github release + if: ${{ github.ref == 'refs/heads/main' }} + run: gh release create "${{ env.VERSION_APP }}" + env: + GH_TOKEN: ${{ github.token }} + + - name: Publish Helm charts + uses: stefanprodan/helm-gh-pages@master + with: + token: ${{ github.token }} + charts_dir: "./charts" + target_dir: "./helm-charts" # todo dev / release + + build-docker: + name: Docker Build / ${{ matrix.platform }} + runs-on: ubuntu-latest + needs: [test] + + strategy: + fail-fast: false + matrix: + platform: + - linux/amd64 + - linux/arm64 + # isPR: + # - ${{github.event_name == 'pull_request'}} + # exclude: + # - { isPR: true } + # include: + # - { platform: "linux/amd64" } + + defaults: + run: + working-directory: ./ + permissions: + contents: write + packages: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up QEMU uses: docker/setup-qemu-action@v3 # @TODO: don't build form arm during development cos it's super slow with: - platforms: linux/amd64, linux/arm64 + platforms: ${{ matrix.platform }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -101,23 +158,6 @@ jobs: with: push: true # @TODO: don't build form arm during development cos it's super slow - platforms: linux/amd64,linux/arm64 + platforms: ${{ matrix.platform }} tags: ${{ env.DOCKER_IMAGES }} labels: ${{ steps.meta.outputs.labels }} - - - name: Configure Git - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - - name: Create a github release - run: gh release create "${{ env.VERSION_APP }}" - env: - GH_TOKEN: ${{ github.token }} - - - name: Publish Helm charts - uses: stefanprodan/helm-gh-pages@master - with: - token: ${{ github.token }} - charts_dir: "./charts" - target_dir: "./helm-charts" \ No newline at end of file