From 4a172305db0188db0682d4eb28df29f313ae93fb Mon Sep 17 00:00:00 2001 From: sidey79 <7968127+sidey79@users.noreply.github.com> Date: Wed, 6 Dec 2023 11:07:03 +0100 Subject: [PATCH] cicd[docker]: save cache for plattforms --- .github/workflows/docker-matrix-wheels.yml | 74 +++++++++++++++++++--- 1 file changed, 65 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-matrix-wheels.yml b/.github/workflows/docker-matrix-wheels.yml index b4418cb..7def08a 100644 --- a/.github/workflows/docker-matrix-wheels.yml +++ b/.github/workflows/docker-matrix-wheels.yml @@ -47,10 +47,40 @@ 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-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 + + - 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 + - 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 prepare_matrix: # name: Find fhempy modules @@ -82,9 +112,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 @@ -236,12 +266,14 @@ jobs: target: runtime cache-to: type=gha,scope=runtime-stage_cross-${{ matrix.module }}_${{ hashFiles('./requirements_mod.txt') }},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 }}" @@ -275,6 +307,30 @@ 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-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-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]