From 22ad46779234a05f0aa11dd670aec77cdc797bed Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 22 Feb 2024 03:24:14 +0000 Subject: [PATCH 1/5] Install sbt via brew on macos runners --- .github/workflows/ci.yml | 35 ++++++++++++++++++- .mergify.yml | 1 + build.sbt | 2 +- .../typelevel/sbt/gha/GenerativePlugin.scala | 10 ++++++ 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77754f34..86af0ea2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -55,26 +59,38 @@ jobs: exclude: - java: temurin@11 os: macos-latest + - java: temurin@11 + os: macos-14 - java: temurin@11 os: windows-latest - java: temurin@17 os: macos-latest + - java: temurin@17 + os: macos-14 - java: temurin@17 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 runs-on: ${{ matrix.os }} @@ -85,6 +101,11 @@ jobs: shell: bash run: git config --global core.autocrlf false + - name: Install sbt + if: contains(runner.os, 'macos') + shell: bash + run: brew install sbt + - name: Checkout current branch (full) uses: actions/checkout@v4 with: @@ -248,6 +269,10 @@ jobs: if: contains(runner.os, 'windows') run: git config --global core.autocrlf false + - name: Install sbt + if: contains(runner.os, 'macos') + run: brew install sbt + - name: Checkout current branch (full) uses: actions/checkout@v4 with: @@ -391,6 +416,10 @@ jobs: if: contains(runner.os, 'windows') run: git config --global core.autocrlf false + - name: Install sbt + if: contains(runner.os, 'macos') + run: brew install sbt + - name: Checkout current branch (full) uses: actions/checkout@v4 with: @@ -530,6 +559,10 @@ jobs: if: contains(runner.os, 'windows') run: git config --global core.autocrlf false + - name: Install sbt + if: contains(runner.os, 'macos') + run: brew install sbt + - name: Checkout current branch (full) uses: actions/checkout@v4 with: diff --git a/.mergify.yml b/.mergify.yml index db3438bc..5f46f9c5 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -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@8, 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) diff --git a/build.sbt b/build.sbt index 7a74814c..00cb5163 100644 --- a/build.sbt +++ b/build.sbt @@ -21,7 +21,7 @@ ThisBuild / githubWorkflowJavaVersions ++= Seq( JavaSpec.semeru("17") ) -ThisBuild / githubWorkflowOSes ++= Seq("macos-latest", "windows-latest") +ThisBuild / githubWorkflowOSes ++= Seq("macos-latest", "macos-14", "windows-latest") ThisBuild / githubWorkflowBuildMatrixExclusions ++= { for { diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index 7d577ade..5115cd51 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -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 @@ -785,7 +786,16 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} Nil } + val brewInstallSbtOpt = if (githubWorkflowOSes.value.exists(_.contains("macos"))) { + List( + WorkflowStep + .Run(List("brew install sbt"), name = Some("Install sbt"), cond = macosGuard)) + } else { + Nil + } + autoCrlfOpt ::: + brewInstallSbtOpt ::: List(WorkflowStep.CheckoutFull) ::: WorkflowStep.SetupJava(githubWorkflowJavaVersions.value.toList) ::: githubWorkflowGeneratedCacheSteps.value.toList From b63356edbabb51fa4aa41613eff37a1a02800935 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 22 Feb 2024 03:26:06 +0000 Subject: [PATCH 2/5] Tweak ordering of install step --- .github/workflows/ci.yml | 17 ++++++++++++++++ .../typelevel/sbt/gha/GenerativePlugin.scala | 20 +++++++++---------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86af0ea2..5a436978 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,6 +96,11 @@ jobs: 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 @@ -265,6 +270,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 @@ -412,6 +421,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 @@ -555,6 +568,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 diff --git a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala index 5115cd51..c27b9dff 100644 --- a/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala +++ b/github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala @@ -776,26 +776,26 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} }, githubWorkflowGeneratedCacheSteps := Seq(), githubWorkflowJobSetup := { - val autoCrlfOpt = if (githubWorkflowOSes.value.exists(_.contains("windows"))) { + val brewInstallSbtOpt = if (githubWorkflowOSes.value.exists(_.contains("macos"))) { List( - WorkflowStep.Run( - List("git config --global core.autocrlf false"), - name = Some("Ignore line ending differences in git"), - cond = windowsGuard)) + WorkflowStep + .Run(List("brew install sbt"), name = Some("Install sbt"), cond = macosGuard)) } else { Nil } - val brewInstallSbtOpt = if (githubWorkflowOSes.value.exists(_.contains("macos"))) { + val autoCrlfOpt = if (githubWorkflowOSes.value.exists(_.contains("windows"))) { List( - WorkflowStep - .Run(List("brew install sbt"), name = Some("Install sbt"), cond = macosGuard)) + WorkflowStep.Run( + List("git config --global core.autocrlf false"), + name = Some("Ignore line ending differences in git"), + cond = windowsGuard)) } else { Nil } - autoCrlfOpt ::: - brewInstallSbtOpt ::: + brewInstallSbtOpt ::: + autoCrlfOpt ::: List(WorkflowStep.CheckoutFull) ::: WorkflowStep.SetupJava(githubWorkflowJavaVersions.value.toList) ::: githubWorkflowGeneratedCacheSteps.value.toList From ff65f4d151b270b661dae6f9f6ebfc8426b42ec0 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 22 Feb 2024 04:07:36 +0000 Subject: [PATCH 3/5] Tweak exclusions --- .github/workflows/ci.yml | 18 ++---------------- .mergify.yml | 9 ++++++++- build.sbt | 14 +++++++++++--- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a436978..f20a421a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,40 +59,26 @@ jobs: exclude: - java: temurin@11 os: macos-latest - - java: temurin@11 - os: macos-14 - java: temurin@11 os: windows-latest - - java: temurin@17 - os: macos-latest - - java: temurin@17 - os: macos-14 - - java: temurin@17 - 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: diff --git a/.mergify.yml b/.mergify.yml index 5f46f9c5..1ef76a10 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -20,8 +20,15 @@ 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@8, sbt-typelevelJVM) + - status-success=Build and Test (macos-latest, 2.12, temurin@17, sbt-typelevelJVM) + - status-success=Build and Test (macos-14, 2.12, temurin@11, sbt-typelevelJVM) + - status-success=Build and Test (macos-14, 2.12, temurin@17, sbt-typelevelJVM) + - status-success=Build and Test (macos-14, 2.12, graal_22.3.2@11, sbt-typelevelJVM) + - status-success=Build and Test (macos-14, 2.12, graalvm@17, sbt-typelevelJVM) + - status-success=Build and Test (macos-14, 2.12, corretto@17, sbt-typelevelJVM) + - status-success=Build and Test (macos-14, 2.12, semeru@17, sbt-typelevelJVM) - status-success=Build and Test (windows-latest, 2.12, temurin@8, sbt-typelevelJVM) + - status-success=Build and Test (windows-latest, 2.12, temurin@17, sbt-typelevelJVM) - status-success=Validate Steward Config (ubuntu-latest, temurin@11) - status-success=Generate Site (ubuntu-latest, temurin@11) - '#approved-reviews-by>=1' diff --git a/build.sbt b/build.sbt index 00cb5163..de312c23 100644 --- a/build.sbt +++ b/build.sbt @@ -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", "macos-14", "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) From 87fc104590ea9a9a464829b4d9c471a8fcbb2394 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 22 Feb 2024 04:12:53 +0000 Subject: [PATCH 4/5] Regenerate workflow --- .github/workflows/ci.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f20a421a..4e49a851 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,11 +92,6 @@ jobs: shell: bash run: git config --global core.autocrlf false - - name: Install sbt - if: contains(runner.os, 'macos') - shell: bash - run: brew install sbt - - name: Checkout current branch (full) uses: actions/checkout@v4 with: @@ -264,10 +259,6 @@ jobs: if: contains(runner.os, 'windows') run: git config --global core.autocrlf false - - name: Install sbt - if: contains(runner.os, 'macos') - run: brew install sbt - - name: Checkout current branch (full) uses: actions/checkout@v4 with: @@ -415,10 +406,6 @@ jobs: if: contains(runner.os, 'windows') run: git config --global core.autocrlf false - - name: Install sbt - if: contains(runner.os, 'macos') - run: brew install sbt - - name: Checkout current branch (full) uses: actions/checkout@v4 with: @@ -562,10 +549,6 @@ jobs: if: contains(runner.os, 'windows') run: git config --global core.autocrlf false - - name: Install sbt - if: contains(runner.os, 'macos') - run: brew install sbt - - name: Checkout current branch (full) uses: actions/checkout@v4 with: From 37ac7fe4ffba1e30ceaf98a870c244f4ab9cbf01 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 22 Feb 2024 04:31:29 +0000 Subject: [PATCH 5/5] Fix excludes --- .github/workflows/ci.yml | 14 ++++++++++++++ .mergify.yml | 7 ------- build.sbt | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e49a851..971bf787 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,21 +60,35 @@ jobs: - java: temurin@11 os: macos-latest - java: temurin@11 + os: macos-14 + - java: temurin@11 + os: windows-latest + - java: temurin@17 + os: macos-latest + - java: temurin@17 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 diff --git a/.mergify.yml b/.mergify.yml index 1ef76a10..6bba5ca4 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -20,15 +20,8 @@ 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-latest, 2.12, temurin@17, sbt-typelevelJVM) - - status-success=Build and Test (macos-14, 2.12, temurin@11, sbt-typelevelJVM) - status-success=Build and Test (macos-14, 2.12, temurin@17, sbt-typelevelJVM) - - status-success=Build and Test (macos-14, 2.12, graal_22.3.2@11, sbt-typelevelJVM) - - status-success=Build and Test (macos-14, 2.12, graalvm@17, sbt-typelevelJVM) - - status-success=Build and Test (macos-14, 2.12, corretto@17, sbt-typelevelJVM) - - status-success=Build and Test (macos-14, 2.12, semeru@17, sbt-typelevelJVM) - status-success=Build and Test (windows-latest, 2.12, temurin@8, sbt-typelevelJVM) - - status-success=Build and Test (windows-latest, 2.12, temurin@17, sbt-typelevelJVM) - status-success=Validate Steward Config (ubuntu-latest, temurin@11) - status-success=Generate Site (ubuntu-latest, temurin@11) - '#approved-reviews-by>=1' diff --git a/build.sbt b/build.sbt index de312c23..39a7570f 100644 --- a/build.sbt +++ b/build.sbt @@ -32,7 +32,7 @@ ThisBuild / githubWorkflowBuildMatrixExclusions ++= { val exclusions = for { java <- githubWorkflowJavaVersions.value.tail os <- githubWorkflowOSes.value.tail - if java != temurin17 && os != macos14 // keep this one + if !(java == temurin17 && os == macos14) // keep this one } yield MatrixExclude(Map("java" -> java.render, "os" -> os)) exclusions :+ MatrixExclude(Map("java" -> temurin8.render, "os" -> macos14))