Skip to content

Commit

Permalink
cicd[docker]: save cache for plattforms
Browse files Browse the repository at this point in the history
  • Loading branch information
sidey79 committed Dec 6, 2023
1 parent 339f040 commit 39ce5e5
Showing 1 changed file with 75 additions and 14 deletions.
89 changes: 75 additions & 14 deletions .github/workflows/docker-matrix-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,44 @@ jobs:
platforms: linux/amd64,linux/arm/v6,linux/arm/v7
push: false
target: base
cache-to: type=gha,mode=min,scope=base_stage_cross
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
cache-from: |
type=gha,scope=base_stage_cross
type=gha,scope=base_stage_amd64
type=gha,scope=base_stage_armv7
type=gha,scope=base_stage_armv6
- name: cache base image amd64
uses: docker/build-push-action@v3.2.0
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: false
target: base
cache-to: type=gha,mode=min,scope=base_stage_amd64
cache-from: type=local,src=/tmp/.buildx-cache

- name: cache base image armv7
uses: docker/build-push-action@v3.2.0
with:
context: .
file: Dockerfile
platforms: linux/arm/v7
push: false
target: base
cache-to: type=gha,mode=min,scope=base_stage_armv7
cache-from: type=local,src=/tmp/.buildx-cache

- name: cache base image armv6
uses: docker/build-push-action@v3.2.0
with:
context: .
file: Dockerfile
platforms: linux/arm/v6
push: false
target: base
cache-to: type=gha,mode=min,scope=base_stage_armv6
cache-from: type=local,src=/tmp/.buildx-cache

prepare_matrix:
# name: Find fhempy modules
Expand Down Expand Up @@ -82,9 +116,9 @@ jobs:
do
REQS=$(jq -cr 'select(.requirements != []).requirements' ./"$i"/manifest.json)
## Just for testing the pipeline with a subset of modules
## if ! [[ "$i" =~ ^(googlecast|geizhals|fhem_forum|bt_presence)$ ]]; then
## continue
## fi
if ! [[ "$i" =~ ^(googlecast|geizhals|fhem_forum|bt_presence)$ ]]; then
continue
fi
## End of test
if [[ -z $REQS ]]; then
continue
Expand Down Expand Up @@ -177,13 +211,12 @@ jobs:
push: false
load: true
target: runtime
cache-to: type=gha,scope=runtime-stage_cross-${{ matrix.module }}_${{ hashFiles('./requirements_mod.txt') }},ignore-error=true
cache-to: type=gha,scope=runtime-stage-${{ matrix.module }}_${{ hashFiles('./requirements_mod.txt') }}-amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
type=gha,scope=base_stage_cross
type=gha,scope=runtime-stage_cross-${{ matrix.module }}_${{ hashFiles('./requirements_mod.txt') }}
# type=gha,scope=runtime-stage_cross
type=gha,scope=base_stage_amd64
type=gha,scope=runtime-stage-${{ matrix.module }}_${{ hashFiles('./requirements_mod.txt') }}-amd64
build-args: |
PKGS=${{ matrix.PKGS }}
Expand Down Expand Up @@ -234,14 +267,16 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: runtime
cache-to: type=gha,scope=runtime-stage_cross-${{ matrix.module }}_${{ hashFiles('./requirements_mod.txt') }},mode=max
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
cache-from: |
type=gha,scope=base_stage_cross
type=gha,scope=runtime-stage_cross
type=gha,scope=runtime-stage_cross-${{ matrix.module }}_${{ hashFiles('./requirements_mod.txt') }}
type=gha,scope=base_stage_amd64
type=gha,scope=base_stage_armv6
type=gha,scope=base_stage_armv7
type=gha,scope=runtime-stage-${{ matrix.module }}_${{ hashFiles('./requirements_mod.txt') }}-amd64
type=gha,scope=runtime-stage-${{ matrix.module }}_${{ hashFiles('./requirements_mod.txt') }}-armv7
build-args: |
PKGS=${{ matrix.PKGS }}
- name: show image details
run: |
echo "${{ steps.docker_build_runtime_cross.outputs.imageid }}"
Expand Down Expand Up @@ -275,6 +310,32 @@ jobs:
path: matrix_result.md
if-no-files-found: warn

- name: cache armv7 image
uses: docker/build-push-action@v3.2.0
with:
context: .
platforms: linux/arm/v7
push: false
load: false
target: runtime
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=gha,scope=runtime-stage-${{ matrix.module }}_${{ hashFiles('./requirements_mod.txt') }}-armv7
build-args: |
PKGS=${{ matrix.PKGS }}
- name: cache amd64 image
uses: docker/build-push-action@v3.2.0
with:
context: .
platforms: linux/amd64
push: false
load: false
target: runtime
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=gha,scope=runtime-stage-${{ matrix.module }}_${{ hashFiles('./requirements_mod.txt') }}-amd64
build-args: |
PKGS=${{ matrix.PKGS }}
check-matrix:
runs-on: ubuntu-latest
needs: [buildImages,prepare_build]
Expand Down

0 comments on commit 39ce5e5

Please sign in to comment.