Skip to content

Commit 187e671

Browse files
committed
recognize jruby platform via a :platform option
in addition to the :rubyvm option
1 parent 151e452 commit 187e671

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.github/workflows/publish-images.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ jobs:
2222
- arm64-darwin
2323
- arm-linux
2424
- aarch64-linux
25-
include:
26-
- platform: jruby
27-
tag: jruby
25+
- jruby
2826
runs-on: ubuntu-latest
2927
steps:
3028
- uses: actions/checkout@v3

lib/rake_compiler_dock/starter.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def container_registry
178178
end
179179

180180
def container_rubyvm(options={})
181+
return "jruby" if options[:platform] == "jruby"
181182
options.fetch(:rubyvm) { ENV['RCD_RUBYVM'] } || "mri"
182183
end
183184

test/test_starter.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ def test_container_image_name
5959
Starter.container_image_name({:rubyvm => "jruby"}),
6060
)
6161

62+
# jruby platform arg
63+
assert_equal(
64+
"ghcr.io/rake-compiler/rake-compiler-dock-image:#{IMAGE_VERSION}-jruby",
65+
Starter.container_image_name({:platform => "jruby"}),
66+
)
67+
6268
# container registry env var
6369
with_env({"CONTAINER_REGISTRY" => "registry-value"}) do
6470
assert_equal(
@@ -98,11 +104,16 @@ def test_container_rubyvm
98104
with_env({"RCD_RUBYVM" => "env-var-value"}) do
99105
assert_equal("option-value", Starter.container_rubyvm({:rubyvm => "option-value"}))
100106
end
107+
108+
# with jruby platform option
109+
assert_equal("jruby", Starter.container_rubyvm({:platform => "jruby"}))
101110
end
102111

103112
def test_container_jrubyvm?
104113
assert(Starter.container_jrubyvm?({:rubyvm => "jruby"}))
114+
assert(Starter.container_jrubyvm?({:platform => "jruby"}))
105115
refute(Starter.container_jrubyvm?({:rubyvm => "mri"}))
116+
refute(Starter.container_jrubyvm?({:platform => "x86_64-linux"}))
106117
end
107118

108119
def test_platforms

0 commit comments

Comments
 (0)