Skip to content

Commit a37418a

Browse files
committed
use native runner for arm
1 parent f109c09 commit a37418a

File tree

1 file changed

+20
-28
lines changed

1 file changed

+20
-28
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,15 @@ jobs:
158158
libc:
159159
- gnu
160160
- musl
161+
include:
162+
- platform: amd64
163+
runner: ubuntu-24.04
164+
- platform: arm64
165+
runner: ubuntu-24.04-arm
161166
name: Build (linux) (${{ matrix.platform }}, ${{ matrix.libc }})
162167
outputs:
163168
GEM_VERSION: ${{ steps.set-metadata.outputs.GEM_VERSION }}
164-
runs-on: ubuntu-24.04
169+
runs-on: ${{ matrix.runner }}
165170
steps:
166171
- name: Set cross-compilation platform
167172
id: platform
@@ -212,10 +217,6 @@ jobs:
212217
esac | tee ruby_target_platform
213218
echo "target_platform=$(cat target_platform)" >> $GITHUB_OUTPUT
214219
echo "ruby_target_platform=$(cat ruby_target_platform)" >> $GITHUB_OUTPUT
215-
- name: Enable ${{ matrix.platform }} platform
216-
if: ${{ matrix.platform != 'amd64' && matrix.libc == 'musl' }}
217-
run: |
218-
docker run --privileged --rm tonistiigi/binfmt:latest --install ${{ matrix.platform }}
219220
- name: Start container
220221
id: container
221222
run: |
@@ -229,13 +230,8 @@ jobs:
229230
esac | tee container_image
230231
echo "image=$(cat container_image)" >> $GITHUB_OUTPUT
231232
232-
# use native platform for musl builds (via QEMU if needed)
233-
# use amd64 for gnu builds (cross-compilation is faster)
234-
if [ "${{ matrix.libc }}" = "musl" ]; then
235-
platform="linux/${{ matrix.platform }}"
236-
else
237-
platform="linux/amd64"
238-
fi
233+
# use native platform
234+
platform="linux/${{ matrix.platform }}"
239235
240236
docker run --rm -d -v "${PWD}":"${PWD}" -w "${PWD}" --platform "${platform}" -e RUBY_TARGET_PLATFORM=${{ steps.platform.outputs.ruby_target_platform }} -e TARGET_PLATFORM=${{ steps.platform.outputs.target_platform }} $(cat container_image) /bin/sleep 64d | tee container_id
241237
docker exec -w "${PWD}" $(cat container_id) uname -a
@@ -248,14 +244,6 @@ jobs:
248244
run: |
249245
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apt-get update
250246
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apt-get install -y cmake clang ccache
251-
- name: Install Debian cross-compiler
252-
if: ${{ matrix.libc == 'gnu' && matrix.platform != 'amd64' }}
253-
run: |
254-
case ${{ matrix.platform }} in
255-
arm64)
256-
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apt-get install -y binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
257-
;;
258-
esac
259247
- name: Update Rubygems and Bundler
260248
run: |
261249
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} gem update --system
@@ -297,7 +285,6 @@ jobs:
297285
run: |
298286
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ./libexec/inject-libv8 ${{ steps.set-metadata.outputs.NODE_VERSION }}
299287
- name: Test V8 in C++
300-
if: ${{ matrix.platform == 'amd64' || matrix.libc == 'musl' }}
301288
run: |
302289
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bash -c "cd test/gtest && cmake -S . -B build && cd build && cmake --build . && ctest"
303290
- name: Build binary gem
@@ -319,7 +306,7 @@ jobs:
319306
matrix:
320307
platform:
321308
- amd64
322-
# other platforms would need emulation, which is way too slow
309+
- arm64
323310
container:
324311
- image: ruby:3.2
325312
version: '3.2'
@@ -342,9 +329,14 @@ jobs:
342329
- image: ruby:3.4-alpine
343330
version: '3.4'
344331
libc: musl
332+
include:
333+
- platform: amd64
334+
runner: ubuntu-24.04
335+
- platform: arm64
336+
runner: ubuntu-24.04-arm
345337
name: Test (ruby) (${{ matrix.container.version }}, ${{ matrix.platform }}, ${{ matrix.container.libc }})
346338
needs: build-ruby
347-
runs-on: ubuntu-24.04
339+
runs-on: ${{ matrix.runner }}
348340
container: ${{ matrix.container.image }}
349341
steps:
350342
- name: Install Alpine system dependencies
@@ -428,6 +420,10 @@ jobs:
428420
- gnu
429421
- musl
430422
include:
423+
- platform: amd64
424+
runner: ubuntu-24.04
425+
- platform: arm64
426+
runner: ubuntu-24.04-arm
431427
- version: '3.2'
432428
platform: 'arm64'
433429
libc: 'gnu'
@@ -442,12 +438,8 @@ jobs:
442438
libc: 'musl'
443439
name: Test (linux) (${{ matrix.platform }}, ${{ matrix.libc }}, ruby ${{ matrix.version }})
444440
needs: build-linux
445-
runs-on: ubuntu-24.04
441+
runs-on: ${{ matrix.runner }}
446442
steps:
447-
- name: Enable ${{ matrix.platform }} platform
448-
if: ${{ matrix.platform != 'amd64' }}
449-
run: |
450-
docker run --privileged --rm tonistiigi/binfmt:latest --install ${{ matrix.platform }}
451443
- name: Start container
452444
id: container
453445
run: |

0 commit comments

Comments
 (0)