Skip to content

Commit

Permalink
Test uber cache
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn committed Aug 1, 2024
1 parent 4bbc2bf commit fe94545
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,25 @@ jobs:
with:
auto-commit: "true"

build-cache-check:
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.cache.outputs.cache-hit }}
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- uses: actions/cache@v4
id: cache
with:
path: /tmp/alfresco-docker-images.tar
key: docker-${{ runner.os }}-${{ hashFiles('docker-bake.hcl','**/Dockerfile','**/artifacts.json','**/entrypoint.sh') }}
lookup-only: true

build-test:
runs-on: ubuntu-latest
needs: pre-commit
needs: build-cache-check
if: '! needs.build-cache-check.outputs.cache-hit'
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand Down Expand Up @@ -70,13 +86,12 @@ jobs:
run: |
docker save -o /tmp/alfresco-docker-images.tar $(docker images --format "{{.Repository}}:{{.Tag}}" | grep alfresco)
- name: Upload images as artifact
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
- name: Save docker archive
id: cache-save
uses: actions/cache/save@v4
with:
name: docker-images
path: /tmp/alfresco-docker-images.tar
retention-days: 1
compression-level: 0
key: docker-${{ runner.os }}-${{ hashFiles('docker-bake.hcl','**/Dockerfile','**/artifacts.json','**/entrypoint.sh') }}

compose-test:
name: compose-test ${{ matrix.docker-compose-file }}
Expand All @@ -88,12 +103,13 @@ jobs:
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8

- name: Restore cache
uses: actions/cache/restore@v4
with:
path: /tmp
name: docker-images
path: /tmp/alfresco-docker-images.tar
key: docker-${{ runner.os }}-${{ hashFiles('docker-bake.hcl','**/Dockerfile','**/artifacts.json','**/entrypoint.sh') }}
fail-on-cache-miss: true

- name: Load Docker images
run: |
Expand Down

0 comments on commit fe94545

Please sign in to comment.