diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84be39c4..aa0e018d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,9 +28,9 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [3.1.1, 2.12.15, 2.13.8] + scala: [3.1.2, 2.12.16, 2.13.8] java: [temurin@8] - project: [rootJS, rootJVM] + project: [rootJS, rootJVM, rootNative] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -77,6 +77,10 @@ jobs: if: matrix.project == 'rootJS' run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/scalaJSLinkerResult + - name: nativeLink + if: matrix.project == 'rootNative' + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/nativeLink + - name: Test run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test @@ -90,11 +94,11 @@ jobs: - name: Make target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') - run: mkdir -p target unidocs/target .js/target site/target core/.js/target laws/.js/target core/.jvm/target tests/.js/target .jvm/target .native/target laws/.jvm/target tests/.jvm/target project/target + run: mkdir -p target unidocs/target .js/target core/.native/target site/target laws/.native/target core/.js/target laws/.js/target core/.jvm/target tests/js/target .jvm/target .native/target laws/.jvm/target tests/jvm/target tests/native/target project/target - name: Compress target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') - run: tar cf targets.tar target unidocs/target .js/target site/target core/.js/target laws/.js/target core/.jvm/target tests/.js/target .jvm/target .native/target laws/.jvm/target tests/.jvm/target project/target + run: tar cf targets.tar target unidocs/target .js/target core/.native/target site/target laws/.native/target core/.js/target laws/.js/target core/.jvm/target tests/js/target .jvm/target .native/target laws/.jvm/target tests/jvm/target tests/native/target project/target - name: Upload target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') @@ -147,42 +151,62 @@ jobs: ~/Library/Caches/Coursier/v1 key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - name: Download target directories (3.1.1, rootJS) + - name: Download target directories (3.1.2, rootJS) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.2-rootJS + + - name: Inflate target directories (3.1.2, rootJS) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (3.1.2, rootJVM) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.2-rootJVM + + - name: Inflate target directories (3.1.2, rootJVM) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (3.1.2, rootNative) uses: actions/download-artifact@v2 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.1-rootJS + name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.2-rootNative - - name: Inflate target directories (3.1.1, rootJS) + - name: Inflate target directories (3.1.2, rootNative) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (3.1.1, rootJVM) + - name: Download target directories (2.12.16, rootJS) uses: actions/download-artifact@v2 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.1-rootJVM + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.16-rootJS - - name: Inflate target directories (3.1.1, rootJVM) + - name: Inflate target directories (2.12.16, rootJS) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (2.12.15, rootJS) + - name: Download target directories (2.12.16, rootJVM) uses: actions/download-artifact@v2 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJS + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.16-rootJVM - - name: Inflate target directories (2.12.15, rootJS) + - name: Inflate target directories (2.12.16, rootJVM) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (2.12.15, rootJVM) + - name: Download target directories (2.12.16, rootNative) uses: actions/download-artifact@v2 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJVM + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.16-rootNative - - name: Inflate target directories (2.12.15, rootJVM) + - name: Inflate target directories (2.12.16, rootNative) run: | tar xf targets.tar rm targets.tar @@ -207,6 +231,16 @@ jobs: tar xf targets.tar rm targets.tar + - name: Download target directories (2.13.8, rootNative) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootNative + + - name: Inflate target directories (2.13.8, rootNative) + run: | + tar xf targets.tar + rm targets.tar + - name: Import signing key if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' run: echo $PGP_SECRET | base64 -di | gpg --import diff --git a/build.sbt b/build.sbt index a8256b2b..70fe6bb8 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,4 @@ -ThisBuild / tlBaseVersion := "1.2" +ThisBuild / tlBaseVersion := "1.3" ThisBuild / startYear := Some(2021) ThisBuild / developers := List( tlGitHubDev("SystemFw", "Fabio Labella"), @@ -11,7 +11,7 @@ ThisBuild / developers := List( val Scala213 = "2.13.8" -ThisBuild / crossScalaVersions := Seq("3.1.1", "2.12.15", Scala213) +ThisBuild / crossScalaVersions := Seq("3.1.2", "2.12.16", Scala213) ThisBuild / tlVersionIntroduced := Map("3" -> "1.2.1") lazy val commonJvmSettings = Seq( @@ -22,11 +22,16 @@ lazy val commonJsSettings = Seq( doctestGenTests := Seq.empty ) -val CatsVersion = "2.7.0" +lazy val commonNativeSettings = Seq( + doctestGenTests := Seq.empty, + tlVersionIntroduced := List("2.12", "2.13", "3").map(_ -> "1.3.0").toMap +) + +val CatsVersion = "2.8.0" lazy val root = tlCrossRootProject.aggregate(core, laws, tests) -lazy val core = crossProject(JSPlatform, JVMPlatform) +lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform) .crossType(CrossType.Pure) .settings(name := "cats-mtl") .settings( @@ -34,27 +39,29 @@ lazy val core = crossProject(JSPlatform, JVMPlatform) ) .jsSettings(commonJsSettings) .jvmSettings(commonJvmSettings) + .nativeSettings(commonNativeSettings) -lazy val laws = crossProject(JSPlatform, JVMPlatform) +lazy val laws = crossProject(JSPlatform, JVMPlatform, NativePlatform) .crossType(CrossType.Pure) .dependsOn(core) .settings(name := "cats-mtl-laws") .settings(libraryDependencies += "org.typelevel" %%% "cats-laws" % CatsVersion) .jsSettings(commonJsSettings) .jvmSettings(commonJvmSettings) + .nativeSettings(commonNativeSettings) -lazy val tests = crossProject(JSPlatform, JVMPlatform) - .crossType(CrossType.Pure) +lazy val tests = crossProject(JSPlatform, JVMPlatform, NativePlatform) .dependsOn(core, laws) .enablePlugins(NoPublishPlugin) .settings(name := "cats-mtl-tests") .settings( libraryDependencies ++= Seq( "org.typelevel" %%% "cats-testkit" % CatsVersion, - "org.scalameta" %%% "munit" % "0.7.29", - "org.typelevel" %%% "discipline-munit" % "1.0.9")) + "org.scalameta" %%% "munit" % "1.0.0-M5", + "org.typelevel" %%% "discipline-munit" % "2.0.0-M2")) .jsSettings(commonJsSettings) .jvmSettings(commonJvmSettings) + .nativeSettings(commonNativeSettings) lazy val unidocs = project .in(file("unidocs")) diff --git a/project/plugins.sbt b/project/plugins.sbt index 8aee783b..34d66cdf 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,3 +2,5 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0") addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.10.0") addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.12") addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.4.12") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") diff --git a/tests/.js/src/test/scala/cats/mtl/tests/Platform.scala b/tests/js/src/test/scala/cats/mtl/tests/Platform.scala similarity index 96% rename from tests/.js/src/test/scala/cats/mtl/tests/Platform.scala rename to tests/js/src/test/scala/cats/mtl/tests/Platform.scala index 1edd32e0..1c6590ce 100644 --- a/tests/.js/src/test/scala/cats/mtl/tests/Platform.scala +++ b/tests/js/src/test/scala/cats/mtl/tests/Platform.scala @@ -21,5 +21,6 @@ private[tests] object Platform { // $COVERAGE-OFF$ final val isJvm = false final val isJs = true + final val isNative = false // $COVERAGE-ON$ } diff --git a/tests/.jvm/src/test/scala/cats/mtl/tests/Platform.scala b/tests/jvm/src/test/scala/cats/mtl/tests/Platform.scala similarity index 96% rename from tests/.jvm/src/test/scala/cats/mtl/tests/Platform.scala rename to tests/jvm/src/test/scala/cats/mtl/tests/Platform.scala index 0ba1c350..387bd3a3 100644 --- a/tests/.jvm/src/test/scala/cats/mtl/tests/Platform.scala +++ b/tests/jvm/src/test/scala/cats/mtl/tests/Platform.scala @@ -21,5 +21,6 @@ private[tests] object Platform { // $COVERAGE-OFF$ final val isJvm = true final val isJs = false + final val isNative = false // $COVERAGE-ON$ } diff --git a/tests/native/src/test/scala/cats/mtl/tests/Platform.scala b/tests/native/src/test/scala/cats/mtl/tests/Platform.scala new file mode 100644 index 00000000..3e835fde --- /dev/null +++ b/tests/native/src/test/scala/cats/mtl/tests/Platform.scala @@ -0,0 +1,26 @@ +/* + * Copyright 2021 Typelevel + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cats.mtl.tests + +private[tests] object Platform { + // using `final val` makes compiler constant-fold any use of these values, dropping dead code automatically + // $COVERAGE-OFF$ + final val isJvm = false + final val isJs = false + final val isNative = true + // $COVERAGE-ON$ +} diff --git a/tests/src/test/scala/cats/mtl/tests/BaseSuite.scala b/tests/shared/src/test/scala/cats/mtl/tests/BaseSuite.scala similarity index 100% rename from tests/src/test/scala/cats/mtl/tests/BaseSuite.scala rename to tests/shared/src/test/scala/cats/mtl/tests/BaseSuite.scala diff --git a/tests/src/test/scala/cats/mtl/tests/EitherTTests.scala b/tests/shared/src/test/scala/cats/mtl/tests/EitherTTests.scala similarity index 100% rename from tests/src/test/scala/cats/mtl/tests/EitherTTests.scala rename to tests/shared/src/test/scala/cats/mtl/tests/EitherTTests.scala diff --git a/tests/src/test/scala/cats/mtl/tests/HandleTests.scala b/tests/shared/src/test/scala/cats/mtl/tests/HandleTests.scala similarity index 100% rename from tests/src/test/scala/cats/mtl/tests/HandleTests.scala rename to tests/shared/src/test/scala/cats/mtl/tests/HandleTests.scala diff --git a/tests/src/test/scala/cats/mtl/tests/IorTTests.scala b/tests/shared/src/test/scala/cats/mtl/tests/IorTTests.scala similarity index 100% rename from tests/src/test/scala/cats/mtl/tests/IorTTests.scala rename to tests/shared/src/test/scala/cats/mtl/tests/IorTTests.scala diff --git a/tests/src/test/scala/cats/mtl/tests/OptionTTests.scala b/tests/shared/src/test/scala/cats/mtl/tests/OptionTTests.scala similarity index 100% rename from tests/src/test/scala/cats/mtl/tests/OptionTTests.scala rename to tests/shared/src/test/scala/cats/mtl/tests/OptionTTests.scala diff --git a/tests/src/test/scala/cats/mtl/tests/ReaderTTests.scala b/tests/shared/src/test/scala/cats/mtl/tests/ReaderTTests.scala similarity index 100% rename from tests/src/test/scala/cats/mtl/tests/ReaderTTests.scala rename to tests/shared/src/test/scala/cats/mtl/tests/ReaderTTests.scala diff --git a/tests/src/test/scala/cats/mtl/tests/ReaderWriterStateTTests.scala b/tests/shared/src/test/scala/cats/mtl/tests/ReaderWriterStateTTests.scala similarity index 100% rename from tests/src/test/scala/cats/mtl/tests/ReaderWriterStateTTests.scala rename to tests/shared/src/test/scala/cats/mtl/tests/ReaderWriterStateTTests.scala diff --git a/tests/src/test/scala/cats/mtl/tests/StateTTests.scala b/tests/shared/src/test/scala/cats/mtl/tests/StateTTests.scala similarity index 100% rename from tests/src/test/scala/cats/mtl/tests/StateTTests.scala rename to tests/shared/src/test/scala/cats/mtl/tests/StateTTests.scala diff --git a/tests/src/test/scala/cats/mtl/tests/SummonableImplicits.scala b/tests/shared/src/test/scala/cats/mtl/tests/SummonableImplicits.scala similarity index 100% rename from tests/src/test/scala/cats/mtl/tests/SummonableImplicits.scala rename to tests/shared/src/test/scala/cats/mtl/tests/SummonableImplicits.scala diff --git a/tests/src/test/scala/cats/mtl/tests/Syntax.scala b/tests/shared/src/test/scala/cats/mtl/tests/Syntax.scala similarity index 100% rename from tests/src/test/scala/cats/mtl/tests/Syntax.scala rename to tests/shared/src/test/scala/cats/mtl/tests/Syntax.scala diff --git a/tests/src/test/scala/cats/mtl/tests/ValidatedTests.scala b/tests/shared/src/test/scala/cats/mtl/tests/ValidatedTests.scala similarity index 100% rename from tests/src/test/scala/cats/mtl/tests/ValidatedTests.scala rename to tests/shared/src/test/scala/cats/mtl/tests/ValidatedTests.scala diff --git a/tests/src/test/scala/cats/mtl/tests/WriterTTests.scala b/tests/shared/src/test/scala/cats/mtl/tests/WriterTTests.scala similarity index 100% rename from tests/src/test/scala/cats/mtl/tests/WriterTTests.scala rename to tests/shared/src/test/scala/cats/mtl/tests/WriterTTests.scala