Skip to content

Commit

Permalink
Merge pull request #187 from eed3si9n/wip/arm
Browse files Browse the repository at this point in the history
Add sbt/setup-sbt to install sbt + default to zulu@8
  • Loading branch information
eed3si9n authored Jun 23, 2024
2 parents 36e6a87 + af45d8f commit 636423b
Show file tree
Hide file tree
Showing 13 changed files with 133 additions and 78 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
scala: [2.12.18]
java: [temurin@8, graal_graalvm@17, corretto@17]
java: [zulu@8, graal_graalvm@17, corretto@17]
runs-on: ${{ matrix.os }}
steps:
- name: Ignore line ending differences in git
Expand All @@ -45,11 +45,11 @@ jobs:
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
- name: Setup Java (zulu@8)
if: matrix.java == 'zulu@8'
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: zulu
java-version: 8
cache: sbt

Expand All @@ -71,6 +71,9 @@ jobs:
java-version: 17
cache: sbt

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Check that workflows are up to date
shell: bash
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
Expand All @@ -96,7 +99,7 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.12.18]
java: [temurin@8]
java: [zulu@8]
runs-on: ${{ matrix.os }}
steps:
- name: Ignore line ending differences in git
Expand All @@ -116,11 +119,11 @@ jobs:
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
- name: Setup Java (zulu@8)
if: matrix.java == 'zulu@8'
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: zulu
java-version: 8
cache: sbt

Expand All @@ -142,6 +145,9 @@ jobs:
java-version: 17
cache: sbt

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Download target directories (2.12.18)
uses: actions/download-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/sbtghactions/GenerativeKeys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ trait GenerativeKeys {
lazy val githubWorkflowPublishCond = settingKey[Option[String]]("A set of conditionals to apply to the publish job to further restrict its run (default: [])")
lazy val githubWorkflowPublishTimeout = settingKey[Option[FiniteDuration]]("The maximum duration to let the publish job run before GitHub automatically cancels it. (default: None)")

lazy val githubWorkflowJavaVersions = settingKey[Seq[JavaSpec]]("A list of Java versions to be used for the build job. The publish job will use the *first* of these versions. (default: [temurin@8])")
lazy val githubWorkflowJavaVersions = settingKey[Seq[JavaSpec]]("A list of Java versions to be used for the build job. The publish job will use the *first* of these versions. (default: [zulu@8])")
lazy val githubWorkflowScalaVersions = settingKey[Seq[String]]("A list of Scala versions on which to build the project (default: crossScalaVersions.value)")
lazy val githubWorkflowOSes = settingKey[Seq[String]]("A list of OS names (default: [ubuntu-latest])")

Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/sbtghactions/GenerativePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}
githubWorkflowPublishCond := None,
githubWorkflowPublishTimeout := None,

githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8")),
githubWorkflowJavaVersions := Seq(JavaSpec.zulu("8")),
githubWorkflowScalaVersions := crossScalaVersions.value,
githubWorkflowOSes := Seq("ubuntu-latest"),
githubWorkflowDependencyPatterns := Seq("**/*.sbt", "project/build.properties"),
Expand Down Expand Up @@ -710,6 +710,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}
autoCrlfOpt :::
List(WorkflowStep.CheckoutFull) :::
WorkflowStep.SetupJava(githubWorkflowJavaVersions.value.toList) :::
List(WorkflowStep.SetupSbt()) :::
githubWorkflowGeneratedCacheSteps.value.toList
},

