From e705757fa3a11d541548889a01ef5bdee8180a74 Mon Sep 17 00:00:00 2001 From: Ernest Walzel Date: Thu, 24 Feb 2022 19:17:20 +0100 Subject: [PATCH] Prune docker cache every month As otherwise it'll grow in size https://github.com/satackey/action-docker-layer-caching/issues/55 --- .github/workflows/test.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 152375c3c..8244470b0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,11 +11,18 @@ jobs: run: cp .env.example .env - name: Warm up stack (and pull images to prevent them from being cached) run: docker-compose up -d mysql elasticsearch redis + # https://github.com/satackey/action-docker-layer-caching/issues/55#issuecomment-763418185 + - name: Set MONTH var for cache key + run: echo "MONTH=$(date +%m)" >> $GITHUB_ENV - uses: satackey/action-docker-layer-caching@v0.0.11 # Ignore the failure of a step and avoid terminating the job. # https://github.com/satackey/action-docker-layer-caching#docker-compose continue-on-error: true + with: + key: ${{ github.workflow }}-${{ env.MONTH }}-{hash} + restore-keys: | + ${{ github.workflow }}-${{ env.MONTH }}- - name: Build docker image - run: docker-compose build php + run: docker-compose build php - name: Test run: docker-compose run -e MIX_SKIP_CSS_URL_PROCESSING=1 php bash -c "npm run production && vendor/bin/phpunit"