-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 694cf06
Showing
6 changed files
with
285 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,145 @@ | ||
name: Cache | ||
|
||
on: | ||
workflow_dispatch: | ||
# inputs: | ||
# invalidate_cache_1: | ||
# default: false | ||
# type: boolean | ||
|
||
# invalidate_cache_2: | ||
# default: true | ||
# type: boolean | ||
|
||
jobs: | ||
upload-cache: | ||
name: upload ${{ matrix.provider }} ${{ matrix.runs-on }} | ||
runs-on: ${{ matrix.runs-on }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runs-on: [ubuntu-latest, ubicloud] | ||
provider: [gha, minio] | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Extract metadata for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: enescakir/benchmarking | ||
tags: type=raw,value=large-image-${{ matrix.runs-on }} | ||
|
||
- name: Log in to registry | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Free up space | ||
run: | | ||
docker system prune -f | ||
docker builder prune -f | ||
sudo rm -rf /opt/hostedtoolcache/CodeQL | ||
sudo rm -rf /usr/local/lib/android | ||
sudo rm -rf /usr/local/.ghcup | ||
sudo rm -rf /usr/share/swift | ||
sudo rm -rf /usr/share/dotnet | ||
- name: Build and upload cache to GHA | ||
if: matrix.provider == 'gha' | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: Dockerfile.cache | ||
platforms: linux/amd64 | ||
push: false | ||
# cache-from: type=gha,scope=ubicloud-${{ matrix.runs-on }} | ||
cache-to: type=gha,mode=max,scope=ubicloud-${{ matrix.runs-on }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Build and upload cache to MinIO | ||
if: matrix.provider == 'minio' | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: Dockerfile.cache | ||
platforms: linux/amd64 | ||
push: false | ||
# cache-from: type=s3,region=us-east-1,bucket=ubicloud-cache,name=ubicloud-${{ matrix.runs-on }},use_path_style=true,endpoint_url=${{ secrets.MINIO_ENDPOINT }},access_key_id=${{ secrets.MINIO_USERNAME }},secret_access_key=${{ secrets.MINIO_TOKEN }} | ||
cache-to: type=s3,region=us-east-1,bucket=ubicloud-cache,name=ubicloud-${{ matrix.runs-on }},mode=max,use_path_style=true,endpoint_url=${{ secrets.MINIO_ENDPOINT }},access_key_id=${{ secrets.MINIO_USERNAME }},secret_access_key=${{ secrets.MINIO_TOKEN }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
download-cache: | ||
name: download ${{ matrix.provider }} ${{ matrix.runs-on }} | ||
needs: upload-cache | ||
runs-on: ${{ matrix.runs-on }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runs-on: [ubuntu-latest, ubicloud] | ||
provider: [gha, minio] | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Extract metadata for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: enescakir/benchmarking | ||
tags: type=raw,value=large-image-${{ matrix.runs-on }} | ||
|
||
- name: Log in to registry | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Free up space | ||
run: | | ||
docker system prune -f | ||
docker builder prune -f | ||
sudo rm -rf /opt/hostedtoolcache/CodeQL | ||
sudo rm -rf /usr/local/lib/android | ||
sudo rm -rf /usr/local/.ghcup | ||
sudo rm -rf /usr/share/swift | ||
sudo rm -rf /usr/share/dotnet | ||
- name: Download cache to GHA | ||
if: matrix.provider == 'gha' | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: Dockerfile.cache | ||
platforms: linux/amd64 | ||
push: false | ||
cache-from: type=gha,scope=ubicloud-${{ matrix.runs-on }} | ||
# cache-to: type=gha,mode=max,scope=ubicloud-${{ matrix.runs-on }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Download cache to MinIO | ||
if: matrix.provider == 'minio' | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: Dockerfile.cache | ||
platforms: linux/amd64 | ||
push: false | ||
cache-from: type=s3,region=us-east-1,bucket=ubicloud-cache,name=ubicloud-${{ matrix.runs-on }},use_path_style=true,endpoint_url=${{ secrets.MINIO_ENDPOINT }},access_key_id=${{ secrets.MINIO_USERNAME }},secret_access_key=${{ secrets.MINIO_TOKEN }} | ||
# cache-to: type=s3,region=us-east-1,bucket=ubicloud-cache,name=ubicloud-${{ matrix.runs-on }},mode=max,use_path_style=true,endpoint_url=${{ secrets.MINIO_ENDPOINT }},access_key_id=${{ secrets.MINIO_USERNAME }},secret_access_key=${{ secrets.MINIO_TOKEN }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
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 |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: Registry Push/Pull | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
jobs: | ||
push: | ||
name: push ${{ matrix.registry }} ${{ matrix.runs-on }} | ||
runs-on: ${{ matrix.runs-on }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runs-on: [ubuntu-latest, ubicloud] | ||
registry: [docker.io, ghcr.io] | ||
include: | ||
- registry: docker.io | ||
image: enescakir/benchmarking | ||
username_key: DOCKERHUB_USERNAME | ||
password_key: DOCKERHUB_TOKEN | ||
- registry: ghcr.io | ||
image: ghcr.io/enescakir/benchmarking | ||
username_key: GHCR_USERNAME | ||
password_key: GITHUB_TOKEN | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Extract metadata for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ matrix.image }} | ||
tags: type=raw,value=large-image-${{ matrix.runs-on }} | ||
|
||
- name: Log in to registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ matrix.registry }} | ||
username: ${{ secrets[matrix.username_key] }} | ||
password: ${{ secrets[matrix.password_key] }} | ||
|
||
- name: Free up space | ||
run: | | ||
docker system prune -f | ||
docker builder prune -f | ||
sudo rm -rf /opt/hostedtoolcache/CodeQL | ||
sudo rm -rf /usr/local/lib/android | ||
sudo rm -rf /usr/local/.ghcup | ||
sudo rm -rf /usr/share/swift | ||
sudo rm -rf /usr/share/dotnet | ||
- name: Invalidate push cache | ||
run: touch test1.txt | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: Dockerfile.registry | ||
platforms: linux/amd64 | ||
push: false | ||
load: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: List docker images | ||
run: docker images | ||
|
||
- name: Push Docker image | ||
run: docker push ${{ matrix.image }}:large-image-${{ matrix.runs-on }} | ||
|
||
|
||
pull: | ||
needs: push | ||
name: pull ${{ matrix.registry }} ${{ matrix.runs-on }} | ||
runs-on: ${{ matrix.runs-on }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runs-on: [ubuntu-latest, ubicloud] | ||
registry: [docker.io, ghcr.io] | ||
include: | ||
- registry: docker.io | ||
image: enescakir/benchmarking | ||
username_key: DOCKERHUB_USERNAME | ||
password_key: DOCKERHUB_TOKEN | ||
- registry: ghcr.io | ||
image: ghcr.io/enescakir/benchmarking | ||
username_key: GHCR_USERNAME | ||
password_key: GITHUB_TOKEN | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ matrix.registry }} | ||
username: ${{ secrets[matrix.username_key] }} | ||
password: ${{ secrets[matrix.password_key] }} | ||
|
||
- name: Pull Docker image | ||
run: docker pull ${{ matrix.image }}:large-image-${{ matrix.runs-on }} |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
FROM alpine:3.7 | ||
|
||
LABEL org.opencontainers.image.source=https://github.com/enescakir/large-image-benchmark | ||
|
||
COPY Dockerfile.cache ./ | ||
|
||
COPY test1.txt ./ | ||
RUN dd if=/dev/urandom of=test1.txt bs=1G count=3 | ||
|
||
COPY test2.txt ./ | ||
RUN dd if=/dev/urandom of=test2.txt bs=1G count=3 | ||
|
||
RUN dd if=/dev/urandom of=test3.txt bs=1G count=3 | ||
|
||
RUN dd if=/dev/urandom of=test4.txt bs=1G count=3 |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
FROM alpine:3.7 | ||
|
||
LABEL org.opencontainers.image.source=https://github.com/enescakir/large-image-benchmark | ||
|
||
COPY Dockerfile.registry ./ | ||
|
||
COPY test1.txt ./ | ||
RUN dd if=/dev/urandom of=test1.txt bs=1G count=4 | ||
|
||
COPY test2.txt ./ | ||
RUN dd if=/dev/urandom of=test2.txt bs=1G count=2 |
Empty file.
Empty file.