Skip to content

Commit

Permalink
Added Github Action Cache
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondop committed Aug 22, 2023
1 parent 25addcf commit 26abe06
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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/[email protected]
with:
python-version: "3.11"


- name: Set up chart-testing
uses: helm/[email protected]
Expand All @@ -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 }}"

0 comments on commit 26abe06

Please sign in to comment.