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

Fix Libv8::Node::Paths with RubyGems >=3.3.21 on *-linux-gnu platforms #36

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2e94fc2
Fix repo address
lloeki Jan 24, 2022
21eeb92
Pin mini_racer test version
lloeki Jan 24, 2022
a6cc61e
Patch platform for musl tests with old rubygems
lloeki Oct 18, 2021
f55ed74
Fix library path for old rubygems
lloeki Oct 19, 2021
90b7d78
Improve local building
lloeki Aug 25, 2022
5c54319
Transpose CPU to aarch64 for Docker on Darwin
lloeki Aug 25, 2022
f6a5708
Relax mini_racer Ruby version check for CI testing
lloeki Aug 25, 2022
f4d6da8
Use Ruby 2.6 as base compiling environment
lloeki Aug 25, 2022
1328005
Remove Ruby 2.5
lloeki Aug 25, 2022
fe34cc6
Add Ruby 3.1
lloeki Aug 25, 2022
4460470
Fix lint
lloeki Aug 25, 2022
690c03f
Test ruby platform on musl too
lloeki Aug 26, 2022
ff6449f
Test more versions for `ruby` platform
lloeki Aug 26, 2022
b5a47ed
Move CI to macOS 12
lloeki Aug 26, 2022
3be6699
Remove python2 from alpine
lloeki Aug 26, 2022
7d3ed36
Add ccache support
lloeki Aug 26, 2022
461eedc
Add more cross-compilation options
lloeki Aug 26, 2022
f53bf1e
Update to node 16.17.0
lloeki Aug 26, 2022
6b7f57d
Move back to macOS 11
lloeki Aug 26, 2022
98078bc
Build with Ruby 2.4
lloeki Aug 27, 2022
98c9258
Test with mini_racer 0.6.3
lloeki Aug 27, 2022
7fa4743
Add ccache only once
lloeki Aug 27, 2022
e35a4fa
Update to node 16.19.0
lloeki Jan 8, 2023
d742196
Optimize 'libexec/build-monolith' on Linux
Fayti1703 Jan 8, 2023
abae20e
Skip compilation on TruffleRuby
eregon Jan 10, 2023
6da5856
Merge pull request #38 from eregon/truffleruby
lloeki Jan 12, 2023
db76c05
Ignore stubdata object
Fayti1703 Jan 9, 2023
d8c6b58
googletest 'hello test'
seanmakesgames Jan 10, 2023
f17c160
get test to reference built libv8
seanmakesgames Jan 13, 2023
fdd9edf
actually use v8 in the test
seanmakesgames Jan 13, 2023
261889c
Add initial multi-platform support for test.
seanmakesgames Jan 13, 2023
bf1dff5
Add ctest to makefile
seanmakesgames Jan 15, 2023
d8d1567
fix building test on linux on some build setups
seanmakesgames Jan 15, 2023
f803993
integrate test into actions
seanmakesgames Jan 15, 2023
0248883
CI: Install CMake in docker container
Fayti1703 Jan 15, 2023
02f6af3
attempt to move forward docker image to newer version
seanmakesgames Jan 16, 2023
fd333f5
Auto-detect vendor dir in GTest CMake Configuration
Fayti1703 Jan 16, 2023
d016d23
Use pathed archives on Linux
Fayti1703 Jan 17, 2023
b1af510
Fix aarch64 cross-compile by dropping -msign-return-address on host
Fayti1703 Jan 18, 2023
29c7341
skip arm64 c test on mac and lin
seanmakesgames Jan 18, 2023
9a61bac
2.6 is EOL -- remove and bump
seanmakesgames Jan 19, 2023
97560d6
Force ruby platform when testing ruby gem
Fayti1703 Jan 22, 2023
543ee88
Merge pull request #37 from seanmakesgames/add_test
SamSaffron Jan 23, 2023
0d462cb
Use Ruby 2.7 in Makefile and Dockerfile
lloeki Jan 24, 2023
f38ca6d
Use ccache in Dockerfile
lloeki Jan 24, 2023
0fad627
Pin Rubygems and Bundler
lloeki Jan 24, 2023
dcb3894
Add Ruby 3.2
lloeki Jan 25, 2023
4db6396
Fix and bump Rubocop
lloeki Jan 25, 2023
f6a5a86
Fix Libv8::Node::Paths with RubyGems >=3.3.21 on *-linux-gnu platforms
knu Oct 29, 2022
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
131 changes: 107 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
rubocop:
name: Lint (Rubocop)
runs-on: ubuntu-20.04
container: ruby:2.6
container: ruby:2.7
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -25,13 +25,27 @@ jobs:
run: apt-get update && apt-get install -y shellcheck
- name: Shellcheck
run: shellcheck libexec/*
compile-truffleruby:
name: Compile on truffleruby
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: truffleruby
bundler-cache: true
- run: bundle exec rake compile
build-ruby:
name: Build (ruby)
outputs:
GEM_VERSION: ${{ steps.set-metadata.outputs.GEM_VERSION }}
runs-on: ubuntu-20.04
container: ruby:2.6
container: ruby:2.7
steps:
- name: Update Rubygems and Bundler
run: |
gem update --system 3.3.26
gem install bundler -v '~> 2.3.26'
- name: Checkout
uses: actions/checkout@v2
- name: Bundle
Expand Down Expand Up @@ -73,11 +87,14 @@ jobs:
matrix:
platform:
- x86_64
# arm64
- arm64
name: Build (darwin)
outputs:
GEM_VERSION: ${{ steps.set-metadata.outputs.GEM_VERSION }}
runs-on: macos-10.15
runs-on: macos-11
env:
TARGET_PLATFORM: ${{ matrix.platform }}-darwin
RUBY_TARGET_PLATFORM: ${{ matrix.platform }}-darwin
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -115,6 +132,14 @@ jobs:
- name: Inject V8
run: |
./libexec/inject-libv8 ${{ steps.set-metadata.outputs.NODE_VERSION }}
- name: Test V8 in C++
if: matrix.platform != 'arm64'
run: |
cd test/gtest
cmake -S . -B build
cd build
cmake --build .
./c_v8_tests
- name: Build binary gem
run: |
bundle exec rake binary
Expand Down Expand Up @@ -188,10 +213,10 @@ jobs:
run: |
case ${{ matrix.libc }} in
gnu)
echo 'ruby:2.4'
echo 'ruby:2.7'
;;
musl)
echo 'ruby:2.4-alpine'
echo 'ruby:2.7-alpine'
;;
esac | tee container_image
echo "::set-output name=image::$(cat container_image)"
Expand All @@ -200,12 +225,20 @@ jobs:
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
run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apk add --no-cache build-base linux-headers bash python3 git curl tar cmake
- name: Install Debian system dependencies
if: ${{ matrix.libc == 'gnu' }}
run: |
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apt-get update
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apt-get install -y cmake
- name: Install Debian cross-compiler
if: ${{ matrix.libc == 'gnu' && matrix.platform != 'amd64' }}
run: |
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apt-get update
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apt-get install -y binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Update Rubygems and Bundler
run: |
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} gem update --system 3.3.26
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} gem install bundler -v '~> 2.3.26'
- name: Checkout
uses: actions/checkout@v2
- name: Bundle
Expand Down Expand Up @@ -242,6 +275,10 @@ jobs:
- name: Inject V8
run: |
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ./libexec/inject-libv8 ${{ steps.set-metadata.outputs.NODE_VERSION }}
- name: Test V8 in C++
if: matrix.platform != 'arm64'
run: |
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bash -c "cd test/gtest && cmake -S . -B build && cd build && cmake --build . && ctest"
- name: Build binary gem
run: |
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec rake binary[${{ steps.platform.outputs.ruby_target_platform }}]
Expand All @@ -256,11 +293,49 @@ jobs:
name: gem-${{ steps.set-metadata.outputs.GEM_VERSION }}-${{ steps.platform.outputs.ruby_target_platform }}
path: pkg
test-ruby:
name: Test (ruby)
strategy:
fail-fast: false
matrix:
platform:
- amd64
# other platforms would need emulation, which is way too slow
container:
- image: ruby:2.7
version: '2.7'
libc: gnu
- image: ruby:2.7-alpine
version: '2.7'
libc: musl
- image: ruby:3.0
version: '3.0'
libc: gnu
- image: ruby:3.0-alpine
version: '3.0'
libc: musl
- image: ruby:3.1
version: '3.1'
libc: gnu
- image: ruby:3.1-alpine
version: '3.1'
libc: musl
- image: ruby:3.2
version: '3.2'
libc: gnu
- image: ruby:3.2-alpine
version: '3.2'
libc: musl
name: Test (ruby) (${{ matrix.container.version }}, ${{ matrix.platform }}, ${{ matrix.container.libc }})
needs: build-ruby
runs-on: ubuntu-20.04
container: ruby:2.5
container: ${{ matrix.container.image }}
steps:
- name: Install Alpine system dependencies
if: ${{ matrix.container.libc == 'musl' }}
run: apk add --no-cache build-base linux-headers bash python3 git curl tar
- name: Update Rubygems and Bundler
run: |
gem update --system 3.3.26
gem install bundler -v '~> 2.3.26'
- name: Set metadata
id: set-metadata
run: |
Expand All @@ -275,13 +350,15 @@ jobs:
run: gem install --verbose pkg/libv8-node-${{ needs.build-ruby.outputs.GEM_VERSION }}.gem
- name: Test with mini_racer
run: |
export BUNDLE_FORCE_RUBY_PLATFORM=y
git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1
cd test/mini_racer
git fetch origin refs/pull/210/head
git checkout FETCH_HEAD
git fetch origin v0.6.3
git checkout -f FETCH_HEAD
git reset --hard
git clean -f -d -x
ruby -i -ne '$_ =~ /^\s+LIBV8_NODE_VERSION/ ? print(" LIBV8_NODE_VERSION = \"${{ needs.build-ruby.outputs.GEM_VERSION }}\"\n") : print' lib/mini_racer/version.rb
ruby -i -ne '$_ =~ /spec.required_ruby_version/ ? "" : print' mini_racer.gemspec
bundle install
bundle exec rake compile
bundle exec rake test
Expand All @@ -294,7 +371,7 @@ jobs:
# arm64
name: Test (darwin)
needs: build-darwin
runs-on: macos-10.15
runs-on: macos-11
steps:
- name: Set metadata
id: set-metadata
Expand All @@ -312,11 +389,12 @@ jobs:
run: |
git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1
cd test/mini_racer
git fetch origin refs/pull/210/head
git checkout FETCH_HEAD
git fetch origin v0.6.3
git checkout -f FETCH_HEAD
git reset --hard
git clean -f -d -x
ruby -i -ne '$_ =~ /^\s+LIBV8_NODE_VERSION/ ? print(" LIBV8_NODE_VERSION = \"${{ needs.build-darwin.outputs.GEM_VERSION }}\"\n") : print' lib/mini_racer/version.rb
ruby -i -ne '$_ =~ /spec.required_ruby_version/ ? "" : print' mini_racer.gemspec
bundle install
bundle exec rake compile
bundle exec rake test
Expand All @@ -325,10 +403,10 @@ jobs:
fail-fast: false
matrix:
version:
- '2.5'
- '2.6'
- '2.7'
- '3.0'
- '3.1'
- '3.2'
platform:
- amd64
# arm64
Expand All @@ -339,16 +417,16 @@ jobs:
- gnu
- musl
include:
- version: '2.5'
- version: '2.7'
platform: 'arm64'
libc: 'gnu'
- version: '2.6'
- version: '3.0'
platform: 'arm64'
libc: 'gnu'
- version: '2.7'
- version: '3.1'
platform: 'arm64'
libc: 'gnu'
- version: '3.0'
- version: '3.2'
platform: 'arm64'
libc: 'gnu'
name: Test (linux)
Expand Down Expand Up @@ -379,10 +457,14 @@ jobs:
- name: Install Alpine system dependencies
if: ${{ matrix.libc == 'musl' }}
run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apk add --no-cache build-base git libstdc++
- name: Update Rubygems and Bundler
run: |
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} gem update --system 3.3.26
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} gem install bundler -v '~> 2.3.26'
- name: Set metadata
id: set-metadata
run: |
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ruby -e 'puts Gem.platforms.last.to_s' | tee gem_platform
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ruby -e 'puts Gem::Platform.local.tap { |p| RUBY_PLATFORM =~ /musl/ && p.version.nil? and p.instance_eval { @version = "musl" } }.to_s' | tee gem_platform
echo "::set-output name=GEM_PLATFORM::$(cat gem_platform)"
- name: Download a single artifact
uses: actions/download-artifact@v2
Expand All @@ -395,11 +477,12 @@ jobs:
run: |
git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1
cd test/mini_racer
git fetch origin refs/pull/210/head
git checkout FETCH_HEAD
git fetch origin v0.6.3
git checkout -f FETCH_HEAD
git reset --hard
git clean -f -d -x
ruby -i -ne '$_ =~ /^\s+LIBV8_NODE_VERSION/ ? print(" LIBV8_NODE_VERSION = \"${{ needs.build-linux.outputs.GEM_VERSION }}\"\n") : print' lib/mini_racer/version.rb
ruby -i -ne '$_ =~ /spec.required_ruby_version/ ? "" : print' mini_racer.gemspec
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle install
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec rake compile
docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec rake test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Makefile
/ext/libv8-node/.location.yml
/test/mini_racer
/test/bundle
*.nix
*.vim
.envrc
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
AllCops:
SuggestExtensions: false
NewCops: disable
TargetRubyVersion: 2.0
Exclude:
- src/**/*
- pkg/**/*
- vendor/**/*
- test/**/*

