Uh oh!
There was an error while loading. Please reload this page.
Switch JAVA_HOME to 21 for JRuby - #721
Conversation
headius
commented
Mar 11, 2025
@eregon This is a quick attempt to implement what I need. I am not sure how to detect if the user has already reassigned JAVA_HOME, either manually or by setup-java. It may not be possible. I am trusting that Not sure how to make this more robust. |
JRuby 10 requires Java 21. Since the previous default was 17 and all JRuby releases should work fine on 21, we do this for all JRuby installs. Implements ruby#718
headius
commented
Mar 11, 2025
FWIW GitHub may soon bump the default Java to 21, at which point we won't need this anymore. |
Uh oh!
There was an error while loading. Please reload this page.
eregon
commented
Mar 11, 2025
Interesting, any issue I can follow about that? |
headius
commented
Mar 11, 2025
No, I just assume they eventually move the default version up. Obviously they moved it up to 17 at some point. |
The JAVA_HOME_* variables use 'arm64' on ARM.
headius
commented
Mar 11, 2025
Latest run appears to be green and handles arch properly on macos. Ruby version shows JRuby is running with 21. |
headius
commented
Mar 11, 2025
@eregon Let me know if there's additional work needed here. Whenever this goes live, we can start unpinning jruby-head builds from 9.4. |
One idea given https://github.com/eregon/actions-shell/actions/runs/13798182243/job/38594765309#step:4:5 would be to only set it if You could get the Java version from |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
headius
commented
Mar 11, 2025
Detecting the existing JAVA_HOME version is problematic; we'll have to parse the output of either |
eregon
commented
Mar 11, 2025
Could you add the check with |
headius
commented
Mar 11, 2025
I believe a more robust option is to run JRuby and only update JAVA_HOME if it fails. |
eregon
commented
Mar 11, 2025
Is parsing the output of We could match the first line there, e.g. by matching the first number ( Using |
eregon
commented
Mar 11, 2025
Feel free to try it, e.g. in another PR. |
headius
commented
Mar 11, 2025
Parsing version output will be subject to any changes that might happen in the future, and won't parse right if it's not OpenJDK (OpenJ9 has a different -version output for example). Simply attempting to run |
headius
commented
Mar 11, 2025
Not sure why the exec call is producing that error. I am not familiar with how async/await or this exec module work and tried to mimic the other call I saw. |
headius
commented
Mar 11, 2025
The new logic is working (update only if |
eregon
left a comment
There was a problem hiding this comment.
This looks good, just a few more tweaks and it should be ready to be merged.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
eregon
commented
Mar 12, 2025
Yes, I think there is no way to know until we get a JRuby 10 build, i.e. when we switch jruby-dev-builder to use master. |
headius
commented
Mar 12, 2025
Changes from latest review are in and green. |
| const core = require('@actions/core') | ||
| const tc = require('@actions/tool-cache') | ||
| const exec = require('@actions/exec') | ||
| const common = require('./common') |
There was a problem hiding this comment.
This is a require of this file, it seems safer to avoid it, as I guess it might cause some weird stuff.
I'll fix it.
eregon
commented
Mar 12, 2025
There is some weird output e.g. in https://github.com/ruby/setup-ruby/actions/runs/13817559138/job/38654730800?pr=721#step:3:18 i.e. as if The raw log gives: So these two steps seem to interleave somehow, maybe a missing |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
eregon
commented
Mar 12, 2025
FWIW the first But, we do So not a big increase in overall time. |
headius
commented
Mar 12, 2025
That first invocation is likely slow just because the JVM itself has to be paged in. I'll contemplate how to do this check more quickly in the future. Thank you for the assistance. |
JRuby 10 requires Java 21. Since the previous default was 17 and all JRuby releases should work fine on 21, we do this for all JRuby installs.
Implements #718