diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9a1708..af5bfdf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,39 @@ jobs: - name: Repository Checkout uses: actions/checkout@v4 + # --- Testcontainers Docker image cache (mysql + ryuk) --- + - name: Create docker cache directory + run: mkdir -p /tmp/docker-cache + + - name: Cache Testcontainers images + id: tc-image-cache + uses: actions/cache@v4 + with: + path: /tmp/docker-cache + key: testcontainers-images-${{ runner.os }}-mysql8.0-ryuk0.12.0-v1 + restore-keys: | + testcontainers-images-${{ runner.os }}- + + - name: Pull and save Docker images (cache miss) + if: steps.tc-image-cache.outputs.cache-hit != 'true' + run: | + set -euo pipefail + + docker pull mysql:8.0 + docker save -o /tmp/docker-cache/mysql_8.0.tar mysql:8.0 + + docker pull testcontainers/ryuk:0.12.0 + docker save -o /tmp/docker-cache/ryuk_0.12.0.tar testcontainers/ryuk:0.12.0 + + - name: Load cached Docker images (cache hit) + if: steps.tc-image-cache.outputs.cache-hit == 'true' + run: | + set -euo pipefail + + docker load -i /tmp/docker-cache/mysql_8.0.tar + docker load -i /tmp/docker-cache/ryuk_0.12.0.tar + # --- End Testcontainers Docker image cache --- + - name: Set up JDK 21 uses: actions/setup-java@v4 with: