Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .docker/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ services:
SS_PHPUNIT_FLUSH: 1

db:
image: mysql:8
image: mysql:8.4
ports:
- "${DB_PORT}:3306"
volumes:
Expand Down
39 changes: 39 additions & 0 deletions .github/actions/cache-mysql-image/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Cache MySQL image
description: >-
Restore the db service image from the Actions cache, falling back to a single
pull-and-save on a miss. Keeps a Docker Hub rate limit or registry outage from
failing CI on every run, since the image only has to be fetched once per
cache lifetime instead of on every job.

inputs:
compose-file:
description: Compose file that declares the db service whose image to cache.
default: .docker/compose.yml

runs:
using: composite
steps:
# Resolve the image straight from the compose file so this stays correct
# if the pinned version changes — compose.yml is the single source of truth.
- id: image
shell: bash
run: |
ref="$(docker compose -f '${{ inputs.compose-file }}' config --images db)"
echo "ref=$ref" >> "$GITHUB_OUTPUT"
echo "key=$(printf '%s' "$ref" | tr -c '[:alnum:].' '-')" >> "$GITHUB_OUTPUT"

- id: cache
uses: actions/cache@v4
with:
path: /tmp/db-image.tar
key: db-image-${{ steps.image.outputs.key }}

- if: steps.cache.outputs.cache-hit == 'true'
shell: bash
run: docker load --input /tmp/db-image.tar

- if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: |
docker pull '${{ steps.image.outputs.ref }}'
docker save '${{ steps.image.outputs.ref }}' --output /tmp/db-image.tar
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
steps:
- uses: actions/checkout@v6
- run: make .docker/.env
- uses: ./.github/actions/cache-mysql-image
name: Cache MySQL image
- run: $COMPOSE up -d --build --wait app
name: Start services
- run: make analyse
Expand All @@ -39,6 +41,8 @@ jobs:
steps:
- uses: actions/checkout@v6
- run: make .docker/.env
- uses: ./.github/actions/cache-mysql-image
name: Cache MySQL image
- run: $COMPOSE up -d --build --wait
name: Start services
- run: mkdir -p reports
Expand Down
Loading