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

Things weren't working, now I think they are #3666

Merged
merged 6 commits into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
26 changes: 16 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.12, 2.13.3, 0.27.0-RC1]
scala: [2.12.12, 2.13.3, 0.27.0-RC1, 3.0.0-M1]
java:
- adopt@1.8
- adopt@1.11
Expand All @@ -32,12 +32,18 @@ jobs:
exclude:
- platform: js
scala: 0.27.0-RC1
- platform: js
scala: 3.0.0-M1
- platform: js
java: adopt@1.11
- platform: js
java: adopt@1.15
- platform: js
java: graalvm-ce-java8@20.2.0
- platform: js
scala: 0.27.0-RC1
- platform: js
scala: 3.0.0-M1
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
Expand Down Expand Up @@ -97,37 +103,37 @@ jobs:
run: sbt ++${{ matrix.scala }} validateAllJS

- name: Setup Python
if: matrix.platform == 'jvm' && matrix.scala != '0.27.0-RC1'
if: matrix.platform == 'jvm' && (matrix.scala != '0.27.0-RC1' && matrix.scala != '3.0.0-M1')
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Setup codecov
if: matrix.platform == 'jvm' && matrix.scala != '0.27.0-RC1'
if: matrix.platform == 'jvm' && (matrix.scala != '0.27.0-RC1' && matrix.scala != '3.0.0-M1')
run: pip install codecov

- name: Validate JVM (scala 2)
if: matrix.platform == 'jvm' && matrix.scala != '0.27.0-RC1'
if: matrix.platform == 'jvm' && (matrix.scala != '0.27.0-RC1' && matrix.scala != '3.0.0-M1')
run: sbt ++${{ matrix.scala }} coverage buildJVM bench/test coverageReport

- name: Validate JVM (scala 3)
if: matrix.platform == 'jvm' && matrix.scala == '0.27.0-RC1'
if: matrix.platform == 'jvm' && (matrix.scala == '0.27.0-RC1' || matrix.scala == '3.0.0-M1')
run: sbt ++${{ matrix.scala }} buildJVM bench/test

- name: Upload Codecov Results
if: matrix.platform == 'jvm' && matrix.scala != '0.27.0-RC1'
if: matrix.platform == 'jvm' && (matrix.scala != '0.27.0-RC1' && matrix.scala != '3.0.0-M1')
run: codecov -F ${{ matrix.scala }}

- name: Binary compatibility ${{ matrix.scala }}
if: matrix.platform == 'jvm' && matrix.scala != '0.27.0-RC1'
if: matrix.platform == 'jvm' && (matrix.scala != '0.27.0-RC1' && matrix.scala != '3.0.0-M1')
run: sbt ++${{ matrix.scala }} clean validateBC

scalafix:
name: Scalafix
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.12, 2.13.3, 0.27.0-RC1]
scala: [2.12.12, 2.13.3, 0.27.0-RC1, 3.0.0-M1]
java: [adopt@1.8]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -190,7 +196,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.12, 2.13.3, 0.27.0-RC1]
scala: [2.12.12, 2.13.3, 0.27.0-RC1, 3.0.0-M1]
java: [adopt@1.8]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -244,7 +250,7 @@ jobs:
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Check formatting
if: matrix.scala != '0.27.0-RC1'
if: (matrix.scala != '0.27.0-RC1' && matrix.scala != '3.0.0-M1')
run: sbt ++${{ matrix.scala }} fmtCheck

microsite:
Expand Down
99 changes: 64 additions & 35 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
import microsites._
import ReleaseTransformations._
import sbt.io.Using
import com.jsuereth.sbtpgp.PgpKeys

import scala.xml.transform.{RewriteRule, RuleTransformer}
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}

lazy val publishSignedIfRelevant = taskKey[Unit]("Runs publishSigned but only if scalaVersion in crossScalaVersions")
Global / publishSignedIfRelevant := PgpKeys.publishSigned.value

lazy val publishLocalSignedIfRelevant = taskKey[Unit]("Runs publishLocalSigned but only if scalaVersion in crossScalaVersions")
Global / publishLocalSignedIfRelevant := PgpKeys.publishLocalSigned.value

lazy val scoverageSettings = Seq(
coverageMinimum := 60,
coverageFailOnMinimum := false,
coverageHighlighting := true
)

organization in ThisBuild := "org.typelevel"
scalafixDependencies in ThisBuild += "org.typelevel" %% "simulacrum-scalafix" % "0.5.0"
scalafixDependencies in ThisBuild += "org.typelevel" %% "simulacrum-scalafix" % "0.5.1"

val scalaCheckVersion = "1.15.0"

