|
| 1 | +name: Cache Benchmark |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +env: |
| 7 | + REGISTRY: ghcr.io |
| 8 | + IMAGE_PREFIX: ghcr.io/databuddy-analytics/databuddy |
| 9 | + |
| 10 | +jobs: |
| 11 | + gha-cache: |
| 12 | + name: "GHA cache (links, amd64)" |
| 13 | + runs-on: blacksmith-4vcpu-ubuntu-2404 |
| 14 | + timeout-minutes: 15 |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + packages: write |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 20 | + |
| 21 | + - name: Mount Docker build cache |
| 22 | + uses: useblacksmith/stickydisk@41873b1513bb679f9c115504cbd13d3660432504 # v1 |
| 23 | + with: |
| 24 | + key: ${{ github.repository }}-cache-bench-gha |
| 25 | + path: /tmp/docker-build-cache |
| 26 | + |
| 27 | + - name: Set up Docker Builder |
| 28 | + uses: useblacksmith/setup-docker-builder@ac083cc84672d01c60d5e8561d0a939b697de542 # v1 |
| 29 | + |
| 30 | + - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4 |
| 31 | + with: |
| 32 | + registry: ${{ env.REGISTRY }} |
| 33 | + username: ${{ github.actor }} |
| 34 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + |
| 36 | + - name: Build with GHA cache |
| 37 | + uses: useblacksmith/build-push-action@cbd1f60d194a98cb3be5523b15134501eaf0fbf3 # v2 |
| 38 | + with: |
| 39 | + context: . |
| 40 | + file: links.Dockerfile |
| 41 | + push: false |
| 42 | + platforms: linux/amd64 |
| 43 | + tags: bench:gha-cache |
| 44 | + cache-from: type=gha,scope=bench-gha |
| 45 | + cache-to: type=gha,mode=max,scope=bench-gha |
| 46 | + |
| 47 | + registry-cache: |
| 48 | + name: "Registry cache (links, amd64)" |
| 49 | + runs-on: blacksmith-4vcpu-ubuntu-2404 |
| 50 | + timeout-minutes: 15 |
| 51 | + permissions: |
| 52 | + contents: read |
| 53 | + packages: write |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 56 | + |
| 57 | + - name: Mount Docker build cache |
| 58 | + uses: useblacksmith/stickydisk@41873b1513bb679f9c115504cbd13d3660432504 # v1 |
| 59 | + with: |
| 60 | + key: ${{ github.repository }}-cache-bench-registry |
| 61 | + path: /tmp/docker-build-cache |
| 62 | + |
| 63 | + - name: Set up Docker Builder |
| 64 | + uses: useblacksmith/setup-docker-builder@ac083cc84672d01c60d5e8561d0a939b697de542 # v1 |
| 65 | + |
| 66 | + - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4 |
| 67 | + with: |
| 68 | + registry: ${{ env.REGISTRY }} |
| 69 | + username: ${{ github.actor }} |
| 70 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + |
| 72 | + - name: Build with registry cache |
| 73 | + uses: useblacksmith/build-push-action@cbd1f60d194a98cb3be5523b15134501eaf0fbf3 # v2 |
| 74 | + with: |
| 75 | + context: . |
| 76 | + file: links.Dockerfile |
| 77 | + push: false |
| 78 | + platforms: linux/amd64 |
| 79 | + tags: bench:registry-cache |
| 80 | + cache-from: type=registry,ref=${{ env.IMAGE_PREFIX }}-links:cache-bench |
| 81 | + cache-to: type=registry,ref=${{ env.IMAGE_PREFIX }}-links:cache-bench,mode=max |
0 commit comments