sq_mini_racer 0.2.4.sqreen2 → 0.3.1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.dockerignore +12 -0
- data/.gitignore +9 -0
- data/CHANGELOG +88 -0
- data/Dockerfile +22 -0
- data/README.md +42 -2
- data/Rakefile +66 -43
- data/azure-pipelines.yml +69 -0
- data/azure-template.yml +101 -0
- data/ext/mini_racer_extension/extconf.rb +212 -92
- data/ext/mini_racer_extension/mini_racer_extension.cc +483 -155
- data/ext/mini_racer_loader/extconf.rb +8 -0
- data/ext/{prv_ext_loader/prv_ext_loader.c → mini_racer_loader/mini_racer_loader.c} +24 -5
- data/lib/sq_mini_racer.rb +3 -0
- data/lib/sqreen/mini_racer.rb +112 -24
- data/lib/sqreen/mini_racer/version.rb +3 -3
- data/mini_racer.gemspec +16 -8
- data/valgrind.supp +74 -0
- metadata +62 -20
- data/.travis.yml +0 -73
- data/ext/prv_ext_loader/extconf.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5a4f1dcba4f3dd9929c02a63a4ca5e123626c670aec78dd1bd99e045b4406ef
|
4
|
+
data.tar.gz: 162ccdbc01829df6b722e885d6242c17764373b66d5610287a7604d6dcf9dbc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3182e0f36469dbc4a2d5a254c879f7bfb51d1dd2abe903284cb9aefaecc8743fdd16408dec1ae58ab61e90b1e19c61152dbc80ed4d9c92f550684469c80e2b9
|
7
|
+
data.tar.gz: ab44723c482430200ffc20a127cc27672020de03a22e1edd84a42212166742dbe006173951bd345a0f76437ab6186cb5078faa7de2b5d6d41d27df8a0c2f3109
|
data/.dockerignore
ADDED
data/.gitignore
CHANGED
@@ -11,3 +11,12 @@ lib/*.so
|
|
11
11
|
/lib/sq_mini_racer/
|
12
12
|
/ext/mini_racer_extension/mini_racer.creator.*
|
13
13
|
*.bundle
|
14
|
+
/mini_racer.config
|
15
|
+
/mini_racer.creator
|
16
|
+
/mini_racer.creator.user
|
17
|
+
/mini_racer.files
|
18
|
+
/mini_racer.includes
|
19
|
+
/compile_commands.json
|
20
|
+
/.vscode/
|
21
|
+
/.clangd/
|
22
|
+
/.idea/
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,91 @@
|
|
1
|
+
- Unreleased
|
2
|
+
|
3
|
+
- FIX: on downgrade mkmf was picking the wrong version of libv8, this fix will correct future issues
|
4
|
+
|
5
|
+
- 23-07-2020
|
6
|
+
|
7
|
+
- 0.3.1
|
8
|
+
|
9
|
+
- FIX: specify that libv8 must be larger than 8.4.255 but smaller than 8.5, this avoids issues going forward
|
10
|
+
|
11
|
+
- 22-07-2020
|
12
|
+
|
13
|
+
- 0.3.0
|
14
|
+
|
15
|
+
- FEATURE: upgraded to libv8 version 8.4.255.0
|
16
|
+
|
17
|
+
- 29-06-2020
|
18
|
+
|
19
|
+
- 0.2.15
|
20
|
+
|
21
|
+
- FEATURE: basic wasm support via pump_message_loop
|
22
|
+
|
23
|
+
- 15-05-2020
|
24
|
+
|
25
|
+
- 0.2.14
|
26
|
+
|
27
|
+
- FIX: ensure_gc_after_idle should take in milliseconds like the rest of the APIs not seconds
|
28
|
+
- FEATURE: strict params on MiniRacer::Context.new
|
29
|
+
|
30
|
+
- 15-05-2020
|
31
|
+
|
32
|
+
- 0.2.13
|
33
|
+
|
34
|
+
- FIX: edge case around ensure_gc_after_idle possibly firing when context is not idle
|
35
|
+
|
36
|
+
- 15-05-2020
|
37
|
+
|
38
|
+
- 0.2.12
|
39
|
+
|
40
|
+
- FEATURE: isolate.low_memory_notification which can force a full GC
|
41
|
+
- FEATURE: MiniRacer::Context.new(ensure_gc_after_idle: 2) - to force full GC 2 seconds after context is idle, this allows you to conserve memory on isolates
|
42
|
+
|
43
|
+
- 14-05-2020
|
44
|
+
|
45
|
+
- 0.2.11
|
46
|
+
|
47
|
+
- FIX: dumping heap snapshots was not flushing the file leading to corrupt snapshots
|
48
|
+
- FIX: a use-after-free shutdown crash
|
49
|
+
|
50
|
+
- 0.2.10
|
51
|
+
|
52
|
+
- 22-04-2020
|
53
|
+
|
54
|
+
- FEATURE: memory softlimit support for nogvl_context_call
|
55
|
+
|
56
|
+
- 0.2.9
|
57
|
+
|
58
|
+
- 09-01-2020
|
59
|
+
|
60
|
+
- FIX: correct segfault when JS returns a Symbol and properly cast to ruby symbol
|
61
|
+
|
62
|
+
- 0.2.8
|
63
|
+
|
64
|
+
- 11-11-2019
|
65
|
+
|
66
|
+
- FIX: ensure thread live cycle is properly accounter for following file descriptor fix
|
67
|
+
|
68
|
+
- 0.2.7
|
69
|
+
|
70
|
+
- 11-11-2019
|
71
|
+
|
72
|
+
- FIX: release the file descriptor for timeout pipe earlier (this avoids holding too many files open in Ruby 2.7)
|
73
|
+
|
74
|
+
- 14-05-2019
|
75
|
+
|
76
|
+
- 0.2.6
|
77
|
+
|
78
|
+
- FEATURE: add support for write_heap_snapshot which helps you analyze memory
|
79
|
+
|
80
|
+
- 25-04-2019
|
81
|
+
|
82
|
+
- 0.2.5
|
83
|
+
|
84
|
+
- FIX: Compatiblity fixes for V8 7 and above @ignisf
|
85
|
+
- FIX: Memory leak in gc_callback @messense
|
86
|
+
- IMPROVEMENT: Added example of sourcemap support @ianks
|
87
|
+
- URGENT: you will need this release for latest version of libv8 to work
|
88
|
+
|
1
89
|
- 02-11-2018
|
2
90
|
|
3
91
|
- 0.2.4
|
data/Dockerfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
ARG RUBY_VERSION=2.7
|
2
|
+
FROM ruby:${RUBY_VERSION}
|
3
|
+
|
4
|
+
RUN test ! -f /etc/alpine-release || apk add --no-cache build-base git
|
5
|
+
|
6
|
+
# without this `COPY .git`, we get the following error:
|
7
|
+
# fatal: not a git repository (or any of the parent directories): .git
|
8
|
+
# but with it we need the full gem just to compile the extension because
|
9
|
+
# of gemspec's `git --ls-files`
|
10
|
+
# COPY .git /code/.git
|
11
|
+
|
12
|
+
COPY Gemfile mini_racer.gemspec /code/
|
13
|
+
COPY lib/sqreen/mini_racer/version.rb /code/lib/sqreen/mini_racer/version.rb
|
14
|
+
WORKDIR /code
|
15
|
+
RUN bundle install
|
16
|
+
|
17
|
+
COPY Rakefile /code/
|
18
|
+
COPY ext /code/ext/
|
19
|
+
RUN bundle exec rake compile
|
20
|
+
|
21
|
+
COPY . /code/
|
22
|
+
CMD bundle exec irb -rmini_racer
|
data/README.md
CHANGED
@@ -101,6 +101,27 @@ context.eval('bar()', filename: 'a/bar.js')
|
|
101
101
|
|
102
102
|
```
|
103
103
|
|
104
|
+
### Fork safety
|
105
|
+
|
106
|
+
Some Ruby web servers employ forking (for example unicorn or puma in clustered mode). V8 is not fork safe.
|
107
|
+
Sadly Ruby does not have support for fork notifications per [#5446](https://bugs.ruby-lang.org/issues/5446).
|
108
|
+
|
109
|
+
If you want to ensure your application does not leak memory after fork either:
|
110
|
+
|
111
|
+
1. Ensure no MiniRacer::Context objects are created in the master process
|
112
|
+
|
113
|
+
Or
|
114
|
+
|
115
|
+
2. Dispose manually of all MiniRacer::Context objects prior to forking
|
116
|
+
|
117
|
+
```ruby
|
118
|
+
# before fork
|
119
|
+
|
120
|
+
require 'objspace'
|
121
|
+
ObjectSpace.each_object(MiniRacer::Context){|c| c.dispose}
|
122
|
+
|
123
|
+
# fork here
|
124
|
+
```
|
104
125
|
|
105
126
|
### Threadsafe
|
106
127
|
|
@@ -213,12 +234,17 @@ context = MiniRacer::Context.new(isolate: isolate)
|
|
213
234
|
# give up to 100ms for V8 garbage collection
|
214
235
|
isolate.idle_notification(100)
|
215
236
|
|
237
|
+
# force V8 to perform a full GC
|
238
|
+
isolate.low_memory_notification
|
239
|
+
|
216
240
|
```
|
217
241
|
|
218
242
|
This can come in handy to force V8 GC runs for example in between requests if you use MiniRacer on a web application.
|
219
243
|
|
220
244
|
Note that this method maps directly to [`v8::Isolate::IdleNotification`](http://bespin.cz/~ondras/html/classv8_1_1Isolate.html#aea16cbb2e351de9a3ae7be2b7cb48297), and that in particular its return value is the same (true if there is no further garbage to collect, false otherwise) and the same caveats apply, in particular that `there is no guarantee that the [call will return] within the time limit.`
|
221
245
|
|
246
|
+
Additionally you may automate this process on a context by defining it with `MiniRacer::Content.new(ensure_gc_after_idle: 1000)`. Using this will ensure V8 will run a full GC using `context.isolate.low_memory_notification` 1 second after the last eval on the context. Low memory notification is both slower and more aggressive than an idle_notification and will ensure long living isolates use minimal amounts of memory.
|
247
|
+
|
222
248
|
### V8 Runtime flags
|
223
249
|
|
224
250
|
It is possible to set V8 Runtime flags:
|
@@ -256,7 +282,7 @@ context.eval js
|
|
256
282
|
The same code without the harmony runtime flag results in a `MiniRacer::RuntimeError: RangeError: Maximum call stack size exceeded` exception.
|
257
283
|
Please refer to http://node.green/ as a reference on other harmony features.
|
258
284
|
|
259
|
-
A list of all V8 runtime flags can be found using `node --v8-options`, or else by perusing [the V8 source code for flags (make sure to use the right version of V8)](https://github.com/v8/v8/blob/master/src/flag-definitions.h).
|
285
|
+
A list of all V8 runtime flags can be found using `node --v8-options`, or else by perusing [the V8 source code for flags (make sure to use the right version of V8)](https://github.com/v8/v8/blob/master/src/flags/flag-definitions.h).
|
260
286
|
|
261
287
|
Note that runtime flags must be set before any other operation (e.g. creating a context, a snapshot or an isolate), otherwise an exception will be thrown.
|
262
288
|
|
@@ -293,6 +319,16 @@ context.eval("a = 2")
|
|
293
319
|
# nothing works on the context from now on, its a shell waiting to be disposed
|
294
320
|
```
|
295
321
|
|
322
|
+
A MiniRacer context can also be dumped in a heapsnapshot file using `#write_heap_snapshot(file_or_io)`
|
323
|
+
|
324
|
+
```ruby
|
325
|
+
context = MiniRacer::Context.new(timeout: 5)
|
326
|
+
context.eval("let a='testing';")
|
327
|
+
context.write_heap_snapshot("test.heapsnapshot")
|
328
|
+
```
|
329
|
+
|
330
|
+
This file can then be loaded in the memory tab of the chrome dev console.
|
331
|
+
|
296
332
|
### Function call
|
297
333
|
|
298
334
|
This calls the function passed as first argument:
|
@@ -350,6 +386,10 @@ Note how the global interpreter lock release leads to 2 threads doing the same w
|
|
350
386
|
|
351
387
|
As a rule MiniRacer strives to always support and depend on the latest stable version of libv8.
|
352
388
|
|
389
|
+
## Source Maps
|
390
|
+
|
391
|
+
MiniRacer can fully support source maps but must be configured correctly to do so. [Check out this example](./examples/source-map-support/) for a working implementation.
|
392
|
+
|
353
393
|
## Installation
|
354
394
|
|
355
395
|
Add this line to your application's Gemfile:
|
@@ -426,7 +466,7 @@ Add this to your .travis.yml file:
|
|
426
466
|
|
427
467
|
## Contributing
|
428
468
|
|
429
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
469
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rubyjs/mini_racer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
430
470
|
|
431
471
|
|
432
472
|
## License
|
data/Rakefile
CHANGED
@@ -1,57 +1,80 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/testtask"
|
3
3
|
require "rake/extensiontask"
|
4
|
+
require "shellwords"
|
4
5
|
|
5
|
-
Rake::TestTask
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
class ValgrindTestTask < Rake::TestTask
|
7
|
+
VALGRIND_EXEC = 'valgrind'
|
8
|
+
DEFAULT_VALGRIND_OPTS = %w{
|
9
|
+
--trace-children=yes
|
10
|
+
--partial-loads-ok=yes
|
11
|
+
--error-limit=no
|
12
|
+
--error-exitcode=33
|
13
|
+
--num-callers=100
|
14
|
+
--suppressions=valgrind.supp
|
15
|
+
--gen-suppressions=all
|
16
|
+
}
|
17
|
+
|
18
|
+
attr_accessor :valgrind_args
|
19
|
+
|
20
|
+
def initialize(name=:valgrind_test)
|
21
|
+
@valgrind_args = DEFAULT_VALGRIND_OPTS
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
# see original def in fileutils.rb
|
26
|
+
def ruby(*args, &block)
|
27
|
+
options = (Hash === args.last) ? args.pop : {}
|
28
|
+
if args.length > 1
|
29
|
+
sh(*([VALGRIND_EXEC] + valgrind_args + [RUBY] + args + [options]), &block)
|
30
|
+
else
|
31
|
+
# if the size is 1 it's assumed the arguments are already escaped
|
32
|
+
non_escaped_args = [VALGRIND_EXEC] + valgrind_args + [RUBY]
|
33
|
+
sh("#{non_escaped_args.map { |s| Shellwords.escape(s) }.join(' ')} #{args.first}", options, &block)
|
34
|
+
end
|
35
|
+
end
|
9
36
|
end
|
10
37
|
|
38
|
+
test_task_cfg = Proc.new do |t|
|
39
|
+
t.libs << 'test'
|
40
|
+
t.libs << 'lib'
|
41
|
+
t.test_files = FileList['test/**/*_test.rb']
|
42
|
+
end
|
43
|
+
|
44
|
+
Rake::TestTask.new(:test, &test_task_cfg)
|
45
|
+
ValgrindTestTask.new(:'test:valgrind', &test_task_cfg)
|
46
|
+
|
11
47
|
task :default => [:compile, :test]
|
12
48
|
|
13
|
-
gem = Gem::Specification.load( File.dirname(__FILE__) + '/
|
49
|
+
gem = Gem::Specification.load( File.dirname(__FILE__) + '/mini_racer.gemspec' )
|
50
|
+
Rake::ExtensionTask.new( 'mini_racer_loader', gem ) do |ext|
|
51
|
+
ext.name = 'sq_mini_racer_loader'
|
52
|
+
end
|
14
53
|
Rake::ExtensionTask.new( 'mini_racer_extension', gem ) do |ext|
|
15
54
|
ext.name = 'sq_mini_racer_extension'
|
16
55
|
end
|
17
|
-
Rake::ExtensionTask.new('prv_ext_loader', gem)
|
18
|
-
|
19
|
-
|
20
|
-
# via http://blog.flavorjon.es/2009/06/easily-valgrind-gdb-your-ruby-c.html
|
21
|
-
namespace :test do
|
22
|
-
# partial-loads-ok and undef-value-errors necessary to ignore
|
23
|
-
# spurious (and eminently ignorable) warnings from the ruby
|
24
|
-
# interpreter
|
25
|
-
VALGRIND_BASIC_OPTS = "--num-callers=50 --error-limit=no \
|
26
|
-
--partial-loads-ok=yes --undef-value-errors=no"
|
27
|
-
|
28
|
-
desc "run test suite under valgrind with basic ruby options"
|
29
|
-
task :valgrind => :compile do
|
30
|
-
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} ruby test/test_leak.rb"
|
31
|
-
puts cmdline
|
32
|
-
system cmdline
|
33
|
-
end
|
34
56
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
puts
|
48
|
-
puts section
|
49
|
-
puts
|
50
|
-
end
|
51
|
-
section = ""
|
52
|
-
else
|
53
|
-
section << line << "\n"
|
54
|
-
end
|
55
|
-
end
|
57
|
+
desc 'run clang-tidy linter on mini_racer_extension.cc'
|
58
|
+
task :lint do
|
59
|
+
require 'mkmf'
|
60
|
+
require 'libv8'
|
61
|
+
|
62
|
+
Libv8.configure_makefile
|
63
|
+
|
64
|
+
conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote,
|
65
|
+
'arch_hdrdir' => $arch_hdrdir.quote,
|
66
|
+
'top_srcdir' => $top_srcdir.quote)
|
67
|
+
if $universal and (arch_flag = conf['ARCH_FLAG']) and !arch_flag.empty?
|
68
|
+
conf['ARCH_FLAG'] = arch_flag.gsub(/(?:\G|\s)-arch\s+\S+/, '')
|
56
69
|
end
|
70
|
+
|
71
|
+
checks = %W(bugprone-*
|
72
|
+
cert-*
|
73
|
+
cppcoreguidelines-*
|
74
|
+
clang-analyzer-*
|
75
|
+
performance-*
|
76
|
+
portability-*
|
77
|
+
readability-*).join(',')
|
78
|
+
|
79
|
+
sh RbConfig::expand("clang-tidy -checks='#{checks}' ext/mini_racer_extension/mini_racer_extension.cc -- #$INCFLAGS #$CPPFLAGS", conf)
|
57
80
|
end
|
data/azure-pipelines.yml
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
jobs:
|
2
|
+
- template: azure-template.yml
|
3
|
+
parameters:
|
4
|
+
name: linux_2_0
|
5
|
+
displayName: Linux Ruby 2.0
|
6
|
+
rubyVersion: '2.0'
|
7
|
+
publishCoverage: true
|
8
|
+
|
9
|
+
- template: azure-template.yml
|
10
|
+
parameters:
|
11
|
+
name: linux_2_1
|
12
|
+
displayName: Linux Ruby 2.1
|
13
|
+
rubyVersion: '2.1'
|
14
|
+
|
15
|
+
- template: azure-template.yml
|
16
|
+
parameters:
|
17
|
+
name: linux_2_2
|
18
|
+
displayName: Linux Ruby 2.2
|
19
|
+
rubyVersion: '2.2'
|
20
|
+
|
21
|
+
- template: azure-template.yml
|
22
|
+
parameters:
|
23
|
+
name: linux_2_3
|
24
|
+
displayName: Linux Ruby 2.3
|
25
|
+
rubyVersion: '2.3'
|
26
|
+
|
27
|
+
- template: azure-template.yml
|
28
|
+
parameters:
|
29
|
+
name: linux_2_4
|
30
|
+
displayName: Linux Ruby 2.4
|
31
|
+
rubyVersion: '2.4'
|
32
|
+
|
33
|
+
- template: azure-template.yml
|
34
|
+
parameters:
|
35
|
+
name: linux_2_5
|
36
|
+
displayName: Linux Ruby 2.5
|
37
|
+
rubyVersion: '2.5'
|
38
|
+
|
39
|
+
- template: azure-template.yml
|
40
|
+
parameters:
|
41
|
+
name: linux_2_6
|
42
|
+
displayName: Linux Ruby 2.6
|
43
|
+
rubyVersion: '2.6'
|
44
|
+
|
45
|
+
- template: azure-template.yml
|
46
|
+
parameters:
|
47
|
+
name: linux_2_7
|
48
|
+
displayName: Linux Ruby 2.7
|
49
|
+
rubyVersion: '2.7'
|
50
|
+
|
51
|
+
- template: azure-template.yml
|
52
|
+
parameters:
|
53
|
+
name: linux_2_7_mini_racer
|
54
|
+
displayName: Linux Ruby 2.7 (with mini_racer)
|
55
|
+
rubyVersion: '2.7'
|
56
|
+
with_mini_racer: true
|
57
|
+
|
58
|
+
- template: azure-template.yml
|
59
|
+
parameters:
|
60
|
+
name: linux_2_7_therubyracer
|
61
|
+
displayName: Linux Ruby 2.7 (with therubyracer)
|
62
|
+
rubyVersion: '2.7'
|
63
|
+
with_therubyracer: true
|
64
|
+
|
65
|
+
- template: azure-template.yml
|
66
|
+
parameters:
|
67
|
+
name: macos_10_14
|
68
|
+
displayName: MacOS 10.14
|
69
|
+
imageName: 'macos-10.14'
|
data/azure-template.yml
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
parameters:
|
2
|
+
name: ~
|
3
|
+
displayName: ~
|
4
|
+
rubyVersion: bundled
|
5
|
+
imageName: ubuntu-18.04
|
6
|
+
publishCoverage: false
|
7
|
+
with_mini_racer: false
|
8
|
+
with_therubyracer: false
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
- job: ${{ parameters.name }}
|
12
|
+
displayName: ${{ parameters.displayName }}
|
13
|
+
pool:
|
14
|
+
vmImage: ${{ parameters.imageName }}
|
15
|
+
|
16
|
+
variables:
|
17
|
+
TESTOPTS: -v
|
18
|
+
${{ if eq(parameters.publishCoverage, true) }}:
|
19
|
+
CPPFLAGS: --coverage
|
20
|
+
LDFLAGS: --coverage
|
21
|
+
${{ if eq(parameters.rubyVersion, 'bundled') }}:
|
22
|
+
gem: gem
|
23
|
+
bundle: bundle
|
24
|
+
${{ if ne(parameters.rubyVersion, 'bundled') }}:
|
25
|
+
gem: /opt/ruby/${{ parameters.rubyVersion }}/bin/gem
|
26
|
+
bundle: /opt/ruby/${{ parameters.rubyVersion }}/bin/bundle
|
27
|
+
GEM_HOME: /opt/ruby/${{ parameters.rubyVersion }}/lib/ruby/gems/${{ parameters.rubyVersion }}.0
|
28
|
+
|
29
|
+
steps:
|
30
|
+
- checkout: self
|
31
|
+
displayName: Checkout
|
32
|
+
clean: true
|
33
|
+
submodules: recursive
|
34
|
+
|
35
|
+
- ${{ if ne(parameters.rubyVersion, 'bundled') }}:
|
36
|
+
- script: |
|
37
|
+
sudo apt-get install -y gnupg
|
38
|
+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 5D98E7264E3F3D89463B314B12229434A9F003C9
|
39
|
+
echo deb [arch=amd64] http://sqreen-download-private.s3.amazonaws.com/deb bionic main | sudo tee -a /etc/apt/sources.list
|
40
|
+
sudo apt-get update
|
41
|
+
sudo apt-get install -y sq-ruby${{ parameters.rubyVersion }} ruby-
|
42
|
+
displayName: Install Ruby
|
43
|
+
|
44
|
+
- ${{ if eq(parameters.rubyVersion, 'bundled') }}:
|
45
|
+
- script: sudo $(gem) install bundler --version '< 2.0' --no-document
|
46
|
+
displayName: Install bundler
|
47
|
+
|
48
|
+
- ${{ if eq(parameters.imageName, 'ubuntu-18.04') }}:
|
49
|
+
- script: |
|
50
|
+
sudo apt-get install -y build-essential git curl valgrind g++ make
|
51
|
+
displayName: Install Linux packages
|
52
|
+
|
53
|
+
- script: $(bundle) install --path vendor/bundle
|
54
|
+
displayName: Install gem dependencies
|
55
|
+
env:
|
56
|
+
${{ if eq(parameters.with_mini_racer, true) }}:
|
57
|
+
LOAD_MINI_RACER: 1
|
58
|
+
${{ if eq(parameters.with_therubyracer, true) }}:
|
59
|
+
LOAD_THERUBYRACER: 1
|
60
|
+
|
61
|
+
- script: PATH=`dirname $(bundle)`:$PATH CPPFLAGS=$(CPPFLAGS) LDFLAGS=$(LDFLAGS) $(bundle) exec rake compile
|
62
|
+
displayName: Compile extension
|
63
|
+
|
64
|
+
- script: |
|
65
|
+
find . -name '*.log' -exec cat '{}' \;
|
66
|
+
displayName: Print logs
|
67
|
+
condition: failed()
|
68
|
+
|
69
|
+
- script: TESTOPTS=--junit $(bundle) exec rake test
|
70
|
+
displayName: Run tests
|
71
|
+
env:
|
72
|
+
${{ if eq(parameters.with_mini_racer, true) }}:
|
73
|
+
LOAD_MINI_RACER: 1
|
74
|
+
${{ if eq(parameters.with_therubyracer, true) }}:
|
75
|
+
LOAD_THERUBYRACER: 1
|
76
|
+
|
77
|
+
- task: PublishTestResults@2
|
78
|
+
displayName: Publish test results
|
79
|
+
condition: succeededOrFailed()
|
80
|
+
inputs:
|
81
|
+
testResultsFormat: 'JUnit'
|
82
|
+
testResultsFiles: '**/report.xml'
|
83
|
+
searchFolder: '$(System.DefaultWorkingDirectory)'
|
84
|
+
mergeTestResults: true
|
85
|
+
|
86
|
+
- ${{ if and(eq(parameters.imageName, 'ubuntu-18.04'), eq(parameters.with_mini_racer, false), eq(parameters.with_therubyracer, false)) }}:
|
87
|
+
- script: $(bundle) exec rake test:valgrind
|
88
|
+
displayName: Run tests w/ valgrind
|
89
|
+
|
90
|
+
- script: |
|
91
|
+
PATH=$PATH:$(dirname $(which $(gem)))
|
92
|
+
$(bundle) exec rake build
|
93
|
+
sudo PATH=$PATH $(gem) install pkg/*.gem
|
94
|
+
displayName: Check that the gem is installable
|
95
|
+
|
96
|
+
- ${{ if eq(parameters.publishCoverage, true) }}:
|
97
|
+
- bash: >
|
98
|
+
test -z "$CODECOV_TOKEN" || bash <(curl -s https://codecov.io/bash)
|
99
|
+
displayName: "Publish coverage (Codecov)"
|
100
|
+
env:
|
101
|
+
CODECOV_TOKEN: $(CODECOV_TOKEN)
|