Skip to content

Commit 207a7bb

Browse files
committed
Use gha backend of docker cache for to speedup build
1 parent 5b9d345 commit 207a7bb

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

.github/workflows/ci.yml.erb

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,13 @@ jobs:
4040
ruby-version: "3.4"
4141
bundler-cache: true
4242

43-
- name: Fetch docker buildx layer cache
44-
uses: actions/cache@v4
45-
with:
46-
path: tmp/build-cache-${{ runner.arch }}
47-
key: ${{ runner.os }}-on-${{ runner.arch }}-<%= job %>-${{ github.sha }}
48-
restore-keys: |
49-
${{ runner.os }}-on-${{ runner.arch }}-<%= job %>
50-
${{ runner.os }}-on-${{ runner.arch }}-<%= need %>
51-
enableCrossOsArchive: true
43+
- name: Expose GitHub Runtime for docker cache
44+
uses: crazy-max/ghaction-github-runtime@v3
5245
- name: Build the image layers <%= job %> on ${{ runner.arch }}
5346
run: |
5447
# Change docker to a cache-able driver
5548
docker buildx create --driver docker-container --use
56-
bundle exec rake build:<%= job %> RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new"
57-
- name: Update and prune docker buildx layer cache
58-
run: |
59-
rm -rf tmp/build-cache-${{ runner.arch }}
60-
mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }}
49+
bundle exec rake build:<%= job %> RCD_DOCKER_BUILD="docker buildx build --cache-from type=gha,scope=${{ runner.os }}-on-${{ runner.arch }}-<%= job %> --cache-from type=gha,scope=${{ runner.os }}-on-${{ runner.arch }}-<%= need %> --cache-to=type=gha,scope=${{ runner.os }}-on-${{ runner.arch }}-<%= job %>"
6150
<% end %>
6251

6352
build_source_gem:
@@ -137,17 +126,12 @@ jobs:
137126
ruby-version: "3.3"
138127
bundler-cache: true
139128

140-
- name: Fetch docker buildx layer cache
141-
uses: actions/cache@v4
142-
with:
143-
path: tmp/build-cache-${{ runner.arch }}
144-
key: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-${{ github.sha }}
145-
restore-keys: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}
146-
enableCrossOsArchive: true
129+
- name: Expose GitHub Runtime for docker cache
130+
uses: crazy-max/ghaction-github-runtime@v3
147131
- name: Build the image from already filled cache
148132
run: |
149133
docker buildx create --driver docker-container --use
150-
bundle exec rake build:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }}"
134+
bundle exec rake build:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from type=gha,scope=${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}"
151135
- name: Show docker images
152136
run: docker images
153137

0 commit comments

Comments
 (0)