Skip to content

Commit 4ec0f83

Browse files
authored
πŸ”€ Merge pull request #528 from ruby/add-truffleruby-to-ci
βœ… Add TruffleRuby to CI
2 parents cb4a646 + ad5eb96 commit 4ec0f83

File tree

5 files changed

+69
-18
lines changed

5 files changed

+69
-18
lines changed

β€Ž.github/workflows/test.ymlβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
2121
os: [ ubuntu-latest, macos-latest, windows-latest ]
2222
experimental: [false]
23+
include:
24+
- { ruby: truffleruby-head, os: ubuntu-latest, experimental: true }
2325
runs-on: ${{ matrix.os }}
2426
continue-on-error: ${{ matrix.experimental }}
2527
timeout-minutes: 15
@@ -36,7 +38,8 @@ jobs:
3638
timeout-minutes: 5 # _should_ finish in under a minute
3739

3840
- uses: joshmfrankel/simplecov-check-action@main
39-
if: matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request'
41+
if: ${{ matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request' &&
42+
!startsWith(matrix.ruby, 'truffleruby') && !startsWith(matrix.ruby, 'jruby') }}
4043
with:
4144
check_job_name: "SimpleCov - ${{ matrix.ruby }}"
4245
minimum_suite_coverage: 90

β€ŽGemfileβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ gem "benchmark-driver", require: false
1919
gem "vernier", require: false, platform: :mri
2020

2121
group :test do
22-
gem "simplecov", require: false
23-
gem "simplecov-html", require: false
24-
gem "simplecov-json", require: false
22+
gem "simplecov", require: false, platforms: %i[mri windows]
23+
gem "simplecov-html", require: false, platforms: %i[mri windows]
24+
gem "simplecov-json", require: false, platforms: %i[mri windows]
2525
end

β€Žtest/lib/helper.rbβ€Ž

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
unless ENV["SIMPLECOV_DISABLE"] in /\A(1|y(es)?|t(rue)?)\z/i
1+
if !(ENV["SIMPLECOV_DISABLE"] in /\A(1|y(es)?|t(rue)?)\z/i) &&
2+
RUBY_ENGINE == "ruby" # C Ruby only
3+
24
require "simplecov"
35

46
# Cannot use ".simplecov" file: simplecov-json triggers a circular require.
@@ -71,6 +73,46 @@ def assert_pattern
7173
end
7274
end
7375

76+
def pend_if(condition, *args, &block)
77+
if condition
78+
pend(*args, &block)
79+
else
80+
block.call if block
81+
end
82+
end
83+
84+
def pend_unless(condition, *args, &block)
85+
if condition
86+
block.call if block
87+
else
88+
pend(*args, &block)
89+
end
90+
end
91+
92+
def omit_unless_cruby(msg = "test omitted for non-CRuby", &block)
93+
omit_unless(RUBY_ENGINE == "ruby", msg, &block)
94+
end
95+
96+
def omit_if_truffleruby(msg = "test omitted on TruffleRuby", &block)
97+
omit_if(RUBY_ENGINE == "truffleruby", msg, &block)
98+
end
99+
100+
def omit_if_jruby(msg = "test omitted on JRuby", &block)
101+
omit_if(RUBY_ENGINE == "jruby", msg, &block)
102+
end
103+
104+
def pend_unless_cruby(msg = "test is pending for non-CRuby", &block)
105+
pend_unless(RUBY_ENGINE == "ruby", msg, &block)
106+
end
107+
108+
def pend_if_truffleruby(msg = "test is pending on TruffleRuby", &block)
109+
pend_if(RUBY_ENGINE == "truffleruby", msg, &block)
110+
end
111+
112+
def pend_if_jruby(msg = "test is pending on JRuby", &block)
113+
pend_if(RUBY_ENGINE == "jruby", msg, &block)
114+
end
115+
74116
end
75117

76118
require_relative "profiling_helper"

β€Žtest/net/imap/test_connection_state.rbβ€Ž

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,25 @@ class ConnectionStateTest < Net::IMAP::TestCase
2525
end
2626

2727
test "#deconstruct" do
28-
assert_equal [:not_authenticated], NotAuthenticated[].deconstruct
29-
assert_equal [:authenticated], Authenticated[] .deconstruct
30-
assert_equal [:selected], Selected[] .deconstruct
31-
assert_equal [:logout], Logout[] .deconstruct
28+
pend_if_truffleruby "TruffleRuby bug overriding ::Data methods" do
29+
assert_equal [:not_authenticated], NotAuthenticated[].deconstruct
30+
assert_equal [:authenticated], Authenticated[] .deconstruct
31+
assert_equal [:selected], Selected[] .deconstruct
32+
assert_equal [:logout], Logout[] .deconstruct
33+
end
3234
end
3335

3436
test "#deconstruct_keys" do
35-
assert_equal({symbol: :not_authenticated}, NotAuthenticated[].deconstruct_keys([:symbol]))
36-
assert_equal({symbol: :authenticated}, Authenticated[] .deconstruct_keys([:symbol]))
37-
assert_equal({symbol: :selected}, Selected[] .deconstruct_keys([:symbol]))
38-
assert_equal({symbol: :logout}, Logout[] .deconstruct_keys([:symbol]))
39-
assert_equal({name: "not_authenticated"}, NotAuthenticated[].deconstruct_keys([:name]))
40-
assert_equal({name: "authenticated"}, Authenticated[] .deconstruct_keys([:name]))
41-
assert_equal({name: "selected"}, Selected[] .deconstruct_keys([:name]))
42-
assert_equal({name: "logout"}, Logout[] .deconstruct_keys([:name]))
37+
pend_if_truffleruby "TruffleRuby bug overriding ::Data methods" do
38+
assert_equal({symbol: :not_authenticated}, NotAuthenticated[].deconstruct_keys([:symbol]))
39+
assert_equal({symbol: :authenticated}, Authenticated[] .deconstruct_keys([:symbol]))
40+
assert_equal({symbol: :selected}, Selected[] .deconstruct_keys([:symbol]))
41+
assert_equal({symbol: :logout}, Logout[] .deconstruct_keys([:symbol]))
42+
assert_equal({name: "not_authenticated"}, NotAuthenticated[].deconstruct_keys([:name]))
43+
assert_equal({name: "authenticated"}, Authenticated[] .deconstruct_keys([:name]))
44+
assert_equal({name: "selected"}, Selected[] .deconstruct_keys([:name]))
45+
assert_equal({name: "logout"}, Logout[] .deconstruct_keys([:name]))
46+
end
4347
end
4448

4549
test "#not_authenticated?" do

β€Žtest/net/imap/test_data_lite.rbβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,9 @@ class InheritsOverride < AbstractWithOverride.define(:foo)
374374

375375
def test_subclass_override_deconstruct
376376
data = InheritsOverride[:foo]
377-
assert_equal %i[ok foo], data.deconstruct
377+
pend_if_truffleruby do
378+
assert_equal %i[ok foo], data.deconstruct
379+
end
378380
end
379381

380382
end

0 commit comments

Comments
Β (0)