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

Migrate to sbt-typelevel #2857

Merged
merged 18 commits into from
Apr 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
83 changes: 60 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ on:
branches: [series/3.*]
push:
branches: [series/3.*]
tags: [v*]

env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I guess these are baked in a little too hard :) anyway should be harmless.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bleh. :-) I'd definitely like to see these cleaned up, but it's kind of okay for now.

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JABBA_INDEX: 'https://github.com/typelevel/jdk-index/raw/main/index.json'

jobs:
build:
Expand All @@ -24,25 +29,21 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
scala: [3.0.2, 2.12.15, 2.13.7]
java:
- temurin@8
- temurin@11
- temurin@17
- graal_21.3.0@11
java: [temurin@8, temurin@11, temurin@17, graalvm@11]
ci: [ciJVM, ciJS, ciFirefox, ciChrome]
exclude:
- scala: 3.0.2
java: temurin@11
- scala: 3.0.2
java: temurin@17
- scala: 3.0.2
java: graal_21.3.0@11
java: graalvm@11
- scala: 2.12.15
java: temurin@11
- scala: 2.12.15
java: temurin@17
- scala: 2.12.15
java: graal_21.3.0@11
java: graalvm@11
- os: windows-latest
scala: 3.0.2
- os: macos-latest
Expand All @@ -64,7 +65,7 @@ jobs:
- ci: ciJS
java: temurin@17
- ci: ciJS
java: graal_21.3.0@11
java: graalvm@11
- os: windows-latest
ci: ciJS
- os: macos-latest
Expand All @@ -74,7 +75,7 @@ jobs:
- ci: ciFirefox
java: temurin@17
- ci: ciFirefox
java: graal_21.3.0@11
java: graalvm@11
- os: windows-latest
ci: ciFirefox
- os: macos-latest
Expand All @@ -84,13 +85,13 @@ jobs:
- ci: ciChrome
java: temurin@17
- ci: ciChrome
java: graal_21.3.0@11
java: graalvm@11
- os: windows-latest
ci: ciChrome
- os: macos-latest
ci: ciChrome
- os: windows-latest
java: graal_21.3.0@11
java: graalvm@11
runs-on: ${{ matrix.os }}
steps:
- name: Ignore line ending differences in git
Expand All @@ -103,33 +104,69 @@ jobs:
with:
fetch-depth: 0

- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 8

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
with:
distribution: temurin
distribution: jdkfile
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}

- name: Download Java (temurin@11)
id: download-java-temurin-11
if: matrix.java == 'temurin@11'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 11

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
with:
distribution: temurin
distribution: jdkfile
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}

- name: Download Java (temurin@17)
id: download-java-temurin-17
if: matrix.java == 'temurin@17'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 17

- name: Setup Java (temurin@17)
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v2
with:
distribution: temurin
distribution: jdkfile
java-version: 17
jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }}

- name: Setup GraalVM (graal_21.3.0@11)
if: matrix.java == 'graal_21.3.0@11'
uses: DeLaGuardo/setup-graalvm@5.0
- name: Download Java (graalvm@11)
id: download-java-graalvm-11
if: matrix.java == 'graalvm@11'
uses: typelevel/download-java@v1
with:
graalvm: 21.3.0
java: java11
distribution: graalvm
java-version: 11

