Skip to content

Commit

Permalink
Merge pull request #1453 from typelevel/topic/s3-m2
Browse files Browse the repository at this point in the history
Prepare upgrade to Scala 3 M2
  • Loading branch information
djspiewak authored Nov 27, 2020
2 parents 170c50a + 349460b commit 2eb654f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 76 deletions.
63 changes: 14 additions & 49 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, windows-latest]
scala: [0.27.0-RC1, 3.0.0-M1, 2.12.12, 2.13.3]
scala: [3.0.0-M1, 3.0.0-M2, 2.12.12, 2.13.3]
java:
- [email protected]
- [email protected]
Expand All @@ -36,14 +36,10 @@ jobs:
java: [email protected]
- ci: ciJS
java: [email protected]
- ci: ciJS
scala: 0.27.0-RC1
- ci: ciJS
scala: 3.0.0-M1
- os: windows-latest
scala: 0.27.0-RC1
- os: windows-latest
scala: 3.0.0-M1
- os: windows-latest
scala: 3.0.0-M2
- os: windows-latest
scala: 2.12.12
- os: windows-latest
Expand All @@ -54,14 +50,10 @@ jobs:
java: [email protected]
- ci: ciFirefox
java: [email protected]
- ci: ciFirefox
scala: 0.27.0-RC1
- ci: ciFirefox
scala: 3.0.0-M1
- os: windows-latest
scala: 0.27.0-RC1
- os: windows-latest
scala: 3.0.0-M1
- os: windows-latest
scala: 3.0.0-M2
- os: windows-latest
scala: 2.12.12
- os: windows-latest
Expand All @@ -85,44 +77,17 @@ jobs:
with:
java-version: ${{ matrix.java }}

- name: Cache ivy2
uses: actions/cache@v1
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Cache coursier (generic)
uses: actions/cache@v1
with:
path: ~/.coursier/cache/v1
key: ${{ runner.os }}-generic-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Cache coursier (linux)
if: contains(runner.os, 'linux')
uses: actions/cache@v1
with:
path: ~/.cache/coursier/v1
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Cache coursier (macOS)
if: contains(runner.os, 'macos')
uses: actions/cache@v1
with:
path: ~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Cache coursier (windows)
if: contains(runner.os, 'windows')
uses: actions/cache@v1
with:
path: ~/AppData/Local/Coursier/Cache/v1
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Cache sbt
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.sbt
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Setup NodeJS v14 LTS
if: matrix.ci == 'ciJS'
Expand Down
39 changes: 14 additions & 25 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ val Windows = "windows-latest"
val ScalaJSJava = "[email protected]"
val Scala213 = "2.13.3"

ThisBuild / crossScalaVersions := Seq("0.27.0-RC1", "3.0.0-M1", "2.12.12", Scala213)
ThisBuild / crossScalaVersions := Seq("3.0.0-M1", "3.0.0-M2", "2.12.12", Scala213)

ThisBuild / githubWorkflowTargetBranches := Seq("series/3.x")

Expand Down Expand Up @@ -90,11 +90,7 @@ ThisBuild / githubWorkflowBuildMatrixExclusions ++= {
MatrixExclude(Map("ci" -> ci, "java" -> java))
}

val scalaFilters = crossScalaVersions.value.filterNot(_.startsWith("2.")) map { scala =>
MatrixExclude(Map("ci" -> ci, "scala" -> scala))
}

javaFilters ++ scalaFilters ++ windowsScalaFilters :+ MatrixExclude(Map("os" -> Windows, "ci" -> ci))
javaFilters ++ windowsScalaFilters :+ MatrixExclude(Map("os" -> Windows, "ci" -> ci))
}
}

Expand Down Expand Up @@ -123,10 +119,10 @@ ThisBuild / scmInfo := Some(
url("https://github.com/typelevel/cats-effect"),
"[email protected]:typelevel/cats-effect.git"))

val CatsVersion = "2.3.0-M2"
val CatsVersion = "2.3.0"
val Specs2Version = "4.10.5"
val ScalaCheckVersion = "1.15.1"
val DisciplineVersion = "1.1.1"
val DisciplineVersion = "1.1.2"

