From 34f326a30f399a71785420d6ddce09a34657b9e2 Mon Sep 17 00:00:00 2001 From: Edmondo Porcu Date: Sun, 20 Aug 2023 11:19:34 -0700 Subject: [PATCH] Added Github Action Cache --- .github/workflows/docker.yaml | 48 ++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 509d14f78..9b03b28b4 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -61,21 +61,23 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - name: Docker meta id: arroyo-docker # you'll use this in the next step - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v4.6.0 with: images: | ghcr.io/${{ github.repository_owner }}/arroyo-${{ matrix.image_type }} tags: | - type=schedule - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha - flavor: latest=false,prefix=${{ matrix.prom_arch }}- + type=schedule,prefix=${{ matrix.prom_arch }}- + type=ref,event=branch,prefix=${{ matrix.prom_arch }}- + type=ref,event=pr,prefix=${{ matrix.prom_arch }}- + type=semver,pattern={{version}},prefix=${{ matrix.prom_arch }}- + type=semver,pattern={{major}}.{{minor}},prefix=${{ matrix.prom_arch }}- + type=semver,pattern={{major}},prefix=${{ matrix.prom_arch }}- + type=sha,prefix=${{ matrix.prom_arch }}- + flavor: latest=false - name: Set env run: echo "GIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV - name: Build and push @@ -90,6 +92,8 @@ jobs: PROM_ARCH=${{ matrix.prom_arch }} GIT_SHA=${{ env.GIT_SHA }} push: true + cache-from: type=registry,ref=user/app:latest + cache-to: type=inline tags: ${{ steps.arroyo-docker.outputs.tags }} labels: ${{ steps.arroyo-docker.outputs.labels }} manifest: @@ -142,8 +146,13 @@ jobs: docker manifest annotate ${IMAGE}:tip ${IMAGE}:amd64-${TAG} --arch amd64 docker manifest push ${IMAGE}:tip helm: + strategy: + matrix: + config: + - {runner: 'buildjet-8vcpu-ubuntu-2204', arch: 'amd64'} + - {runner: 'buildjet-8vcpu-ubuntu-2204-arm', arch: 'arm64'} needs: build - runs-on: buildjet-8vcpu-ubuntu-2204 + runs-on: ${{ matrix.config.runner }} if: ${{ github.event_name == 'pull_request' }} defaults: run: @@ -162,10 +171,16 @@ jobs: # Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and # yamllint (https://github.com/adrienverge/yamllint) which require Python - - name: Set up Python + # actions/setup-python doesn't yet support ARM + - if: ${{ !endsWith(matrix.config.runner, '-arm') }} uses: actions/setup-python@v4 with: - python-version: 3.11 + python-version: "3.11" + - if: ${{ endsWith(matrix.config.runner, '-arm') }} + uses: deadsnakes/action@v2.1.1 + with: + python-version: "3.11" + - name: Set up chart-testing uses: helm/chart-testing-action@v2.2.1 @@ -188,12 +203,11 @@ jobs: ct install --charts ./ --config ct.yaml \ --helm-extra-set-args="\ --set=api.image.repository=ghcr.io/${{ github.repository_owner }}/arroyo-services \ - --set=api.image.tag=sha-${{ steps.short-sha.outputs.sha }} \ + --set=api.image.tag=${{ matrix.config.arch }}-sha-${{ steps.short-sha.outputs.sha }} \ --set=compiler.image.repository=ghcr.io/${{ github.repository_owner }}/arroyo-compiler \ - --set=compiler.image.tag=sha-${{ steps.short-sha.outputs.sha }} \ + --set=compiler.image.tag=${{ matrix.config.arch }}-sha-${{ steps.short-sha.outputs.sha }} \ --set=controller.image.repository=ghcr.io/${{ github.repository_owner }}/arroyo-services \ - --set=controller.image.tag=sha-${{ steps.short-sha.outputs.sha }} \ + --set=controller.image.tag=${{ matrix.config.arch }}-sha-${{ steps.short-sha.outputs.sha }} \ --set=worker.image.repository=ghcr.io/${{ github.repository_owner }}/arroyo-worker \ - --set=worker.image.tag=sha-${{ steps.short-sha.outputs.sha }}" - + --set=worker.image.tag=${{ matrix.config.arch }}-sha-${{ steps.short-sha.outputs.sha }}" \ No newline at end of file