Skip to content

Commit df65ec5

Browse files
committed
Add the build job before the pushlish job
To make sure the cache is current. The path must be the same between storing to cache and restoring from it.
1 parent b5e13c6 commit df65ec5

File tree

2 files changed

+64
-5
lines changed

2 files changed

+64
-5
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
- name: Fetch docker buildx layer cache
9797
uses: actions/cache@v4
9898
with:
99-
path: tmp/build-cache
99+
path: tmp/build-cache-${{ runner.arch }}
100100
key: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx-${{ github.sha }}
101101
restore-keys: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx
102102
enableCrossOsArchive: true
@@ -106,17 +106,17 @@ jobs:
106106
- name: Build docker image
107107
if: runner.arch == 'X64'
108108
run: |
109-
bundle exec rake build:x86:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new"
109+
bundle exec rake build:x86:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,dest=tmp/build-cache-new"
110110
- name: Build docker image
111111
if: runner.arch == 'ARM64'
112112
run: |
113-
bundle exec rake build:arm:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new"
113+
bundle exec rake build:arm:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,dest=tmp/build-cache-new"
114114
- name: Show docker images
115115
run: docker images
116116
- name: Update and prune docker buildx layer cache
117117
run: |
118-
rm -rf tmp/build-cache
119-
mv tmp/build-cache-new tmp/build-cache
118+
rm -rf tmp/build-cache-${{ runner.arch }}
119+
mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }}
120120
121121
- name: Test the generated image
122122
run: bundle exec rake test TEST_PLATFORM=${{ matrix.platform }}

.github/workflows/publish-images.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,65 @@ on:
99

1010
jobs:
1111
build:
12+
name: build native
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os:
17+
- ubuntu-latest
18+
- ubuntu-24.04-arm
19+
platform:
20+
- aarch64-linux-gnu
21+
- aarch64-linux-musl
22+
- aarch64-mingw-ucrt
23+
- arm-linux-gnu
24+
- arm-linux-musl
25+
- arm64-darwin
26+
- jruby
27+
- x64-mingw-ucrt
28+
- x64-mingw32
29+
- x86-linux-gnu
30+
- x86-linux-musl
31+
- x86-mingw32
32+
- x86_64-darwin
33+
- x86_64-linux-gnu
34+
- x86_64-linux-musl
35+
runs-on: ${{ matrix.os }}
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: ruby/setup-ruby@v1
39+
with:
40+
ruby-version: "3.3"
41+
bundler-cache: true
42+
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 }}-${{ matrix.platform }}-buildx-${{ github.sha }}
48+
restore-keys: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx
49+
enableCrossOsArchive: true
50+
- name: Change docker to a cache-able driver
51+
run: |
52+
docker buildx create --driver docker-container --use
53+
- name: Build docker image
54+
if: runner.arch == 'X64'
55+
run: |
56+
bundle exec rake build:x86:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,dest=tmp/build-cache-new"
57+
- name: Build docker image
58+
if: runner.arch == 'ARM64'
59+
run: |
60+
bundle exec rake build:arm:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,dest=tmp/build-cache-new"
61+
- name: Show docker images
62+
run: docker images
63+
- name: Update and prune docker buildx layer cache
64+
run: |
65+
rm -rf tmp/build-cache-${{ runner.arch }}
66+
mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }}
67+
68+
push:
69+
name: push
70+
needs: build
1271
strategy:
1372
fail-fast: false
1473
matrix:

0 commit comments

Comments
 (0)