Fix JRuby CI lane by using a dedicated minimal Gemfile The ffi_backend (jruby) job failed during bundle install: the main Gemfile pulls in development gems whose C extensions cannot be built on JRuby (zlib via rubocop-on-rbs, bigdecimal via activesupport, and date via rdoc -> psych, which has no java platform gem). Instead of excluding an ever-growing list of groups, the FFI backend lane now uses gemfiles/ffi_backend.gemfile, which installs only what the parser test subset needs (rake, rake-compiler, test-unit, ffi, and the gemspec dependencies). rdoc is not installed in this lane, so test_helper now tolerates rbs/annotate failing to load; the parser tests don't use it. Verified locally on JRuby 10.1.0.0 and MRI (RBS_FFI_BACKEND=1): bundle install succeeds with the new gemfile and rake test:parser passes (298 tests) on both. https://claude.ai/code/session_01Wqt6pchkDhcVFMaxnoWUZj
diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 7bfc820..032eb81 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml
@@ -98,6 +98,9 @@ rbs_ffi_backend: "" env: RBS_FFI_BACKEND: ${{ matrix.rbs_ffi_backend }} + # The main Gemfile pulls in development gems whose C extensions cannot + # be built on JRuby; this lane only needs the parser test subset. + BUNDLE_GEMFILE: gemfiles/ffi_backend.gemfile steps: - uses: actions/checkout@v6 - uses: ruby/setup-ruby@v1 @@ -106,8 +109,6 @@ bundler: none - name: Set working directory as safe run: git config --global --add safe.directory $(pwd) - - name: Skip gems not needed by the parser tests - run: bundle config set --local without 'libs profilers typecheck_test minitest' - name: Install dependencies run: bundle install --jobs 4 --retry 3 - name: Run parser tests
diff --git a/.gitignore b/.gitignore index e791fbb..9d69830 100644 --- a/.gitignore +++ b/.gitignore
@@ -30,3 +30,4 @@ # Rust crate vendored RBS source (managed by rake rust:rbs:sync or rust:rbs:symlink) rust/ruby-rbs-sys/vendor/rbs/ rust/ruby-rbs/vendor/rbs/ +gemfiles/*.gemfile.lock
diff --git a/gemfiles/ffi_backend.gemfile b/gemfiles/ffi_backend.gemfile new file mode 100644 index 0000000..9ea40c0 --- /dev/null +++ b/gemfiles/ffi_backend.gemfile
@@ -0,0 +1,19 @@ +# Minimal Gemfile for the FFI parser backend CI lane (`rake test:parser` on +# JRuby, or on MRI with RBS_FFI_BACKEND=1). +# +# The main Gemfile pulls in development gems whose C extensions cannot be +# built on JRuby (e.g. zlib via rubocop-on-rbs, bigdecimal via +# activesupport), so this lane installs only what the parser test subset +# needs. + +source "https://rubygems.org" + +gemspec path: "../" + +gem "rake" +gem "rake-compiler" # Required by the Rakefile (rake/extensiontask) +gem "test-unit" + +# Used by the backend when forced on MRI with RBS_FFI_BACKEND=1; JRuby and +# TruffleRuby bundle ffi as a default gem. +gem "ffi", require: false
diff --git a/test/test_helper.rb b/test/test_helper.rb index 9a077b1c..94f0885 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb
@@ -6,7 +6,12 @@ require "bundler" # Explicitly require bundler because ruby CI runs without bundler require "rbs" -require "rbs/annotate" +begin + require "rbs/annotate" +rescue LoadError + # rbs/annotate needs rdoc, which is not installed in the FFI backend CI + # lane (gemfiles/ffi_backend.gemfile). The parser tests don't use it. +end require "test_skip" unless ENV["XDG_CACHE_HOME"]