Skip to content

Commit 4ff492d

Browse files
authored
Add JRuby to CI test job (#255)
1 parent 1212984 commit 4ff492d

File tree

5 files changed

+52
-5
lines changed

5 files changed

+52
-5
lines changed

.github/workflows/cicd.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,17 @@ jobs:
3535
runs-on: ubuntu-latest
3636
strategy:
3737
matrix:
38-
ruby-version: ['3.1', '3.2', '3.3', '3.4']
38+
ruby-version: ['3.1', '3.2', '3.3', '3.4', 'jruby-head']
3939
rails-version: ['rails-7.1', 'rails-7.2', 'rails-8.0']
4040
exclude:
4141
# Rails 8 requires Ruby 3.2+
4242
- ruby-version: '3.1'
4343
rails-version: 'rails-8.0'
44+
# JRuby only supports up to 7.1 right now
45+
- ruby-version: 'jruby-head'
46+
rails-version: 'rails-8.0'
47+
- ruby-version: 'jruby-head'
48+
rails-version: 'rails-7.2'
4449

4550
steps:
4651
- uses: actions/checkout@v4

Gemfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ gemspec
66

77
group :development do
88
gem 'appraisal'
9-
gem 'async'
109
gem 'bundler', '>= 2.0'
1110
gem 'codecov'
1211
gem 'dotenv'
@@ -25,7 +24,12 @@ group :development do
2524
gem 'rubocop-rspec'
2625
gem 'simplecov', '>= 0.21'
2726
gem 'simplecov-cobertura'
28-
gem 'sqlite3'
27+
28+
# database drivers for MRI and JRuby
29+
gem 'activerecord-jdbcsqlite3-adapter', platform: 'jruby'
30+
gem 'jdbc-sqlite3', platform: 'jruby'
31+
gem 'sqlite3', platform: 'mri'
32+
2933
gem 'vcr'
3034
gem 'webmock', '~> 3.18'
3135
gem 'yard', '>= 0.9'

gemfiles/rails_7.1.gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ group :development do
2222
gem "rubocop-rspec"
2323
gem "simplecov", ">= 0.21"
2424
gem "simplecov-cobertura"
25-
gem "sqlite3"
25+
gem 'sqlite3', platform: 'mri'
26+
gem 'jdbc-sqlite3', platform: 'jruby'
27+
gem 'activerecord-jdbcsqlite3-adapter', platform: 'jruby'
2628
gem "vcr"
2729
gem "webmock", "~> 3.18"
2830
gem "yard", ">= 0.9"

gemfiles/rails_7.1.gemfile.lock

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: ..
33
specs:
4-
ruby_llm (1.3.0rc1)
4+
ruby_llm (1.3.1)
55
base64
66
event_stream_parser (~> 1)
77
faraday (>= 1.10.0)
@@ -72,6 +72,11 @@ GEM
7272
activemodel (= 7.1.5.1)
7373
activesupport (= 7.1.5.1)
7474
timeout (>= 0.4.0)
75+
activerecord-jdbc-adapter (71.0-java)
76+
activerecord (~> 7.1.3)
77+
activerecord-jdbcsqlite3-adapter (71.0-java)
78+
activerecord-jdbc-adapter (= 71.0)
79+
jdbc-sqlite3 (~> 3.8, < 4)
7580
activestorage (7.1.5.1)
7681
actionpack (= 7.1.5.1)
7782
activejob (= 7.1.5.1)
@@ -101,6 +106,7 @@ GEM
101106
base64 (0.3.0)
102107
benchmark (0.4.1)
103108
bigdecimal (3.2.1)
109+
bigdecimal (3.2.1-java)
104110
builder (3.3.0)
105111
childprocess (5.1.0)
106112
logger (~> 1.5)
@@ -115,11 +121,13 @@ GEM
115121
rexml
116122
crass (1.0.6)
117123
date (3.4.1)
124+
date (3.4.1-java)
118125
diff-lcs (1.6.2)
119126
docile (1.4.1)
120127
dotenv (3.1.8)
121128
drb (2.2.3)
122129
erb (5.0.1)
130+
erb (5.0.1-java)
123131
erubi (1.13.1)
124132
event_stream_parser (1.0.0)
125133
faraday (2.13.1)
@@ -138,18 +146,23 @@ GEM
138146
concurrent-ruby (~> 1.1)
139147
webrick (~> 1.7)
140148
websocket-driver (~> 0.7)
149+
ffi (1.17.2-java)
141150
globalid (1.2.1)
142151
activesupport (>= 6.1)
143152
hashdiff (1.2.0)
144153
i18n (1.14.7)
145154
concurrent-ruby (~> 1.0)
146155
iniparse (1.5.0)
147156
io-console (0.8.0)
157+
io-console (0.8.0-java)
148158
irb (1.15.2)
149159
pp (>= 0.6.0)
150160
rdoc (>= 4.0.0)
151161
reline (>= 0.4.2)
162+
jar-dependencies (0.5.5)
163+
jdbc-sqlite3 (3.46.1.1)
152164
json (2.12.2)
165+
json (2.12.2-java)
153166
language_server-protocol (3.17.0.5)
154167
lint_roller (1.1.0)
155168
logger (1.7.0)
@@ -179,6 +192,9 @@ GEM
179192
net-smtp (0.5.1)
180193
net-protocol
181194
nio4r (2.7.4)
195+
nio4r (2.7.4-java)
196+
nokogiri (1.18.8-java)
197+
racc (~> 1.4)
182198
nokogiri (1.18.8-x86_64-linux-gnu)
183199
racc (~> 1.4)
184200
overcommit (0.67.1)
@@ -196,11 +212,19 @@ GEM
196212
pry (0.15.2)
197213
coderay (~> 1.1)
198214
method_source (~> 1.0)
215+
pry (0.15.2-java)
216+
coderay (~> 1.1)
217+
method_source (~> 1.0)
218+
spoon (~> 0.0)
199219
psych (5.2.6)
200220
date
201221
stringio
222+
psych (5.2.6-java)
223+
date
224+
jar-dependencies (>= 0.1.7)
202225
public_suffix (6.0.2)
203226
racc (1.8.1)
227+
racc (1.8.1-java)
204228
rack (3.1.15)
205229
rack-session (2.1.1)
206230
base64 (>= 0.1.0)
@@ -291,6 +315,8 @@ GEM
291315
simplecov (~> 0.19)
292316
simplecov-html (0.13.1)
293317
simplecov_json_formatter (0.1.4)
318+
spoon (0.0.6)
319+
ffi
294320
sqlite3 (2.6.0-x86_64-linux-gnu)
295321
stringio (3.1.7)
296322
thor (1.3.2)
@@ -311,20 +337,26 @@ GEM
311337
websocket-driver (0.8.0)
312338
base64
313339
websocket-extensions (>= 0.1.0)
340+
websocket-driver (0.8.0-java)
341+
base64
342+
websocket-extensions (>= 0.1.0)
314343
websocket-extensions (0.1.5)
315344
yard (0.9.37)
316345
zeitwerk (2.7.3)
317346

318347
PLATFORMS
348+
universal-java-21
319349
x86_64-linux
320350

321351
DEPENDENCIES
352+
activerecord-jdbcsqlite3-adapter
322353
appraisal
323354
bundler (>= 2.0)
324355
codecov
325356
dotenv
326357
ferrum
327358
irb
359+
jdbc-sqlite3
328360
nokogiri
329361
overcommit (>= 0.66)
330362
pry (>= 0.14)

spec/ruby_llm/chat_error_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969

7070
it 'handles context length exceeded errors' do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations
7171
skip('Ollama does not throw an error for context length exceeded') if provider == :ollama
72+
73+
# Configure Psych to allow large input (JRuby's ext provider SnakeYAML has a low limit by default)
74+
Psych::Parser.code_point_limit = 20_000_000 if Psych::Parser.respond_to?(:code_point_limit=)
75+
7276
# Create a huge conversation
7377
massive_text = 'a' * 1_000_000
7478

0 commit comments

Comments
 (0)