replaceCommandAlias("ci", "; project /; headerCheck; scalafmtCheck; clean; testIfRelevant; coreJVM/mimaReportBinaryIssues; set Global / useFirefoxEnv := true; coreJS/test; set Global / useFirefoxEnv := false")
addCommandAlias("ciAll", "; project /; +headerCheck; +scalafmtCheck; +clean; +testIfRelevant; +coreJVM/mimaReportBinaryIssues; set Global / useFirefoxEnv := true; +coreJS/test; set Global / useFirefoxEnv := false")
Expand All @@ -139,20 +135,17 @@ addCommandAlias("ciFirefox", "; set Global / useFirefoxEnv := true; project root

addCommandAlias("prePR", "; root/clean; +root/scalafmtAll; +root/headerCreate")

val dottyJsSettings = Seq(crossScalaVersions := (ThisBuild / crossScalaVersions).value.filter(_.startsWith("2.")))

lazy val root = project.in(file("."))
.aggregate(rootJVM, rootJS)
.settings(noPublishSettings)
.enablePlugins(NoPublishPlugin)

lazy val rootJVM = project
.aggregate(kernel.jvm, testkit.jvm, laws.jvm, core.jvm, std.jvm, example.jvm, benchmarks)
.settings(noPublishSettings)
.enablePlugins(NoPublishPlugin)

lazy val rootJS = project
.aggregate(kernel.js, testkit.js, laws.js, core.js, std.js, example.js)
.settings(noPublishSettings)
.settings(dottyJsSettings)
.enablePlugins(NoPublishPlugin)

/**
* The core abstractions and syntax. This is the most general definition of Cats Effect,
Expand All @@ -164,7 +157,6 @@ lazy val kernel = crossProject(JSPlatform, JVMPlatform).in(file("kernel"))
libraryDependencies += "org.specs2" %%% "specs2-core" % Specs2Version % Test)
.settings(dottyLibrarySettings)
.settings(libraryDependencies += "org.typelevel" %%% "cats-core" % CatsVersion)
.jsSettings(dottyJsSettings)

/**
* Reference implementations (including a pure ConcurrentBracket), generic ScalaCheck
Expand All @@ -178,8 +170,7 @@ lazy val testkit = crossProject(JSPlatform, JVMPlatform).in(file("testkit"))
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-free" % CatsVersion,
"org.scalacheck" %%% "scalacheck" % ScalaCheckVersion,
"org.typelevel" %%% "coop" % "1.0.0-M1"))
.jsSettings(dottyJsSettings)
"org.typelevel" %%% "coop" % "1.0.0-M2"))

/**
* The laws which constrain the abstractions. This is split from kernel to avoid
Expand All @@ -194,7 +185,6 @@ lazy val laws = crossProject(JSPlatform, JVMPlatform).in(file("laws"))
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-laws" % CatsVersion,
"org.typelevel" %%% "discipline-specs2" % DisciplineVersion % Test))
.jsSettings(dottyJsSettings)

/**
* Concrete, production-grade implementations of the abstractions. Or, more
Expand All @@ -213,7 +203,6 @@ lazy val core = crossProject(JSPlatform, JVMPlatform).in(file("core"))
.jvmSettings(
Test / fork := true,
Test / javaOptions += s"-Dsbt.classpath=${(Test / fullClasspath).value.map(_.data.getAbsolutePath).mkString(File.pathSeparator)}")
.jsSettings(dottyJsSettings)

/**
* Implementations lof standard functionality (e.g. Semaphore, Console, Queue)
Expand All @@ -228,33 +217,33 @@ lazy val std = crossProject(JSPlatform, JVMPlatform).in(file("std"))

libraryDependencies += {
if (isDotty.value)
("org.specs2" %%% "specs2-scalacheck" % Specs2Version % Test).withDottyCompat(scalaVersion.value).exclude("org.scalacheck", "scalacheck_2.13")
("org.specs2" %%% "specs2-scalacheck" % Specs2Version % Test)
.withDottyCompat(scalaVersion.value)
.exclude("org.scalacheck", "scalacheck_2.13")
.exclude("org.scalacheck", "scalacheck_sjs1_2.13")
else
"org.specs2" %%% "specs2-scalacheck" % Specs2Version % Test
},

libraryDependencies += "org.scalacheck" %%% "scalacheck" % ScalaCheckVersion % Test)
.jsSettings(dottyJsSettings)

/**
* A trivial pair of trivial example apps primarily used to show that IOApp
* works as a practical runtime on both target platforms.
*/
lazy val example = crossProject(JSPlatform, JVMPlatform).in(file("example"))
.dependsOn(core)
.enablePlugins(NoPublishPlugin)
.settings(name := "cats-effect-example")
.jsSettings(scalaJSUseMainModuleInitializer := true)
.settings(noPublishSettings)
.jsSettings(dottyJsSettings)

/**
* JMH benchmarks for IO and other things.
*/
lazy val benchmarks = project.in(file("benchmarks"))
.dependsOn(core.jvm)
.settings(name := "cats-effect-benchmarks")
.settings(noPublishSettings)
.enablePlugins(JmhPlugin)
.enablePlugins(NoPublishPlugin, JmhPlugin)

lazy val docs = project.in(file("site-docs"))
.dependsOn(core.jvm)
Expand Down
2 changes: 1 addition & 1 deletion example/test-js.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sbt ++$1 exampleJS/fastOptJS
output=$(mktemp)
expected=$(mktemp)

cd example/js/target/scala-${1:0:4}/
cd example/js/target/scala-$(echo $1 | sed -E 's/\.[0-9]+$//')/

set +e
node cats-effect-example-fastopt.js left right > $output
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "1.1.0"

addSbtPlugin("com.codecommit" % "sbt-spiewak-sonatype" % "0.17.0")
addSbtPlugin("com.codecommit" % "sbt-spiewak-sonatype" % "0.18.3")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.7")
Expand Down

0 comments on commit 2eb654f

Please sign in to comment.