Naming/FileName:
Exclude:
Expand All @@ -26,3 +29,6 @@ Style/WordArray:

Style/PerlBackrefs:
Enabled: false

Gemspec/RequiredRubyVersion:
Enabled: false
14 changes: 10 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
ARG RUBY_VERSION=2.4
ARG RUBY_VERSION=2.7
FROM ruby:${RUBY_VERSION}

RUN test ! -f /etc/alpine-release || apk add --no-cache build-base bash python2 python3 git curl tar
RUN test ! -f /etc/alpine-release || apk add --no-cache build-base bash python3 git curl tar ccache
RUN test -f /etc/alpine-release || (apt-get update && apt-get install -y ccache)
ENV CCACHE_DIR=/ccache

RUN gem update --system 3.3.26 && gem install bundler -v '~> 2.3.26'

RUN mkdir -p /code
WORKDIR /code

ARG NODE_VERSION=16.10.0
ARG NODE_VERSION=16.19.0

COPY sums/v${NODE_VERSION}.sum /code/sums/
COPY libexec/download-node /code/libexec/
RUN ./libexec/download-node ${NODE_VERSION}
COPY libexec/extract-node /code/libexec/
COPY patch/* /code/patch/
RUN ./libexec/extract-node ${NODE_VERSION}
COPY libexec/platform /code/libexec/
COPY libexec/build-libv8 /code/libexec/
RUN ./libexec/build-libv8 ${NODE_VERSION}
RUN --mount=type=cache,id=ccache,target=/ccache/ ./libexec/build-libv8 ${NODE_VERSION}
COPY libexec/build-monolith /code/libexec/
RUN ./libexec/build-monolith ${NODE_VERSION}
COPY libexec/inject-libv8 /code/libexec/
Expand Down
Loading