-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GITHUB: workflows/testing.yml: configure and use buildx with selectiv…
…e caching Signed-off-by: Tim Janik <[email protected]>
- Loading branch information
Showing
1 changed file
with
20 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,19 +18,17 @@ jobs: | |
steps: | ||
# Checkout and fix actions/checkout messing up annotation of the fetched tag: actions/checkout#290 | ||
- uses: actions/checkout@v4 | ||
with: { fetch-depth: 0, show-progress: false } | ||
- run: git fetch -f --tags | ||
# Docker build - use BuildKit and Github action API for reliable caching | ||
- uses: docker/[email protected] | ||
- run: docker buildx create --use --driver=docker-container # multi-platform, exports cache, needs --load | ||
- uses: docker/build-push-action@v4 | ||
with: # docker build -t cifocal:latest -f misc/Dockerfile.focal misc | ||
tags: cifocal:latest | ||
file: misc/Dockerfile.focal | ||
context: misc/ | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
load: true | ||
- run: git fetch --unshallow && git fetch -f --tags | ||
# Use either cache-from or cache-to, so buildx cannot mess up good caches | ||
- uses: actions/cache@v3 | ||
with: | ||
key: cifocal-${{hashFiles ('misc/Dockerfile.focal')}} | ||
path: /tmp/acache | ||
- name: Docker Build cifocal | ||
run: | | ||
docker buildx create --use --driver=docker-container # multi-platform, exports cache, needs --load | ||
test -r /tmp/acache/index.json && CACHETYPE=--cache-from=type=local,src=/tmp/acache || CACHETYPE=--cache-to=type=local,mode=max,dest=/tmp/acache | ||
time docker buildx build $CACHETYPE --load -t $CITAG -f misc/Dockerfile.focal misc | ||
# Build Assets | ||
- name: Build Assets | ||
run: | | ||
|
@@ -51,20 +49,17 @@ jobs: | |
steps: | ||
# Checkout and fix actions/checkout messing up annotation of the fetched tag: actions/checkout#290 | ||
- uses: actions/checkout@v4 | ||
- run: git fetch --unshallow && git fetch -f --tags | ||
# Use either cache-from or cache-to, so buildx cannot mess up good caches | ||
- uses: actions/cache@v3 | ||
with: | ||
path: /tmp/aca/ | ||
key: Focal-${{ hashFiles ('misc/Dockerfile.focal') }} | ||
- uses: docker/[email protected] # Use BuildKit for reliable caching | ||
- run: docker buildx create --use --driver=docker-container # multi-platform, exports cache, needs --load | ||
- uses: docker/build-push-action@v4 | ||
with: # docker build -t cifocal:latest -f misc/Dockerfile.focal misc | ||
tags: cifocal:latest | ||
file: misc/Dockerfile.focal | ||
context: misc/ | ||
cache-from: type=local,src=/tmp/aca/ | ||
cache-to: type=local,dest=/tmp/aca/,mode=max | ||
load: true | ||
key: cifocal-${{hashFiles ('misc/Dockerfile.focal')}} | ||
path: /tmp/acache | ||
- name: Docker Build cifocal | ||
run: | | ||
docker buildx create --use --driver=docker-container # multi-platform, exports cache, needs --load | ||
test -r /tmp/acache/index.json && CACHETYPE=--cache-from=type=local,src=/tmp/acache || CACHETYPE=--cache-to=type=local,mode=max,dest=/tmp/acache | ||
time docker buildx build $CACHETYPE --load -t $CITAG -f misc/Dockerfile.focal misc | ||
# Build Assets | ||
- name: Build Assets | ||
run: | | ||
|