Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install sbt via brew on macOS runners #681

Merged
merged 5 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ jobs:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os:
- ubuntu-latest
- macos-latest
- macos-14
- windows-latest
scala: [2.12]
java:
- temurin@8
Expand All @@ -55,6 +59,8 @@ jobs:
exclude:
- java: temurin@11
os: macos-latest
- java: temurin@11
os: macos-14
- java: temurin@11
os: windows-latest
- java: temurin@17
Expand All @@ -63,23 +69,38 @@ jobs:
os: windows-latest
- java: graal_22.3.2@11
os: macos-latest
- java: graal_22.3.2@11
os: macos-14
- java: graal_22.3.2@11
os: windows-latest
- java: graalvm@17
os: macos-latest
- java: graalvm@17
os: macos-14
- java: graalvm@17
os: windows-latest
- java: corretto@17
os: macos-latest
- java: corretto@17
os: macos-14
- java: corretto@17
os: windows-latest
- java: semeru@17
os: macos-latest
- java: semeru@17
os: macos-14
- java: semeru@17
os: windows-latest
- java: temurin@8
os: macos-14
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
shell: bash
run: brew install sbt

- name: Ignore line ending differences in git
if: contains(runner.os, 'windows')
shell: bash
Expand Down Expand Up @@ -244,6 +265,10 @@ jobs:
runs-on: ${{ matrix.os }}
timeout-minutes: 45
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt

- name: Ignore line ending differences in git
if: contains(runner.os, 'windows')
run: git config --global core.autocrlf false
Expand Down Expand Up @@ -387,6 +412,10 @@ jobs:
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt

- name: Ignore line ending differences in git
if: contains(runner.os, 'windows')
run: git config --global core.autocrlf false
Expand Down Expand Up @@ -526,6 +555,10 @@ jobs:
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt

- name: Ignore line ending differences in git
if: contains(runner.os, 'windows')
run: git config --global core.autocrlf false
Expand Down
1 change: 1 addition & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pull_request_rules:
- status-success=Build and Test (ubuntu-latest, 2.12, corretto@17, sbt-typelevelJVM)
- status-success=Build and Test (ubuntu-latest, 2.12, semeru@17, sbt-typelevelJVM)
- status-success=Build and Test (macos-latest, 2.12, temurin@8, sbt-typelevelJVM)
- status-success=Build and Test (macos-14, 2.12, temurin@17, sbt-typelevelJVM)
- status-success=Build and Test (windows-latest, 2.12, temurin@8, sbt-typelevelJVM)
- status-success=Validate Steward Config (ubuntu-latest, temurin@11)
- status-success=Generate Site (ubuntu-latest, temurin@11)
Expand Down
14 changes: 11 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,30 @@ ThisBuild / developers ++= List(
)
ThisBuild / startYear := Some(2022)

val temurin8 = JavaSpec.temurin("8")
val temurin17 = JavaSpec.temurin("17")

ThisBuild / githubWorkflowJavaVersions ++= Seq(
JavaSpec.temurin("11"),
JavaSpec.temurin("17"),
temurin17,
JavaSpec(JavaSpec.Distribution.GraalVM("22.3.2"), "11"),
JavaSpec.graalvm("17"),
JavaSpec.corretto("17"),
JavaSpec.semeru("17")
)

ThisBuild / githubWorkflowOSes ++= Seq("macos-latest", "windows-latest")
val macos14 = "macos-14"

ThisBuild / githubWorkflowOSes ++= Seq("macos-latest", macos14, "windows-latest")

ThisBuild / githubWorkflowBuildMatrixExclusions ++= {
for {
val exclusions = for {
java <- githubWorkflowJavaVersions.value.tail
os <- githubWorkflowOSes.value.tail
if !(java == temurin17 && os == macos14) // keep this one
} yield MatrixExclude(Map("java" -> java.render, "os" -> os))

exclusions :+ MatrixExclude(Map("java" -> temurin8.render, "os" -> macos14))
}

ThisBuild / githubWorkflowPublishTimeoutMinutes := Some(45)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}
private lazy val internalTargetAggregation =
settingKey[Seq[File]]("Aggregates target directories from all subprojects")

private val macosGuard = Some("contains(runner.os, 'macos')")
private val windowsGuard = Some("contains(runner.os, 'windows')")

private val PlatformSep = FileSystems.getDefault.getSeparator
Expand Down Expand Up @@ -775,6 +776,14 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}
},
githubWorkflowGeneratedCacheSteps := Seq(),
githubWorkflowJobSetup := {
val brewInstallSbtOpt = if (githubWorkflowOSes.value.exists(_.contains("macos"))) {
List(
WorkflowStep
.Run(List("brew install sbt"), name = Some("Install sbt"), cond = macosGuard))
} else {
Nil
}

val autoCrlfOpt = if (githubWorkflowOSes.value.exists(_.contains("windows"))) {
List(
WorkflowStep.Run(
Expand All @@ -785,7 +794,8 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}
Nil
}

autoCrlfOpt :::
brewInstallSbtOpt :::
autoCrlfOpt :::
List(WorkflowStep.CheckoutFull) :::
WorkflowStep.SetupJava(githubWorkflowJavaVersions.value.toList) :::
githubWorkflowGeneratedCacheSteps.value.toList
Expand Down
Loading