From 429586730d83df3b8eb8a3450ab17e5270b5372b Mon Sep 17 00:00:00 2001 From: Burak Velioglu Date: Mon, 18 Nov 2024 13:20:32 +0300 Subject: [PATCH] Add docker layer cache tests Adding tests for docker layer caching --- .github/workflows/test_restore_cache.yml | 17 +++++++++++++++++ .github/workflows/test_save_cache.yml | 10 ++++++++++ docker/Dockerfile | 3 +++ 3 files changed, 30 insertions(+) create mode 100644 docker/Dockerfile diff --git a/.github/workflows/test_restore_cache.yml b/.github/workflows/test_restore_cache.yml index 3d72fe3..a358324 100644 --- a/.github/workflows/test_restore_cache.yml +++ b/.github/workflows/test_restore_cache.yml @@ -86,3 +86,20 @@ jobs: run: | echo "Cache didn't hit for restore-cache" exit 1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker image + id: build-docker + uses: docker/build-push-action@v4 + with: + context: ./docker + push: false + cache-from: type=gha + + - name: Error if cache doesn't hit for build-docker + if: steps.build-docker.outputs.cache-hit == 'false' + run: | + echo "Cache didn't hit for build-docker" + exit 1 diff --git a/.github/workflows/test_save_cache.yml b/.github/workflows/test_save_cache.yml index 0e9e764..7cf57c1 100644 --- a/.github/workflows/test_save_cache.yml +++ b/.github/workflows/test_save_cache.yml @@ -64,3 +64,13 @@ jobs: myfolder myfolder2 key: cached_folders + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker image + uses: docker/build-push-action@v4 + with: + context: ./docker + push: false + cache-to: type=gha,mode=max diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..f0f7387 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine:latest + +RUN apk add --no-cache curl