Skip to content

Commit

Permalink
Merge pull request #58 from armanbilge/feature/native
Browse files Browse the repository at this point in the history
Scala Native
  • Loading branch information
ChristopherDavenport authored Sep 15, 2022
2 parents 7f34bcc + 4484d07 commit 6f5aacf
Show file tree
Hide file tree
Showing 31 changed files with 74 additions and 33 deletions.
58 changes: 46 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.15, 2.13.8, 3.1.0]
scala: [2.12.15, 2.13.8, 3.1.3]
java: [temurin@8]
project: [rootJS, rootJVM]
project: [rootJS, rootJVM, rootNative]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
Expand Down Expand Up @@ -73,6 +73,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

Expand All @@ -86,11 +90,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 .js/target site/target core/.js/target examples/.js/target core/.jvm/target .jvm/target .native/target examples/.jvm/target project/target
run: mkdir -p target .js/target core/native/target site/target core/js/target examples/.js/target core/jvm/target .jvm/target .native/target examples/.jvm/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 .js/target site/target core/.js/target examples/.js/target core/.jvm/target .jvm/target .native/target examples/.jvm/target project/target
run: tar cf targets.tar target .js/target core/native/target site/target core/js/target examples/.js/target core/jvm/target .jvm/target .native/target examples/.jvm/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
Expand All @@ -106,7 +110,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.6]
scala: [2.13.8]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -163,6 +167,16 @@ jobs:
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.15, rootNative)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootNative

- name: Inflate target directories (2.12.15, rootNative)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.13.8, rootJS)
uses: actions/download-artifact@v2
with:
Expand All @@ -183,22 +197,42 @@ jobs:
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.0, rootJS)
- 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: Download target directories (3.1.3, rootJS)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.3-rootJS

- name: Inflate target directories (3.1.3, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.3, rootJVM)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.0-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.3-rootJVM

- name: Inflate target directories (3.1.0, rootJS)
- name: Inflate target directories (3.1.3, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.0, rootJVM)
- name: Download target directories (3.1.3, rootNative)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.0-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.3-rootNative

- name: Inflate target directories (3.1.0, rootJVM)
- name: Inflate target directories (3.1.3, rootNative)
run: |
tar xf targets.tar
rm targets.tar
Expand All @@ -222,7 +256,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.6]
scala: [2.13.8]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
Expand Down
36 changes: 20 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ ThisBuild / tlCiReleaseBranches := Seq("main")
ThisBuild / tlSonatypeUseLegacyHost := true


val catsV = "2.7.0"
val catsEffectV = "3.3.3"
val fs2V = "3.2.3"
val catsV = "2.8.0"
val catsEffectV = "3.3.14"
val fs2V = "3.3.0"

val munitCatsEffectV = "1.0.7"
val munitCatsEffectV = "2.0.0-M3"

ThisBuild / crossScalaVersions := Seq("2.12.15","2.13.8", "3.1.0")
ThisBuild / scalaVersion := "2.13.6"
ThisBuild / crossScalaVersions := Seq("2.12.15","2.13.8", "3.1.3")
ThisBuild / scalaVersion := "2.13.8"
ThisBuild / versionScheme := Some("early-semver")

// Projects
lazy val `rediculous` = tlCrossRootProject
.aggregate(core.jvm, core.js, examples.jvm, examples.js)
.aggregate(core, examples)

lazy val core = crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
// .crossType(CrossType.Pure)
.in(file("core"))
.settings(
name := "rediculous",
Expand All @@ -45,20 +45,24 @@ lazy val core = crossProject(JVMPlatform, JSPlatform)
"co.fs2" %%% "fs2-io" % fs2V,
"co.fs2" %%% "fs2-scodec" % fs2V,

"org.typelevel" %%% "keypool" % "0.4.6",
"org.typelevel" %%% "keypool" % "0.4.8",


"io.chrisdavenport" %%% "cats-scalacheck" % "0.3.1" % Test,
"org.typelevel" %%% "munit-cats-effect-3" % munitCatsEffectV % Test,
"io.chrisdavenport" %%% "whale-tail-manager" % "0.0.8" % Test,
"org.scalameta" %%% "munit-scalacheck" % "0.7.27" % Test,
"io.chrisdavenport" %%% "cats-scalacheck" % "0.3.2" % Test,
"org.typelevel" %%% "munit-cats-effect" % munitCatsEffectV % Test,
"org.scalameta" %%% "munit-scalacheck" % "1.0.0-M6" % Test,
),
libraryDependencies += "org.scodec" %%% "scodec-core" % (if (scalaVersion.value.startsWith("2.")) "1.11.9" else "2.1.0")
libraryDependencies += "org.scodec" %%% "scodec-core" % (if (scalaVersion.value.startsWith("2.")) "1.11.10" else "2.2.0")
).jsSettings(
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule)}
).jvmSettings(
libraryDependencies += "com.github.jnr" % "jnr-unixsocket" % "0.38.15" % Test,
)
.platformsSettings(JVMPlatform, JSPlatform)(
libraryDependencies ++= Seq(
"io.chrisdavenport" %%% "whale-tail-manager" % "0.0.8" % Test,
)
)

lazy val examples = crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
Expand All @@ -72,7 +76,7 @@ lazy val examples = crossProject(JVMPlatform, JSPlatform)
scalaJSUseMainModuleInitializer := true,
).jsSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.3.0"
"io.github.cquiroz" %%% "scala-java-time" % "2.4.0"
),
Compile / mainClass := Some("BasicExample"),
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule)},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.chrisdavenport.rediculous
import cats.syntax.all._
import cats.effect._
import munit.CatsEffectSuite
import munit.catseffect._
import scala.concurrent.duration._
import _root_.io.chrisdavenport.whaletail.Docker
import _root_.io.chrisdavenport.whaletail.manager._
Expand Down Expand Up @@ -32,12 +33,11 @@ class RedisCommandsSpec extends CatsEffectSuite {
} yield connection

)
// Not available on scala.js
val redisConnection = UnsafeResourceSuiteLocalDeferredFixture(
"redisconnection",
resource
)
override def munitFixtures: Seq[Fixture[_]] = Seq(
override def munitFixtures: Seq[IOFixture[_]] = Seq(
redisConnection
)
test("set/get parity"){ //connection =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.chrisdavenport.rediculous
import cats.syntax.all._
import cats.effect._
import munit.CatsEffectSuite
import munit.catseffect._
import scala.concurrent.duration._
import _root_.io.chrisdavenport.whaletail.Docker
import _root_.io.chrisdavenport.whaletail.manager._
Expand Down Expand Up @@ -37,7 +38,7 @@ class RedisStreamSpec extends CatsEffectSuite {
"redisconnection",
resource
)
override def munitFixtures: Seq[Fixture[_]] = Seq(
override def munitFixtures: Seq[IOFixture[_]] = Seq(
redisConnection
)
test("send a single message"){ //connection =>
Expand Down
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.2
sbt.version=1.7.1
4 changes: 3 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.4.9")
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.4.9")
addSbtPlugin("org.typelevel" % "sbt-typelevel-settings" % "0.4.9")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")

0 comments on commit 6f5aacf

Please sign in to comment.