Skip to content

Commit 8fdd7cd

Browse files
committed
CI: Build the images on arm64 and x86_64
1 parent f76c9cf commit 8fdd7cd

File tree

2 files changed

+38
-10
lines changed

2 files changed

+38
-10
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,25 @@ jobs:
4444
strategy:
4545
fail-fast: false
4646
matrix:
47+
os:
48+
- ubuntu-latest
49+
- ubuntu-24.04-arm
50+
platform:
51+
- aarch64-linux-gnu
52+
- aarch64-linux-musl
53+
- aarch64-mingw-ucrt
54+
- arm-linux-gnu
55+
- arm-linux-musl
56+
- arm64-darwin
57+
- jruby
58+
- x64-mingw-ucrt
59+
- x64-mingw32
60+
- x86-linux-gnu
61+
- x86-linux-musl
62+
- x86-mingw32
63+
- x86_64-darwin
64+
- x86_64-linux-gnu
65+
- x86_64-linux-musl
4766
include:
4867
- platform: aarch64-linux-gnu
4968
alias: aarch64-linux
@@ -66,7 +85,7 @@ jobs:
6685
- platform: x86_64-linux-gnu
6786
alias: x86_64-linux
6887
- platform: x86_64-linux-musl
69-
runs-on: ubuntu-latest
88+
runs-on: ${{ matrix.os }}
7089
steps:
7190
- uses: actions/checkout@v4
7291
- uses: ruby/setup-ruby@v1
@@ -78,13 +97,21 @@ jobs:
7897
uses: actions/cache@v4
7998
with:
8099
path: tmp/build-cache
81-
key: ${{ runner.os }}-${{ matrix.platform }}-buildx-${{ github.sha }}
82-
restore-keys: ${{ runner.os }}-${{ matrix.platform }}-buildx
83-
- name: Build docker image
100+
key: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx-${{ github.sha }}
101+
restore-keys: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx
102+
- name: Change docker to a cache-able driver
84103
run: |
85104
docker buildx create --driver docker-container --use
105+
- name: Build docker image
106+
if: runner.arch == 'X64'
107+
run: |
86108
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"
87-
docker images
109+
- name: Build docker image
110+
if: runner.arch == 'ARM64'
111+
run: |
112+
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+
- name: Show docker images
114+
run: docker images
88115
- name: Update and prune docker buildx layer cache
89116
run: |
90117
rm -rf tmp/build-cache
@@ -101,6 +128,7 @@ jobs:
101128
bundle exec rake gem:${{ matrix.platform }}
102129
103130
- name: Upload native gem
131+
if: runner.arch == 'X64'
104132
uses: actions/upload-artifact@v4
105133
with:
106134
name: gem-${{ matrix.platform }}
@@ -116,7 +144,7 @@ jobs:
116144
bundle exec rake clean clobber
117145
bundle exec rake gem:${{ matrix.platform }}
118146
119-
- if: matrix.static
147+
- if: matrix.static && runner.arch == 'X64'
120148
name: Upload static native gem
121149
uses: actions/upload-artifact@v4
122150
with:
@@ -131,7 +159,7 @@ jobs:
131159
bundle exec rake clean clobber
132160
bundle exec rake gem:${{ matrix.alias }}
133161
134-
- if: matrix.alias
162+
- if: matrix.alias && runner.arch == 'X64'
135163
name: Upload native gem ${{ matrix.alias }}
136164
uses: actions/upload-artifact@v4
137165
with:

build/parallel_docker_build.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ def docker_build_cmd(platform=nil)
99
if platform
1010
cache_version = RakeCompilerDock::IMAGE_VERSION.split(".").take(2).join(".")
1111
cache = File.join("cache", cache_version, platform)
12-
"docker buildx build --cache-to=type=local,dest=#{cache},mode=max --cache-from=type=local,src=#{cache} --load"
12+
"docker buildx build --cache-to=type=local,dest=#{cache},mode=max --cache-from=type=local,src=#{cache} --progress=plain"
1313
else
1414
return nil
1515
end
1616
else
17-
ENV['RCD_DOCKER_BUILD'] || "docker buildx build"
17+
ENV['RCD_DOCKER_BUILD'] || "docker buildx build --progress=plain"
1818
end
1919
Shellwords.split(cmd)
2020
end
@@ -23,7 +23,7 @@ def docker_build_cmd(platform=nil)
2323
#
2424
# The layers will be reused in subsequent builds, even if they run in parallel.
2525
def docker_build(filename, tag: nil, output: false, platform: )
26-
cmd = docker_build_cmd
26+
cmd = docker_build_cmd(platform)
2727
return if cmd.nil?
2828
tag_args = ["-t", tag] if tag
2929
push_args = ["--push"] if output == 'push'

0 commit comments

Comments
 (0)