- name: Setup Java (graalvm@11)
if: matrix.java == 'graalvm@11'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 11
jdkFile: ${{ steps.download-java-graalvm-11.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
Expand All @@ -156,14 +193,14 @@ jobs:

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

- shell: bash
run: sbt ++${{ matrix.scala }} '${{ matrix.ci }}'
run: sbt '++${{ matrix.scala }}' '${{ matrix.ci }}'

- if: (matrix.scala == '2.13.7' || matrix.scala == '3.0.2') && matrix.ci == 'ciJVM'
shell: bash
run: sbt ++${{ matrix.scala }} docs/mdoc
run: sbt '++${{ matrix.scala }}' docs/mdoc

- name: Test Example JVM App Within Sbt
if: matrix.ci == 'ciJVM' && matrix.os == 'ubuntu-latest'
Expand Down
15 changes: 7 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ import sbtcrossproject.CrossProject

import JSEnv._

ThisBuild / baseVersion := "3.3"
ThisBuild / tlBaseVersion := "3.3"

ThisBuild / organization := "org.typelevel"
ThisBuild / organizationName := "Typelevel"

ThisBuild / startYear := Some(2020)
ThisBuild / endYear := Some(2022)

ThisBuild / developers := List(
Developer(
Expand Down Expand Up @@ -101,17 +100,17 @@ val Scala3 = "3.0.2"

ThisBuild / crossScalaVersions := Seq(Scala3, "2.12.15", Scala213)

ThisBuild / githubWorkflowUseSbtThinClient := false
ThisBuild / githubWorkflowTargetBranches := Seq("series/3.*")
ThisBuild / tlCiReleaseTags := false
ThisBuild / tlCiReleaseBranches := Nil

val OldGuardJava = JavaSpec.temurin("8")
val LTSJava = JavaSpec.temurin("11")
val LatestJava = JavaSpec.temurin("17")
val ScalaJSJava = OldGuardJava
val GraalVM = JavaSpec.graalvm("21.3.0", "11")
val GraalVM = JavaSpec.graalvm("11")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the Graal version not specified. This feels a little weird in general since it suggests that the GraalVM version would be either unstable or unconfigurable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can revert this. Most people probably want the latest Graal and not a specific version (which is easy to forget to update, as we've forgotten to here :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw @vasilmkd what are your thoughts on this topic, maybe we need to revise the JDK index to support this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were already on latest, I was doing it manually. Graalvm also follows the JDK release cycle, so as soon as the latest drops, the previous one is obsolete and unsupported. I don't want to sound dismissive, but I'm not interested in changing the index to support old versions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the latest in the index is 22.0.0.2 and CE is on 21.3.0, so we've fallen behind again (at least on this branch).

Ok @djspiewak your call, how do you want to configure this for CE?

version would be either unstable

It depends on what you are targeting. If you are targeting JDK whatever then shouldn't it be as stable as any of the other JVMs?

OTOH, if you are targeting specific GraalVM APIs then obviously it makes a difference. Actually I have a project like this.

FTR I didn't remove the ability to configure a specific GraalVM (it still shells out to DeLaGuardo/setup-graalvm like you set it up) although it is now a little more "discouraged" because I expect 99% of projects don't actually want this.

Finally, if you truly want stability, you should really pin the JDK index to a particular hash anyway :)


ThisBuild / githubWorkflowJavaVersions := Seq(OldGuardJava, LTSJava, LatestJava, GraalVM)
ThisBuild / githubWorkflowEnv += ("JABBA_INDEX" -> "https://github.com/typelevel/jdk-index/raw/main/index.json")
ThisBuild / githubWorkflowOSes := Seq(PrimaryOS, Windows, MacOS)

ThisBuild / githubWorkflowBuildPreamble ++= Seq(
Expand Down Expand Up @@ -156,7 +155,7 @@ val ciVariants = CI.AllCIs.map(_.command)
val jsCiVariants = CI.AllJSCIs.map(_.command)
ThisBuild / githubWorkflowBuildMatrixAdditions += "ci" -> ciVariants

ThisBuild / githubWorkflowBuildMatrixExclusions ++= {
ThisBuild / githubWorkflowBuildMatrixExclusions := {
Comment on lines -159 to +173
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sbt-typelevel already does some of these exclusions for us. Rather than tease apart what's been upstreamed we'll just keep using our own.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shoudl try to inherit more in the future, but this is a fine start.

val scalaJavaFilters = for {
scala <- (ThisBuild / githubWorkflowScalaVersions).value.filterNot(Set(Scala213))
java <- (ThisBuild / githubWorkflowJavaVersions).value.filterNot(Set(OldGuardJava))
Expand Down Expand Up @@ -234,7 +233,7 @@ val CoopVersion = "1.1.1"

val MacrotaskExecutorVersion = "1.0.0"

replaceCommandAlias("ci", CI.AllCIs.map(_.toString).mkString)
tlReplaceCommandAlias("ci", CI.AllCIs.map(_.toString).mkString)

addCommandAlias(CI.JVM.command, CI.JVM.toString)
addCommandAlias(CI.JS.command, CI.JS.toString)
Expand Down Expand Up @@ -456,7 +455,7 @@ lazy val core = crossProject(JSPlatform, JVMPlatform)
// changes to `cats.effect.unsafe` package private code
ProblemFilters.exclude[MissingClassProblem]("cats.effect.unsafe.SynchronizedWeakBag")
) ++ {
if (isDotty.value) {
if (tlIsScala3.value) {
// Scala 3 specific exclusions
Seq(
// introduced by #2769, Simplify the transfer of WorkerThread data structures when blocking
Expand Down
14 changes: 6 additions & 8 deletions project/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,18 @@

import sbt._, Keys._

import sbtspiewak.SpiewakPlugin, SpiewakPlugin.autoImport._
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._
import org.typelevel.sbt.TypelevelPlugin

object Common extends AutoPlugin {

override def requires = plugins.JvmPlugin && SpiewakPlugin
override def requires = plugins.JvmPlugin && TypelevelPlugin
override def trigger = allRequirements

override def projectSettings =
Seq(
libraryDependencies ++= {
if (isDotty.value)
Nil
else
Seq(compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1"))
}
headerLicense := Some(
HeaderLicense.ALv2(s"${startYear.value.get}-2022", organizationName.value)
)
)
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.6.1
sbt.version=1.6.2
4 changes: 1 addition & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "1.1.1"

addSbtPlugin("com.codecommit" % "sbt-spiewak-sonatype" % "0.23.0")
// TODO: Remove when `sbt-spiewak-sonatype` is updated
addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2")
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.6")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
Expand Down