@@ -134,42 +134,78 @@ jobs:
134134 matrix :
135135 platform :
136136 - amd64
137- # arm64
137+ - arm64
138138 # arm
139139 # ppc64le
140140 # s390x
141141 libc :
142142 - gnu
143- - musl
143+ include :
144+ - platform : amd64
145+ libc : musl
144146 name : Build (linux)
145147 outputs :
146148 GEM_VERSION : ${{ steps.set-metadata.outputs.GEM_VERSION }}
147149 runs-on : ubuntu-20.04
148150 steps :
149- - name : Enable ${{ matrix.platform }} platform
150- id : qemu
151- if : ${{ matrix.platform != 'amd64' }}
151+ - name : Set cross-compilation platform
152+ id : platform
152153 run : |
153- docker run --privileged --rm tonistiigi/binfmt:latest --install ${{ matrix.platform }} | tee platforms.json
154- echo "::set-output name=platforms::$(cat platforms.json)"
154+ case ${{ matrix.platform }} in
155+ amd64)
156+ case ${{ matrix.libc }} in
157+ gnu)
158+ echo 'x86_64-linux-gnu'
159+ ;;
160+ musl)
161+ echo 'x86_64-alpine-linux-musl'
162+ ;;
163+ esac
164+ ;;
165+ arm64)
166+ echo 'aarch64-linux-gnu'
167+ ;;
168+ esac | tee target_platform
169+ case ${{ matrix.platform }} in
170+ amd64)
171+ case ${{ matrix.libc }} in
172+ gnu)
173+ echo 'x86_64-linux'
174+ ;;
175+ musl)
176+ echo 'x86_64-linux-musl'
177+ ;;
178+ esac
179+ ;;
180+ arm64)
181+ echo 'aarch64-linux'
182+ ;;
183+ esac | tee ruby_target_platform
184+ echo "::set-output name=target_platform::$(cat target_platform)"
185+ echo "::set-output name=ruby_target_platform::$(cat ruby_target_platform)"
155186 - name : Start container
156187 id : container
157188 run : |
158189 case ${{ matrix.libc }} in
159190 gnu)
160- echo 'ruby:2.4 '
191+ echo 'ruby:3.0 '
161192 ;;
162193 musl)
163- echo 'ruby:2.4 -alpine'
194+ echo 'ruby:3.0 -alpine'
164195 ;;
165- esac > container_image
196+ esac | tee container_image
166197 echo "::set-output name=image::$(cat container_image)"
167- docker run --rm -d -v "${PWD}":"${PWD}" -w "${PWD}" --platform linux/${{ matrix .platform }} $(cat container_image) /bin/sleep 64d | tee container_id
198+ docker run --rm -d -v "${PWD}":"${PWD}" -w "${PWD}" --platform linux/amd64 -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
168199 docker exec -w "${PWD}" $(cat container_id) uname -a
169200 echo "::set-output name=id::$(cat container_id)"
170201 - name : Install Alpine system dependencies
171202 if : ${{ matrix.libc == 'musl' }}
172- run : docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apk add --no-cache build-base linux-headers bash python2 python3 git curl tar
203+ run : docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apk add --no-cache build-base linux-headers bash python2 python3 git curl tar clang
204+ - name : Install Debian cross-compiler
205+ if : ${{ matrix.libc == 'gnu' && matrix.platform != 'amd64' }}
206+ run : |
207+ docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apt-get update
208+ docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apt-get install -y binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
173209 - name : Checkout
174210 uses : actions/checkout@v2
175211 - name : Bundle
@@ -208,22 +244,22 @@ jobs:
208244 docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ./libexec/inject-libv8 ${{ steps.set-metadata.outputs.NODE_VERSION }}
209245 - name : Build binary gem
210246 run : |
211- docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec rake binary
247+ docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec rake binary[${{ steps.platform.outputs.ruby_target_platform }}]
212248 - name : Upload V8
213249 uses : actions/upload-artifact@v1
214250 with :
215- name : v8-${{ steps.set-metadata.outputs.LIBV8_VERSION }}-${{ steps.set-metadata .outputs.GEM_PLATFORM }}
251+ name : v8-${{ steps.set-metadata.outputs.LIBV8_VERSION }}-${{ steps.platform .outputs.ruby_target_platform }}
216252 path : vendor
217253 - name : Upload gem
218254 uses : actions/upload-artifact@v1
219255 with :
220- name : gem-${{ steps.set-metadata.outputs.GEM_VERSION }}-${{ steps.set-metadata .outputs.GEM_PLATFORM }}
256+ name : gem-${{ steps.set-metadata.outputs.GEM_VERSION }}-${{ steps.platform .outputs.ruby_target_platform }}
221257 path : pkg
222258 test-ruby :
223259 name : Test (ruby)
224260 needs : build-ruby
225261 runs-on : ubuntu-20.04
226- container : ruby:2.4
262+ container : ruby:2.5
227263 steps :
228264 - name : Set metadata
229265 id : set-metadata
@@ -241,7 +277,7 @@ jobs:
241277 run : |
242278 git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1
243279 cd test/mini_racer
244- git fetch origin refs/pull/186 /head
280+ git fetch origin refs/pull/210 /head
245281 git checkout FETCH_HEAD
246282 git reset --hard
247283 git clean -f -d -x
@@ -276,7 +312,7 @@ jobs:
276312 run : |
277313 git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1
278314 cd test/mini_racer
279- git fetch origin refs/pull/186 /head
315+ git fetch origin refs/pull/210 /head
280316 git checkout FETCH_HEAD
281317 git reset --hard
282318 git clean -f -d -x
@@ -289,7 +325,6 @@ jobs:
289325 fail-fast : false
290326 matrix :
291327 version :
292- - ' 2.4'
293328 - ' 2.5'
294329 - ' 2.6'
295330 - ' 2.7'
@@ -303,6 +338,19 @@ jobs:
303338 libc :
304339 - gnu
305340 - musl
341+ include :
342+ - version : ' 2.5'
343+ platform : ' arm64'
344+ libc : ' gnu'
345+ - version : ' 2.6'
346+ platform : ' arm64'
347+ libc : ' gnu'
348+ - version : ' 2.7'
349+ platform : ' arm64'
350+ libc : ' gnu'
351+ - version : ' 3.0'
352+ platform : ' arm64'
353+ libc : ' gnu'
306354 name : Test (linux)
307355 needs : build-linux
308356 runs-on : ubuntu-20.04
@@ -323,7 +371,7 @@ jobs:
323371 musl)
324372 echo 'ruby:${{ matrix.version }}-alpine'
325373 ;;
326- esac > container_image
374+ esac | tee container_image
327375 echo "::set-output name=image::$(cat container_image)"
328376 docker run --rm -d -v "${PWD}":"${PWD}" -w "${PWD}" --platform linux/${{ matrix.platform }} $(cat container_image) /bin/sleep 64d | tee container_id
329377 docker exec -w "${PWD}" $(cat container_id) uname -a
@@ -347,7 +395,7 @@ jobs:
347395 run : |
348396 git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1
349397 cd test/mini_racer
350- git fetch origin refs/pull/186 /head
398+ git fetch origin refs/pull/210 /head
351399 git checkout FETCH_HEAD
352400 git reset --hard
353401 git clean -f -d -x
0 commit comments