diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d284295..39b9fb17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.12.13, 2.13.4] + scala: [2.12.13, 2.13.4, 3.0.0-RC1] java: [adopt@1.8] runs-on: ${{ matrix.os }} steps: @@ -71,7 +71,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.12.12] + scala: [2.13.4] java: [adopt@1.8] runs-on: ${{ matrix.os }} steps: @@ -117,6 +117,16 @@ jobs: tar xf targets.tar rm targets.tar + - name: Download target directories (3.0.0-RC1) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-3.0.0-RC1-${{ matrix.java }} + + - name: Inflate target directories (3.0.0-RC1) + run: | + tar xf targets.tar + rm targets.tar + - uses: olafurpg/setup-gpg@v3 - env: diff --git a/build.sbt b/build.sbt index cd4737f5..f7b5023e 100644 --- a/build.sbt +++ b/build.sbt @@ -4,17 +4,13 @@ import sbtcrossproject.CrossPlugin.autoImport.crossProject ThisBuild / githubWorkflowPublishTargetBranches := Seq() -ThisBuild / crossScalaVersions := Seq("2.12.13", "2.13.4") +ThisBuild / crossScalaVersions := Seq("2.12.13", "2.13.4", "3.0.0-RC1") -lazy val commonSettings = Def.settings( - scalaVersion := "2.13.1", - crossScalaVersions := (ThisBuild / crossScalaVersions).value -) +ThisBuild / scalaVersion := "2.13.4" lazy val root = project.in(file(".")).aggregate(js, jvm). settings( name := "mouse", - commonSettings, publish / skip := true, sonatypeProfileName := "org.typelevel", releaseCrossBuild := true @@ -24,13 +20,11 @@ lazy val cross = crossProject(JSPlatform, JVMPlatform).in(file(".")). settings( name := "mouse", organization := "org.typelevel", - commonSettings, sonatypeProfileName := "org.typelevel", libraryDependencies ++= Seq( "org.typelevel" %%% "cats-core" % "2.4.2", "org.scalatest" %%% "scalatest" % "3.2.5" % Test, - "org.scalatestplus" %%% "scalacheck-1-15" % "3.2.5.0" % Test, - compilerPlugin("org.typelevel" %% "kind-projector" % "0.11.3" cross CrossVersion.full) + "org.scalatestplus" %%% "scalacheck-1-15" % "3.2.5.0" % Test ), licenses += ("MIT license", url("http://opensource.org/licenses/MIT")), homepage := Some(url("https://github.com/typelevel/mouse")), @@ -39,11 +33,19 @@ lazy val cross = crossProject(JSPlatform, JVMPlatform).in(file(".")). scalacOptions ++= Seq("-feature", "-deprecation", "-language:implicitConversions", "-language:higherKinds"), scalacOptions ++= { scalaVersion.value match { - case v if v.startsWith("2.13") => Nil - case _ => Seq("-Ypartial-unification") + case v if v.startsWith("2.12") => Seq("-Ypartial-unification") + case v if v.startsWith("3") => Seq("-source", "3.0-migration") + case _ => Nil } }, Test / publishArtifact := false, + Compile / doc / sources := { + val old = (Compile / doc / sources).value + if (isDotty.value) + Seq() + else + old + }, pomIncludeRepository := { _ => false }, releasePublishArtifactsAction := PgpKeys.publishSigned.value, releaseProcess := Seq[ReleaseStep]( @@ -59,6 +61,10 @@ lazy val cross = crossProject(JSPlatform, JVMPlatform).in(file(".")). commitNextVersion, ) ) + .jsSettings( + crossScalaVersions := (ThisBuild / crossScalaVersions).value.filter(_.startsWith("2")), + publishConfiguration := publishConfiguration.value.withOverwrite(true) + ) ThisBuild / githubWorkflowTargetTags ++= Seq("v*") ThisBuild / githubWorkflowPublishTargetBranches := diff --git a/project/plugins.sbt b/project/plugins.sbt index cdcc89b4..9321028e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -5,3 +5,4 @@ addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.11") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.10.1") addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.5") +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.3") diff --git a/shared/src/test/scala/mouse/AnyFSyntaxTest.scala b/shared/src/test/scala/mouse/AnyFSyntaxTest.scala index 10ed6e8d..4c3a7104 100644 --- a/shared/src/test/scala/mouse/AnyFSyntaxTest.scala +++ b/shared/src/test/scala/mouse/AnyFSyntaxTest.scala @@ -6,19 +6,36 @@ import cats.{Id, ~>} class AnyFSyntaxTest extends MouseSuite { - val emptyK: List ~> List = λ[List ~> List](_ => Nil) + val emptyK = new (List ~> List) { + def apply[A](x: List[A]) = Nil + } - val double: List ~> List = λ[List ~> List](list => list ::: list) + val double = new (List ~> List) { + def apply[A](x: List[A]) = x ::: x + } + + type E[B] = Either[String, B] + val toRight = new (Option ~> E) { + def apply[A](x: Option[A]) = x.toRight("foo") + } + + val headOption = new (List ~> Option) { + def apply[A](x: List[A]) = x.headOption + } + + val optionGet = new (Option ~> Id) { + def apply[A](x: Option[A]) = x.get + } List(1, 2, 3) thrushK emptyK shouldEqual Nil List(5, 10) thrushK double shouldEqual List(5, 10, 5, 10) - "thing".some thrushK (λ[Option ~> Either[String, *]](_.toRight("foo"))) shouldEqual Right( + "thing".some thrushK toRight shouldEqual Right( "thing" ) (List("This") ||> double - ||> λ[List ~> Option](_.headOption) - ||> λ[Option ~> Id](_.head)) shouldEqual "This" + ||> headOption + ||> optionGet) shouldEqual "This" } diff --git a/shared/src/test/scala/mouse/MouseSuite.scala b/shared/src/test/scala/mouse/MouseSuite.scala index f8fe54e1..bcb9a55c 100644 --- a/shared/src/test/scala/mouse/MouseSuite.scala +++ b/shared/src/test/scala/mouse/MouseSuite.scala @@ -14,12 +14,12 @@ trait MouseSuite with ScalaCheckDrivenPropertyChecks with AllSharedSyntax with AllInstances { - implicit val eq0 = new Eq[NumberFormatException] { + implicit val eq0: Eq[NumberFormatException] = new Eq[NumberFormatException] { override def eqv(x: NumberFormatException, y: NumberFormatException): Boolean = x.getMessage == y.getMessage } - implicit val eq1 = new Eq[IllegalArgumentException] { + implicit val eq1: Eq[IllegalArgumentException] = new Eq[IllegalArgumentException] { override def eqv(x: IllegalArgumentException, y: IllegalArgumentException): Boolean = x.getMessage == y.getMessage }