Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use libv8 node #186

Merged
merged 10 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Test
on:
- push

jobs:
test-darwin:
strategy:
fail-fast: false
matrix:
os:
- '10.15'
- '11.0'
platform:
- x86_64
# arm64
name: Test (darwin)
runs-on: macos-${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Bundle
run: bundle install
- name: Compile
run: bundle exec rake compile
- name: Test
run: bundle exec rake test
test-linux:
strategy:
fail-fast: false
matrix:
ruby:
- '2.4'
- '2.5'
- '2.6'
- '2.7'
- '3.0'
platform:
- amd64
- arm64
# arm
# ppc64le
# s390x
libc:
- gnu
- musl
name: Test (linux)
runs-on: ubuntu-20.04
steps:
- name: Enable ${{ matrix.platform }} platform
id: qemu
if: ${{ matrix.platform != 'amd64' }}
run: |
docker run --privileged --rm tonistiigi/binfmt:latest --install ${{ matrix.platform }} | tee platforms.json
echo "::set-output name=platforms::$(cat platforms.json)"
- name: Start container
id: container
run: |
case ${{ matrix.libc }} in
gnu)
echo 'ruby:${{ matrix.ruby }}'
;;
musl)
echo 'ruby:${{ matrix.ruby }}-alpine'
;;
esac > container_image
echo "::set-output name=image::$(cat container_image)"
docker run --rm -d -v "${PWD}":"${PWD}" -w "${PWD}" --platform linux/${{ matrix.platform }} $(cat container_image) /bin/sleep 64d | tee container_id
docker exec -w "${PWD}" $(cat container_id) uname -a
echo "::set-output name=id::$(cat container_id)"
- name: Install Alpine system dependencies
if: ${{ matrix.libc == 'musl' }}
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
- name: Checkout
uses: actions/checkout@v2
- name: Bundle
run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle install
- name: Compile
run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec rake compile
- name: Test
run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec rake test
22 changes: 18 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
language: ruby
os: linux
rvm:
- 2.4
- 2.5
- 2.6
- 2.7
- 3.0
- ruby-head
matrix:
arch:
- amd64
- arm64
jobs:
include:
- rvm: 2.5.1
- rvm: 2.5
os: osx
osx_image: xcode9.4
dist: trusty
sudo: true
- rvm: 2.6
os: osx
osx_image: xcode11.3
- rvm: 2.6
os: osx
osx_image: xcode12.2
- rvm: 2.7
os: osx
osx_image: xcode12.2
dist: xenial
before_install:
- gem update --system
- gem install bundler -v 1.16.2
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ARG RUBY_VERSION=2.7
FROM ruby:${RUBY_VERSION}

RUN test ! -f /etc/alpine-release || apk add --no-cache build-base git

# without this `COPY .git`, we get the following error:
# fatal: not a git repository (or any of the parent directories): .git
# but with it we need the full gem just to compile the extension because
Expand Down
10 changes: 7 additions & 3 deletions ext/mini_racer_extension/extconf.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'mkmf'
require_relative '../../lib/mini_racer/version'
gem 'libv8', MiniRacer::LIBV8_VERSION
require 'libv8'
gem 'libv8-node', MiniRacer::LIBV8_NODE_VERSION
require 'libv8-node'

IS_DARWIN = RUBY_PLATFORM =~ /darwin/

Expand All @@ -20,6 +20,10 @@

$LDFLAGS.insert(0, " -stdlib=libc++ ") if IS_DARWIN

# check for missing symbols at link time
# $LDFLAGS += " -Wl,--no-undefined " unless IS_DARWIN
# $LDFLAGS += " -Wl,-undefined,error " if IS_DARWIN

if ENV['CXX']
puts "SETTING CXX"
CONFIG['CXX'] = ENV['CXX']
Expand Down Expand Up @@ -57,7 +61,7 @@
CONFIG['debugflags'] << ' -ggdb3 -O0'
end

Libv8.configure_makefile
Libv8::Node.configure_makefile

if enable_config('asan')
$CPPFLAGS.insert(0, " -fsanitize=address ")
Expand Down
2 changes: 1 addition & 1 deletion lib/mini_racer/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

module MiniRacer
VERSION = "0.3.1"
LIBV8_VERSION = "~> 8.4.255"
LIBV8_NODE_VERSION = "~> 15.12.0.0.beta1"
end
2 changes: 1 addition & 1 deletion mini_racer.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rake-compiler"
spec.add_development_dependency "m"

spec.add_dependency 'libv8', MiniRacer::LIBV8_VERSION
spec.add_dependency 'libv8-node', MiniRacer::LIBV8_NODE_VERSION
spec.require_paths = ["lib", "ext"]

spec.extensions = ["ext/mini_racer_loader/extconf.rb", "ext/mini_racer_extension/extconf.rb"]
Expand Down