val disciplineVersion = "1.1.0"

val disciplineScalatestVersion = "2.0.1"
val disciplineMunitVersion = "1.0.0"
val disciplineMunitVersion = "1.0.1"

val kindProjectorVersion = "0.11.0"

Expand All @@ -35,32 +42,39 @@ ThisBuild / githubWorkflowJavaVersions := Seq(PrimaryJava, LTSJava, LatestJava,

val Scala212 = "2.12.12"
val Scala213 = "2.13.3"
val Dotty = "0.27.0-RC1"
val DottyOld = "0.27.0-RC1"
val DottyNew = "3.0.0-M1"

ThisBuild / crossScalaVersions := Seq(Scala212, Scala213, Dotty)
ThisBuild / crossScalaVersions := Seq(Scala212, Scala213, DottyOld, DottyNew)
ThisBuild / scalaVersion := Scala213

ThisBuild / githubWorkflowPublishTargetBranches := Seq() // disable publication for now

ThisBuild / githubWorkflowBuildMatrixAdditions +=
"platform" -> List("jvm", "js")

ThisBuild / githubWorkflowBuildMatrixExclusions +=
MatrixExclude(Map("platform" -> "js", "scala" -> Dotty))
ThisBuild / githubWorkflowBuildMatrixExclusions ++=
crossScalaVersions.value.filterNot(_.startsWith("2.")).map(v => MatrixExclude(Map("platform" -> "js", "scala" -> v)))

ThisBuild / githubWorkflowBuildMatrixExclusions ++=
githubWorkflowJavaVersions.value.filterNot(Set(PrimaryJava)).map { java =>
MatrixExclude(Map("platform" -> "js", "java" -> java))
}

// exclude DottyJS for now
ThisBuild / githubWorkflowBuildMatrixExclusions ++=
crossScalaVersions.value.filterNot(_.startsWith("2.")).map { scala =>
MatrixExclude(Map("platform" -> "js", "scala" -> scala))
}

// we don't need this since we aren't publishing
ThisBuild / githubWorkflowArtifactUpload := false

val JvmCond = s"matrix.platform == 'jvm'"
val JsCond = s"matrix.platform == 'js'"

val Scala2Cond = s"matrix.scala != '$Dotty'"
val Scala3Cond = s"matrix.scala == '$Dotty'"
val Scala2Cond = s"(matrix.scala != '$DottyOld' && matrix.scala != '$DottyNew')"
val Scala3Cond = s"(matrix.scala == '$DottyOld' || matrix.scala == '$DottyNew')"

ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Sbt(List("validateAllJS"), name = Some("Validate JavaScript"), cond = Some(JsCond)),
Expand Down Expand Up @@ -131,9 +145,9 @@ def scalaVersionSpecificFolders(srcName: String, srcBaseDir: java.io.File, scala
List(CrossType.Pure, CrossType.Full)
.flatMap(_.sharedSrcDir(srcBaseDir, srcName).toList.map(f => file(f.getPath + suffix)))
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, y)) => extraDirs("-2.x") ++ (if (y >= 13) extraDirs("-2.13+") else Nil)
case Some((0, _)) => extraDirs("-2.13+") ++ extraDirs("-3.x")
case _ => Nil
case Some((2, y)) => extraDirs("-2.x") ++ (if (y >= 13) extraDirs("-2.13+") else Nil)
case Some((0 | 3, _)) => extraDirs("-2.13+") ++ extraDirs("-3.x")
case _ => Nil
}
}

Expand All @@ -142,8 +156,6 @@ ThisBuild / mimaFailOnNoPrevious := false
def doctestGenTestsDottyCompat(isDotty: Boolean, genTests: Seq[File]): Seq[File] =
if (isDotty) Nil else genTests

lazy val dottySettings = Seq(crossScalaVersions += Dotty)

lazy val commonSettings = Seq(
scalacOptions ++= commonScalacOptions(scalaVersion.value, isDotty.value),
Compile / unmanagedSourceDirectories ++= scalaVersionSpecificFolders("main", baseDirectory.value, scalaVersion.value),
Expand All @@ -158,7 +170,24 @@ lazy val commonSettings = Seq(
Seq()
else
old
}
},
// copying this trick from sbt-spiewak for now
publishSignedIfRelevant := Def.taskDyn {
val ver = scalaVersion.value
val cross = crossScalaVersions.value
if (cross.contains(ver))
Def.task(PgpKeys.publishSigned.value)
else
Def.task(streams.value.log.warn(s"skipping `publishSigned` in ${name.value}: $ver is not in $cross"))
}.value,
publishLocalSignedIfRelevant := Def.taskDyn {
val ver = scalaVersion.value
val cross = crossScalaVersions.value
if (cross.contains(ver))
Def.task(PgpKeys.publishLocalSigned.value)
else
Def.task(streams.value.log.warn(s"skipping `publishLocalSigned` in ${name.value}: $ver is not in $cross"))
}.value
) ++ warnUnusedImport

