Skip to content

Commit 4e5ffd4

Browse files
committed
Test gem artifacts
- attempt gem installation - attempt build and test against mini_racer
1 parent 6fa6682 commit 4e5ffd4

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed

.github/workflows/build.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
run: shellcheck libexec/*
2828
build-ruby:
2929
name: Build (ruby)
30+
outputs:
31+
GEM_VERSION: ${{ steps.set-metadata.outputs.GEM_VERSION }}
3032
runs-on: ubuntu-20.04
3133
container: ruby:2.3
3234
steps:
@@ -73,6 +75,8 @@ jobs:
7375
- x86_64
7476
# arm64
7577
name: Build (darwin)
78+
outputs:
79+
GEM_VERSION: ${{ steps.set-metadata.outputs.GEM_VERSION }}
7680
runs-on: macos-10.15
7781
steps:
7882
- name: Checkout
@@ -138,6 +142,8 @@ jobs:
138142
- gnu
139143
- musl
140144
name: Build (linux)
145+
outputs:
146+
GEM_VERSION: ${{ steps.set-metadata.outputs.GEM_VERSION }}
141147
runs-on: ubuntu-20.04
142148
steps:
143149
- name: Enable ${{ matrix.platform }} platform
@@ -213,3 +219,124 @@ jobs:
213219
with:
214220
name: gem-${{ steps.set-metadata.outputs.GEM_VERSION }}-${{ steps.set-metadata.outputs.GEM_PLATFORM }}
215221
path: pkg
222+
test-ruby:
223+
name: Test (ruby)
224+
needs: build-ruby
225+
runs-on: ubuntu-20.04
226+
container: ruby:2.3
227+
steps:
228+
- name: Set metadata
229+
id: set-metadata
230+
run: |
231+
ruby -e 'puts Gem.platforms.last.to_s' | tee gem_platform
232+
echo "::set-output name=GEM_PLATFORM::$(cat gem_platform)"
233+
- name: Download a single artifact
234+
uses: actions/download-artifact@v2
235+
with:
236+
name: gem-${{ needs.build-ruby.outputs.GEM_VERSION }}-ruby
237+
path: pkg
238+
- name: Install gem
239+
run: gem install pkg/libv8-node-*.gem
240+
- name: Test with mini_racer
241+
run: |
242+
git clone https://github.com/rubyjs/mini_racer.git --depth 1
243+
cd mini_racer
244+
git fetch origin pull/186/head
245+
git checkout FETCH_HEAD
246+
bundle install
247+
bundle exec rake compile
248+
bundle exec rake test
249+
test-darwin:
250+
strategy:
251+
fail-fast: false
252+
matrix:
253+
platform:
254+
- x86_64
255+
# arm64
256+
name: Test (darwin)
257+
needs: build-darwin
258+
runs-on: macos-10.15
259+
steps:
260+
- name: Set metadata
261+
id: set-metadata
262+
run: |
263+
ruby -e 'puts Gem.platforms.last.to_s' | tee gem_platform
264+
echo "::set-output name=GEM_PLATFORM::$(cat gem_platform)"
265+
- name: Download a single artifact
266+
uses: actions/download-artifact@v2
267+
with:
268+
name: gem-${{ needs.build-darwin.outputs.GEM_VERSION }}-${{ steps.set-metadata.outputs.GEM_PLATFORM }}
269+
path: pkg
270+
- name: Install gem
271+
run: gem install pkg/libv8-node-*.gem
272+
- name: Test with mini_racer
273+
run: |
274+
git clone https://github.com/rubyjs/mini_racer.git --depth 1
275+
cd mini_racer
276+
git fetch origin pull/186/head
277+
git checkout FETCH_HEAD
278+
bundle install
279+
bundle exec rake compile
280+
bundle exec rake test
281+
test-linux:
282+
strategy:
283+
fail-fast: false
284+
matrix:
285+
platform:
286+
- amd64
287+
# arm64
288+
# arm
289+
# ppc64le
290+
# s390x
291+
libc:
292+
- gnu
293+
- musl
294+
name: Test (linux)
295+
needs: build-linux
296+
runs-on: ubuntu-20.04
297+
steps:
298+
- name: Enable ${{ matrix.platform }} platform
299+
id: qemu
300+
if: ${{ matrix.platform != 'amd64' }}
301+
run: |
302+
docker run --privileged --rm tonistiigi/binfmt:latest --install ${{ matrix.platform }} | tee platforms.json
303+
echo "::set-output name=platforms::$(cat platforms.json)"
304+
- name: Start container
305+
id: container
306+
run: |
307+
case ${{ matrix.libc }} in
308+
gnu)
309+
echo 'ruby:2.3'
310+
;;
311+
musl)
312+
echo 'ruby:2.3-alpine'
313+
;;
314+
esac > container_image
315+
echo "::set-output name=image::$(cat container_image)"
316+
docker run --rm -d -v "${PWD}":"${PWD}" -w "${PWD}" --platform linux/${{ matrix.platform }} $(cat container_image) /bin/sleep 64d | tee container_id
317+
docker exec -w "${PWD}" $(cat container_id) uname -a
318+
echo "::set-output name=id::$(cat container_id)"
319+
- name: Install Alpine system dependencies
320+
if: ${{ matrix.libc == 'musl' }}
321+
run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apk add --no-cache build-base git
322+
- name: Set metadata
323+
id: set-metadata
324+
run: |
325+
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ruby -e 'puts Gem.platforms.last.to_s' | tee gem_platform
326+
echo "::set-output name=GEM_PLATFORM::$(cat gem_platform)"
327+
- name: Download a single artifact
328+
uses: actions/download-artifact@v2
329+
with:
330+
name: gem-${{ needs.build-linux.outputs.GEM_VERSION }}-${{ steps.set-metadata.outputs.GEM_PLATFORM }}
331+
path: pkg
332+
- name: Install gem
333+
run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} gem install pkg/libv8-node-*.gem
334+
- name: Test with mini_racer
335+
run: |
336+
git clone https://github.com/rubyjs/mini_racer.git --depth 1
337+
cd mini_racer
338+
git fetch origin pull/186/head
339+
git checkout FETCH_HEAD
340+
docker exec -w "${PWD}/mini_racer" ${{ steps.container.outputs.id }} bundle install
341+
docker exec -w "${PWD}/mini_racer" ${{ steps.container.outputs.id }} bundle exec rake compile
342+
docker exec -w "${PWD}/mini_racer" ${{ steps.container.outputs.id }} bundle exec rake test

0 commit comments

Comments
 (0)