* fixup! Split independent builds into parallel jobs

* Combine caches within steps of same job

* Remove Maintain Cache workflow

Now that we're caching to ghcr instead of gha, we don't have to worry
about gha's cache eviction after 7 days/10 GB.
This commit is contained in:
Andrew Reiter 2023-07-27 12:41:41 -04:00 committed by GitHub
parent a96602f3f5
commit f0dda499f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 35 deletions

View File

@ -5,7 +5,7 @@ inputs:
required: true required: true
outputs: outputs:
image-name: image-name:
value: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }} value: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ steps.create-short-sha.outputs.SHORT_SHA }}
cache-name: cache-name:
value: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:cache value: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:cache
runs: runs:
@ -34,6 +34,6 @@ runs:
- name: Create version file - name: Create version file
run: make version run: make version
shell: bash shell: bash
- name: Create short sha - id: create-short-sha
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
shell: bash shell: bash

View File

@ -37,7 +37,6 @@ jobs:
target: frigate target: frigate
tags: ${{ steps.setup.outputs.image-name }}-amd64 tags: ${{ steps.setup.outputs.image-name }}-amd64
cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64 cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64
cache-to: type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64,mode=max,compression=zstd
- name: Build and push TensorRT (x86 GPU) - name: Build and push TensorRT (x86 GPU)
uses: docker/bake-action@v3 uses: docker/bake-action@v3
with: with:
@ -46,6 +45,8 @@ jobs:
files: docker/tensorrt/trt.hcl files: docker/tensorrt/trt.hcl
set: | set: |
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64,mode=max,compression=zstd
arm64_build: arm64_build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: ARM Build name: ARM Build
@ -67,8 +68,7 @@ jobs:
target: frigate target: frigate
tags: | tags: |
${{ steps.setup.outputs.image-name }}-standard-arm64 ${{ steps.setup.outputs.image-name }}-standard-arm64
cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-standard-arm64 cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64
cache-to: type=registry,ref=${{ steps.setup.outputs.cache-name }}-standard-arm64,mode=max,compression=zstd
- name: Build and push RPi build - name: Build and push RPi build
uses: docker/bake-action@v3 uses: docker/bake-action@v3
with: with:
@ -77,6 +77,8 @@ jobs:
files: docker/rpi/rpi.hcl files: docker/rpi/rpi.hcl
set: | set: |
rpi.tags=${{ steps.setup.outputs.image-name }}-rpi rpi.tags=${{ steps.setup.outputs.image-name }}-rpi
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64,mode=max,compression=zstd
jetson_jp4_build: jetson_jp4_build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Jetson Jetpack 4 name: Jetson Jetpack 4
@ -152,7 +154,7 @@ jobs:
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
- uses: int128/docker-manifest-create-action@v1 - uses: int128/docker-manifest-create-action@v1
with: with:
tags: ${{ steps.setup.outputs.image-name }} tags: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}
suffixes: | suffixes: |
-amd64 -amd64
-rpi -rpi

View File

@ -1,28 +0,0 @@
name: Maintain Cache
on:
schedule:
- cron: "13 0 * * 0,4"
env:
PYTHON_VERSION: 3.9
jobs:
multi_arch_build:
runs-on: ubuntu-latest
name: Image Build
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up QEMU and Buildx
uses: ./.github/actions/setup
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: false
platforms: linux/amd64,linux/arm64
target: frigate
cache-from: type=gha