6
6
rubocop :
7
7
name : Lint (Rubocop)
8
8
runs-on : ubuntu-20.04
9
- container : ruby:2.3
9
+ container : ruby:2.6
10
10
steps :
11
11
- name : Checkout
12
12
uses : actions/checkout@v2
30
30
outputs :
31
31
GEM_VERSION : ${{ steps.set-metadata.outputs.GEM_VERSION }}
32
32
runs-on : ubuntu-20.04
33
- container : ruby:2.3
33
+ container : ruby:2.6
34
34
steps :
35
35
- name : Checkout
36
36
uses : actions/checkout@v2
@@ -39,15 +39,15 @@ jobs:
39
39
- name : Set metadata
40
40
id : set-metadata
41
41
run : |
42
- bundle exec ruby -e 'puts RUBY_PLATFORM' | tee ruby_platform
42
+ ./libexec/metadata ruby_platform | tee ruby_platform
43
43
echo "::set-output name=RUBY_PLATFORM::$(cat ruby_platform)"
44
- bundle exec ruby -e 'puts Gem.platforms.last.to_s' | tee gem_platform
44
+ ./libexec/metadata gem_platform | tee gem_platform
45
45
echo "::set-output name=GEM_PLATFORM::$(cat gem_platform)"
46
- bundle exec ruby -e 'puts Libv8::Node::VERSION' | tee gem_version
46
+ ./libexec/metadata gem_version | tee gem_version
47
47
echo "::set-output name=GEM_VERSION::$(cat gem_version)"
48
- bundle exec ruby -e 'puts Libv8::Node::NODE_VERSION' | tee node_version
48
+ ./libexec/metadata node_version | tee node_version
49
49
echo "::set-output name=NODE_VERSION::$(cat node_version)"
50
- bundle exec ruby -e 'puts Libv8::Node::LIBV8_VERSION' | tee libv8_version
50
+ ./libexec/metadata libv8_version | tee libv8_version
51
51
echo "::set-output name=LIBV8_VERSION::$(cat libv8_version)"
52
52
- name : Download Node.js
53
53
run : |
57
57
./libexec/extract-node ${{ steps.set-metadata.outputs.NODE_VERSION }}
58
58
- name : Validate V8 version
59
59
run : |
60
- ruby -e 'h = File.read("src/node-${{ steps.set- metadata.outputs.NODE_VERSION }}/deps/v8/include/v8-version.h"); eval h.each_line.with_object([]) { |l, e| l =~ /#define (V8_[A-Z_]+)\s(\d+)/ && e << "#{$1} = #{$2}" }.join(";"); puts "#{V8_MAJOR_VERSION}.#{V8_MINOR_VERSION}.#{V8_BUILD_NUMBER}.#{V8_PATCH_LEVEL}"' | tee libv8_version_h
60
+ ./libexec/ metadata libv8_version_h | tee libv8_version_h
61
61
diff libv8_version_h libv8_version
62
62
- name : Build gem
63
63
run : |
@@ -86,15 +86,15 @@ jobs:
86
86
- name : Set metadata
87
87
id : set-metadata
88
88
run : |
89
- bundle exec ruby -e 'puts RUBY_PLATFORM' | tee ruby_platform
89
+ ./libexec/metadata ruby_platform | tee ruby_platform
90
90
echo "::set-output name=RUBY_PLATFORM::$(cat ruby_platform)"
91
- bundle exec ruby -e 'puts Gem.platforms.last.to_s' | tee gem_platform
91
+ ./libexec/metadata gem_platform | tee gem_platform
92
92
echo "::set-output name=GEM_PLATFORM::$(cat gem_platform)"
93
- bundle exec ruby -e 'puts Libv8::Node::VERSION' | tee gem_version
93
+ ./libexec/metadata gem_version | tee gem_version
94
94
echo "::set-output name=GEM_VERSION::$(cat gem_version)"
95
- bundle exec ruby -e 'puts Libv8::Node::NODE_VERSION' | tee node_version
95
+ ./libexec/metadata node_version | tee node_version
96
96
echo "::set-output name=NODE_VERSION::$(cat node_version)"
97
- bundle exec ruby -e 'puts Libv8::Node::LIBV8_VERSION' | tee libv8_version
97
+ ./libexec/metadata libv8_version | tee libv8_version
98
98
echo "::set-output name=LIBV8_VERSION::$(cat libv8_version)"
99
99
- name : Download Node.js
100
100
run : |
@@ -104,7 +104,7 @@ jobs:
104
104
./libexec/extract-node ${{ steps.set-metadata.outputs.NODE_VERSION }}
105
105
- name : Validate V8 version
106
106
run : |
107
- ruby -e 'h = File.read("src/node-${{ steps.set- metadata.outputs.NODE_VERSION }}/deps/v8/include/v8-version.h"); eval h.each_line.with_object([]) { |l, e| l =~ /#define (V8_[A-Z_]+)\s(\d+)/ && e << "#{$1} = #{$2}" }.join(";"); puts "#{V8_MAJOR_VERSION}.#{V8_MINOR_VERSION}.#{V8_BUILD_NUMBER}.#{V8_PATCH_LEVEL}"' | tee libv8_version_h
107
+ ./libexec/ metadata libv8_version_h | tee libv8_version_h
108
108
diff libv8_version_h libv8_version
109
109
- name : Build V8
110
110
run : |
@@ -134,58 +134,94 @@ jobs:
134
134
matrix :
135
135
platform :
136
136
- amd64
137
- # arm64
137
+ - arm64
138
138
# arm
139
139
# ppc64le
140
140
# s390x
141
141
libc :
142
142
- gnu
143
- - musl
143
+ include :
144
+ - platform : amd64
145
+ libc : musl
144
146
name : Build (linux)
145
147
outputs :
146
148
GEM_VERSION : ${{ steps.set-metadata.outputs.GEM_VERSION }}
147
149
runs-on : ubuntu-20.04
148
150
steps :
149
- - name : Enable ${{ matrix.platform }} platform
150
- id : qemu
151
- if : ${{ matrix.platform != 'amd64' }}
151
+ - name : Set cross-compilation platform
152
+ id : platform
152
153
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)"
155
186
- name : Start container
156
187
id : container
157
188
run : |
158
189
case ${{ matrix.libc }} in
159
190
gnu)
160
- echo 'ruby:2.3 '
191
+ echo 'ruby:2.4 '
161
192
;;
162
193
musl)
163
194
echo 'ruby:2.4-alpine'
164
195
;;
165
- esac > container_image
196
+ esac | tee container_image
166
197
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
168
199
docker exec -w "${PWD}" $(cat container_id) uname -a
169
200
echo "::set-output name=id::$(cat container_id)"
170
201
- name : Install Alpine system dependencies
171
202
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 clang binutils-gold
203
+ run : docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apk add --no-cache build-base linux-headers bash python2 python3 git curl tar
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
173
209
- name : Checkout
174
210
uses : actions/checkout@v2
175
211
- name : Bundle
176
212
run : docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle install
177
213
- name : Set metadata
178
214
id : set-metadata
179
215
run : |
180
- docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec ruby -e 'puts RUBY_PLATFORM' | tee ruby_platform
216
+ docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ./libexec/metadata ruby_platform | tee ruby_platform
181
217
echo "::set-output name=RUBY_PLATFORM::$(cat ruby_platform)"
182
- docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec ruby -e 'puts Gem::Platform.local.tap { |p| RUBY_PLATFORM =~ /musl/ && p.version.nil? and p.instance_eval { @version = "musl" } }' | tee gem_platform
218
+ docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ./libexec/metadata gem_platform | tee gem_platform
183
219
echo "::set-output name=GEM_PLATFORM::$(cat gem_platform)"
184
- docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec ruby -e 'puts Libv8::Node::VERSION' | tee gem_version
220
+ docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ./libexec/metadata gem_version | tee gem_version
185
221
echo "::set-output name=GEM_VERSION::$(cat gem_version)"
186
- docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec ruby -e 'puts Libv8::Node::NODE_VERSION' | tee node_version
222
+ docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ./libexec/metadata node_version | tee node_version
187
223
echo "::set-output name=NODE_VERSION::$(cat node_version)"
188
- docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec ruby -e 'puts Libv8::Node::LIBV8_VERSION' | tee libv8_version
224
+ docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ./libexec/metadata libv8_version | tee libv8_version
189
225
echo "::set-output name=LIBV8_VERSION::$(cat libv8_version)"
190
226
- name : Download Node.js
191
227
run : |
@@ -195,7 +231,7 @@ jobs:
195
231
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ./libexec/extract-node ${{ steps.set-metadata.outputs.NODE_VERSION }}
196
232
- name : Validate V8 version
197
233
run : |
198
- docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ruby -e 'h = File.read("src/node-${{ steps.set- metadata.outputs.NODE_VERSION }}/deps/v8/include/v8-version.h"); eval h.each_line.with_object([]) { |l, e| l =~ /#define (V8_[A-Z_]+)\s(\d+)/ && e << "#{$1} = #{$2}" }.join(";"); puts "#{V8_MAJOR_VERSION}.#{V8_MINOR_VERSION}.#{V8_BUILD_NUMBER}.#{V8_PATCH_LEVEL}"' | tee libv8_version_h
234
+ docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ./libexec/ metadata libv8_version_h | tee libv8_version_h
199
235
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} diff libv8_version_h libv8_version
200
236
- name : Build V8
201
237
run : |
@@ -208,22 +244,22 @@ jobs:
208
244
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ./libexec/inject-libv8 ${{ steps.set-metadata.outputs.NODE_VERSION }}
209
245
- name : Build binary gem
210
246
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 }}]
212
248
- name : Upload V8
213
249
uses : actions/upload-artifact@v1
214
250
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 }}
216
252
path : vendor
217
253
- name : Upload gem
218
254
uses : actions/upload-artifact@v1
219
255
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 }}
221
257
path : pkg
222
258
test-ruby :
223
259
name : Test (ruby)
224
260
needs : build-ruby
225
261
runs-on : ubuntu-20.04
226
- container : ruby:2.3
262
+ container : ruby:2.5
227
263
steps :
228
264
- name : Set metadata
229
265
id : set-metadata
@@ -236,12 +272,12 @@ jobs:
236
272
name : gem-${{ needs.build-ruby.outputs.GEM_VERSION }}-ruby
237
273
path : pkg
238
274
- name : Install gem
239
- run : gem install pkg/libv8-node-${{ needs.build-ruby.outputs.GEM_VERSION }}.gem
275
+ run : gem install --verbose pkg/libv8-node-${{ needs.build-ruby.outputs.GEM_VERSION }}.gem
240
276
- name : Test with mini_racer
241
277
run : |
242
278
git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1
243
279
cd test/mini_racer
244
- git fetch origin refs/pull/186 /head
280
+ git fetch origin refs/pull/210 /head
245
281
git checkout FETCH_HEAD
246
282
git reset --hard
247
283
git clean -f -d -x
@@ -276,7 +312,7 @@ jobs:
276
312
run : |
277
313
git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1
278
314
cd test/mini_racer
279
- git fetch origin refs/pull/186 /head
315
+ git fetch origin refs/pull/210 /head
280
316
git checkout FETCH_HEAD
281
317
git reset --hard
282
318
git clean -f -d -x
@@ -288,6 +324,11 @@ jobs:
288
324
strategy :
289
325
fail-fast : false
290
326
matrix :
327
+ version :
328
+ - ' 2.5'
329
+ - ' 2.6'
330
+ - ' 2.7'
331
+ - ' 3.0'
291
332
platform :
292
333
- amd64
293
334
# arm64
@@ -297,6 +338,19 @@ jobs:
297
338
libc :
298
339
- gnu
299
340
- 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'
300
354
name : Test (linux)
301
355
needs : build-linux
302
356
runs-on : ubuntu-20.04
@@ -312,12 +366,12 @@ jobs:
312
366
run : |
313
367
case ${{ matrix.libc }} in
314
368
gnu)
315
- echo 'ruby:2.3 '
369
+ echo 'ruby:${{ matrix.version }} '
316
370
;;
317
371
musl)
318
- echo 'ruby:2.7 -alpine'
372
+ echo 'ruby:${{ matrix.version }} -alpine'
319
373
;;
320
- esac > container_image
374
+ esac | tee container_image
321
375
echo "::set-output name=image::$(cat container_image)"
322
376
docker run --rm -d -v "${PWD}":"${PWD}" -w "${PWD}" --platform linux/${{ matrix.platform }} $(cat container_image) /bin/sleep 64d | tee container_id
323
377
docker exec -w "${PWD}" $(cat container_id) uname -a
@@ -341,7 +395,7 @@ jobs:
341
395
run : |
342
396
git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1
343
397
cd test/mini_racer
344
- git fetch origin refs/pull/186 /head
398
+ git fetch origin refs/pull/210 /head
345
399
git checkout FETCH_HEAD
346
400
git reset --hard
347
401
git clean -f -d -x
0 commit comments