From 8c809872e8fdfb65377ea16da4c48d6d44eee650 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Mon, 2 Feb 2026 14:58:19 +0100 Subject: [PATCH] GitHub build - attempt to cache container build better --- .../test-stack-reusable-workflow.yml | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-stack-reusable-workflow.yml b/.github/workflows/test-stack-reusable-workflow.yml index d63eeadd..328373eb 100644 --- a/.github/workflows/test-stack-reusable-workflow.yml +++ b/.github/workflows/test-stack-reusable-workflow.yml @@ -37,10 +37,29 @@ jobs: ${{ runner.os }}-pip-py${{ env.PYTHON_VERSION }}- ${{ runner.os }}-pip- + - name: Get current date for cache key + id: date + run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build changedetection.io container for testing under Python ${{ env.PYTHON_VERSION }} + uses: docker/build-push-action@v6 + with: + context: ./ + file: ./Dockerfile + build-args: | + PYTHON_VERSION=${{ env.PYTHON_VERSION }} + LOGGER_LEVEL=TRACE + tags: test-changedetectionio + load: true + cache-from: type=gha,scope=build-${{ github.ref_name }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('requirements.txt', 'Dockerfile') }}-${{ steps.date.outputs.date }} + cache-to: type=gha,mode=max,scope=build-${{ github.ref_name }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('requirements.txt', 'Dockerfile') }}-${{ steps.date.outputs.date }} + + - name: Verify build run: | - echo "---- Building for Python ${{ env.PYTHON_VERSION }} -----" - docker build --build-arg PYTHON_VERSION=${{ env.PYTHON_VERSION }} --build-arg LOGGER_LEVEL=TRACE -t test-changedetectionio . + echo "---- Built for Python ${{ env.PYTHON_VERSION }} -----" docker run test-changedetectionio bash -c 'pip list' - name: We should be Python ${{ env.PYTHON_VERSION }} ...