def macroDependencies(scalaVersion: String) =
Expand All @@ -180,20 +209,25 @@ lazy val simulacrumSettings = Seq(
scalacOptions ++= (
if (isDotty.value) Nil else Seq(s"-P:semanticdb:targetroot:${baseDirectory.value}/target/.semanticdb", "-Yrangepos")
),
libraryDependencies +=
("org.typelevel" %% "simulacrum-scalafix-annotations" % "0.5.0" % Provided).withDottyCompat(scalaVersion.value),
pomPostProcess := { (node: xml.Node) =>
new RuleTransformer(new RewriteRule {
override def transform(node: xml.Node): Seq[xml.Node] =
node match {
case e: xml.Elem
if e.label == "dependency" &&
e.child.exists(child => child.label == "groupId" && child.text == "org.typelevel") &&
e.child.exists(child => child.label == "artifactId" && child.text.startsWith("simulacrum")) =>
Nil
case _ => Seq(node)
}
}).transform(node).head
libraryDependencies += "org.typelevel" %% "simulacrum-scalafix-annotations" % "0.5.1" % Provided,
pomPostProcess := {
if (isDotty.value) { (node: xml.Node) =>
node
} else {
{ (node: xml.Node) =>
new RuleTransformer(new RewriteRule {
override def transform(node: xml.Node): Seq[xml.Node] =
node match {
case e: xml.Elem
if e.label == "dependency" &&
e.child.exists(child => child.label == "groupId" && child.text == "org.typelevel") &&
e.child.exists(child => child.label == "artifactId" && child.text.startsWith("simulacrum")) =>
Nil
case _ => Seq(node)
}
}).transform(node).head
}
}
}
)

Expand All @@ -202,6 +236,7 @@ lazy val tagName = Def.setting {
}

lazy val commonJsSettings = Seq(
crossScalaVersions := crossScalaVersions.value.filter(_.startsWith("2.")),
scalacOptions += {
val tv = tagName.value
val tagOrHash =
Expand Down Expand Up @@ -595,7 +630,6 @@ lazy val kernel = crossProject(JSPlatform, JVMPlatform)
.settings(
libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalaCheckVersion % Test
)
.jvmSettings(dottySettings)

lazy val kernelLaws = crossProject(JSPlatform, JVMPlatform)
.in(file("kernel-laws"))
Expand All @@ -610,7 +644,6 @@ lazy val kernelLaws = crossProject(JSPlatform, JVMPlatform)
.jvmSettings(commonJvmSettings ++ mimaSettings("cats-kernel-laws", includeCats1 = false))
.jsSettings(coverageEnabled := false)
.dependsOn(kernel)
.jvmSettings(dottySettings)

lazy val core = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
Expand All @@ -632,7 +665,6 @@ lazy val core = crossProject(JSPlatform, JVMPlatform)
)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings ++ mimaSettings("cats-core"))
.jvmSettings(dottySettings)

lazy val laws = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
Expand All @@ -644,7 +676,6 @@ lazy val laws = crossProject(JSPlatform, JVMPlatform)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings ++ mimaSettings("cats-laws", includeCats1 = false))
.jsSettings(coverageEnabled := false)
.jvmSettings(dottySettings)

lazy val free = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
Expand Down Expand Up @@ -689,7 +720,6 @@ lazy val alleycatsCore = crossProject(JSPlatform, JVMPlatform)
.settings(includeGeneratedSrc)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings ++ mimaSettings("alleycats-core", includeCats1 = false))
.jvmSettings(dottySettings)

lazy val alleycatsLaws = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
Expand All @@ -704,7 +734,6 @@ lazy val alleycatsLaws = crossProject(JSPlatform, JVMPlatform)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings ++ mimaSettings("alleycats-laws", includeCats1 = false))
.jsSettings(coverageEnabled := false)
.jvmSettings(dottySettings)

lazy val alleycatsTests = crossProject(JSPlatform, JVMPlatform)
.in(file("alleycats-tests"))
Expand Down Expand Up @@ -956,7 +985,7 @@ lazy val sharedReleaseProcess = Seq(
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
releaseStepCommandAndRemaining("+publishSignedIfRelevant"),
setNextVersion,
commitNextVersion,
releaseStepCommand("sonatypeReleaseAll"),
Expand Down