Expand Down
2 changes: 2 additions & 0 deletions src/main/scala/sbtghactions/JavaSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ object JavaSpec {

def temurin(version: String): JavaSpec = JavaSpec(Distribution.Temurin, version)

def zulu(version: String): JavaSpec = JavaSpec(Distribution.Zulu, version)

def corretto(version: String): JavaSpec = JavaSpec(Distribution.Corretto, version)

private[sbtghactions] object JavaVersionExtractor {
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/sbtghactions/WorkflowJob.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final case class WorkflowJob(
env: Map[String, String] = Map(),
oses: List[String] = List("ubuntu-latest"),
scalas: List[String] = List("2.13.10"),
javas: List[JavaSpec] = List(JavaSpec.temurin("8")),
javas: List[JavaSpec] = List(JavaSpec.zulu("8")),
needs: List[String] = List(),
matrixFailFast: Option[Boolean] = None,
matrixAdds: Map[String, List[String]] = Map(),
Expand Down
10 changes: 10 additions & 0 deletions src/main/scala/sbtghactions/WorkflowStep.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ object WorkflowStep {
"cache" -> "sbt"))
}

def SetupSbt(runnerVersion: Option[String] = None): WorkflowStep =
Use(
ref = UseRef.Public("sbt", "setup-sbt", "v1"),
params = runnerVersion match {
case Some(v) => Map("sbt-runner-version" -> v)
case None => Map()
},
name = Some("Setup sbt"),
)

val Tmate: WorkflowStep = Use(UseRef.Public("mxschmitt", "action-tmate", "v2"), name = Some("Setup tmate session"))

def ComputeVar(name: String, cmd: String): WorkflowStep =
Expand Down
22 changes: 14 additions & 8 deletions src/sbt-test/sbtghactions/check-and-regenerate/expected-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.13.10, 2.12.17]
java: [temurin@8, graal_22.3.0@17]
java: [zulu@8, graal_22.3.0@17]
test: [this, is]
include:
- test: this
Expand All @@ -41,11 +41,11 @@ jobs:
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
- name: Setup Java (zulu@8)
if: matrix.java == 'zulu@8'
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: zulu
java-version: 8
cache: sbt

Expand All @@ -59,6 +59,9 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: sbt

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Check that workflows are up to date
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck

Expand All @@ -84,7 +87,7 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [temurin@8]
java: [zulu@8]
runs-on: ${{ matrix.os }}
timeout-minutes: 60

Expand All @@ -94,11 +97,11 @@ jobs:
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
- name: Setup Java (zulu@8)
if: matrix.java == 'zulu@8'
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: zulu
java-version: 8
cache: sbt

Expand All @@ -112,6 +115,9 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: sbt

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Download target directories (2.13.10)
uses: actions/download-artifact@v4
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
matrix:
os: [windows-latest]
scala: [2.13.10, 2.12.17]
java: [temurin@8]
java: [zulu@8]
runs-on: ${{ matrix.os }}
steps:
- name: Ignore line ending differences in git
Expand All @@ -44,14 +44,17 @@ jobs:
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
- name: Setup Java (zulu@8)
if: matrix.java == 'zulu@8'
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: zulu
java-version: 8
cache: sbt

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Check that workflows are up to date
shell: bash
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
Expand All @@ -78,7 +81,7 @@ jobs:
matrix:
os: [windows-latest]
scala: [2.13.10]
java: [temurin@8]
java: [zulu@8]
runs-on: ${{ matrix.os }}
steps:
- name: Ignore line ending differences in git
Expand All @@ -99,14 +102,17 @@ jobs:
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
- name: Setup Java (zulu@8)
if: matrix.java == 'zulu@8'
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: zulu
java-version: 8
cache: sbt

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Download target directories (2.13.10)
uses: actions/download-artifact@v4
with:
Expand Down
22 changes: 14 additions & 8 deletions src/sbt-test/sbtghactions/no-clean/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,25 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.13.10, 2.12.17]
java: [temurin@8]
java: [zulu@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
- name: Setup Java (zulu@8)
if: matrix.java == 'zulu@8'
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: zulu
java-version: 8
cache: sbt

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Check that workflows are up to date
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck

Expand All @@ -62,22 +65,25 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [temurin@8]
java: [zulu@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
- name: Setup Java (zulu@8)
if: matrix.java == 'zulu@8'
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: zulu
java-version: 8
cache: sbt

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Download target directories (2.13.10)
uses: actions/download-artifact@v4
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,25 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [temurin@8]
java: [zulu@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
- name: Setup Java (zulu@8)
if: matrix.java == 'zulu@8'
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: zulu
java-version: 8
cache: sbt

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Check that workflows are up to date
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck

Expand All @@ -61,22 +64,25 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [temurin@8]
java: [zulu@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
- name: Setup Java (zulu@8)
if: matrix.java == 'zulu@8'
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: zulu
java-version: 8
cache: sbt

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Download target directories (2.13.10)
uses: actions/download-artifact@v4
with:
Expand Down
Loading

0 comments on commit 636423b

Please sign in to comment.