Skip to content

Commit

Permalink
Use actions/setup-java to install graalvm
Browse files Browse the repository at this point in the history
Since v4.4.0 graalvm can be installed using setup-java https://github.com/actions/setup-java/releases/tag/v4.4.0
(for legacy versions setup-graalvm is still needed)

Not sure if we need to expose these additional distributions:
https://github.com/actions/setup-java/releases/tag/v4.3.0 supports SapMachine
https://github.com/actions/setup-java/releases/tag/v3.13.0 supports Dragonwell
  • Loading branch information
mzuehlke committed Oct 10, 2024
1 parent 044308e commit 77691ae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
- name: Setup Java (graalvm@17)
id: setup-java-graalvm-17
if: matrix.java == 'graalvm@17'
uses: graalvm/setup-graalvm@v1
uses: actions/setup-java@v4
with:
distribution: graalvm
java-version: 17
Expand Down Expand Up @@ -318,7 +318,7 @@ jobs:
- name: Setup Java (graalvm@17)
id: setup-java-graalvm-17
if: matrix.java == 'graalvm@17'
uses: graalvm/setup-graalvm@v1
uses: actions/setup-java@v4
with:
distribution: graalvm
java-version: 17
Expand Down Expand Up @@ -464,7 +464,7 @@ jobs:
- name: Setup Java (graalvm@17)
id: setup-java-graalvm-17
if: matrix.java == 'graalvm@17'
uses: graalvm/setup-graalvm@v1
uses: actions/setup-java@v4
with:
distribution: graalvm
java-version: 17
Expand Down Expand Up @@ -606,7 +606,7 @@ jobs:
- name: Setup Java (graalvm@17)
id: setup-java-graalvm-17
if: matrix.java == 'graalvm@17'
uses: graalvm/setup-graalvm@v1
uses: actions/setup-java@v4
with:
distribution: graalvm
java-version: 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ object JavaSpec {
def oracle(version: String): JavaSpec = JavaSpec(Distribution.Oracle, version)
def semeru(version: String): JavaSpec = JavaSpec(Distribution.Semeru, version)
def microsoft(version: String): JavaSpec = JavaSpec(Distribution.Microsoft, version)
def dragonwell(version: String): JavaSpec = JavaSpec(Distribution.Dragonwell, version)
def sapmachine(version: String): JavaSpec = JavaSpec(Distribution.SapMachine, version)

sealed abstract class Distribution(val rendering: String) extends Product with Serializable

Expand All @@ -48,5 +50,7 @@ object JavaSpec {
case object GraalVM extends Distribution("graalvm")
case object Semeru extends Distribution("semeru")
case object Microsoft extends Distribution("microsoft")
case object Dragonwell extends Distribution("dragonwell")
case object SapMachine extends Distribution("sapmachine")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,14 @@ object WorkflowStep {
))
else Nil

val SetupJavaAction = UseRef.Public("actions", "setup-java", "v4")
val SetupGraalVMAction = UseRef.Public("graalvm", "setup-graalvm", "v1")
val sbtCacheParams = if (enableCaching) Map("cache" -> "sbt") else Map.empty

versions flatMap {
case jv @ JavaSpec(JavaSpec.Distribution.GraalVM(graalVersion), javaVersion) =>
val setupId = s"setup-graalvm-${graalVersion}-$javaVersion".replace('.', '_')
val cond = s"matrix.java == '${jv.render}'"
WorkflowStep.Use(
SetupGraalVMAction,
UseRef.Public("graalvm", "setup-graalvm", "v1"),
name = Some(s"Setup GraalVM (${jv.render})"),
id = Some(setupId),
cond = Some(cond),
Expand All @@ -78,7 +76,7 @@ object WorkflowStep {
val cond = s"matrix.java == '${jv.render}'"

WorkflowStep.Use(
if (dist == JavaSpec.Distribution.GraalVM) SetupGraalVMAction else SetupJavaAction,
UseRef.Public("actions", "setup-java", "v4"),
name = Some(s"Setup Java (${jv.render})"),
id = Some(setupId),
cond = Some(cond),
Expand Down

0 comments on commit 77691ae

Please sign in to comment.