Skip to content

Commit

Permalink
Scala js (#35)
Browse files Browse the repository at this point in the history
* Enable ScalaJS

* Fix ScalaJS dependencies

* CI for ScalaJS

* CI for ScalaJS

* CI for ScalaJS

* Unify build steps

* Fix CI?
  • Loading branch information
ghostdogpr authored Oct 9, 2019
1 parent b2e5797 commit 66f7271
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 28 deletions.
47 changes: 34 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,68 @@ version: 2.1
jobs:
lint:
docker:
- image: hseeberger/scala-sbt:8u212_1.2.8_2.12.9
- image: circleci/openjdk:8-jdk-node
steps:
- checkout
- restore_cache:
key: sbt-cache
key: sbtcache
- run: sbt ++2.12.10! check
- save_cache:
key: sbt-cache
key: sbtcache
paths:
- "~/.ivy2/cache"
- "~/.sbt"
- "~/.m2"
test212_jdk8:
docker:
- image: hseeberger/scala-sbt:8u212_1.2.8_2.12.9
- image: circleci/openjdk:8-jdk-node
steps:
- checkout
- restore_cache:
key: sbt-cache
- run: sbt ++2.12.10! test
key: sbtcache
- run: sbt ++2.12.10! coreJVM/test http4s/compile examples/compile
- save_cache:
key: sbt-cache
key: sbtcache
paths:
- "~/.ivy2/cache"
- "~/.sbt"
- "~/.m2"
test213_jdk11:
docker:
- image: hseeberger/scala-sbt:11.0.3_1.2.8_2.13.0
- image: circleci/openjdk:11-jdk-node
steps:
- checkout
- restore_cache:
key: sbt-cache
- run: sbt ++2.13.1! test
key: sbtcache
- run: sbt ++2.13.1! coreJVM/test http4s/compile examples/compile
- save_cache:
key: sbt-cache
key: sbtcache
paths:
- "~/.ivy2/cache"
- "~/.sbt"
- "~/.m2"
test212_js:
docker:
- image: circleci/openjdk:8-jdk-node
steps:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++2.12.10! coreJS/test
- save_cache:
key: sbtcache
paths:
- "~/.ivy2/cache"
- "~/.sbt"
- "~/.m2"
release:
docker:
- image: hseeberger/scala-sbt:8u212_1.2.8_2.12.9
- image: circleci/openjdk:8-jdk-node
steps:
- checkout
- run: git fetch --tags
- restore_cache:
key: sbt-cache
key: sbtcache
- run: echo "credentials += Credentials(\"Sonatype Nexus Repository Manager\", \"oss.sonatype.org\", \"$SONATYPE_USER\", \"$SONATYPE_PASSWORD\")" > ~/.sbt/1.0/sonatype.sbt
- run: echo -n "${PGP_PUBLIC}" | base64 -d > /tmp/public.asc
- run: echo -n "${PGP_SECRET}" | base64 -d > /tmp/secret.asc
Expand All @@ -69,6 +83,12 @@ workflows:
filters:
tags:
only: /^v[0-9]+(\.[0-9]+)*$/
- test212_js:
requires:
- lint
filters:
tags:
only: /^v[0-9]+(\.[0-9]+)*$/
- test213_jdk11:
requires:
- lint
Expand All @@ -80,6 +100,7 @@ workflows:
requires:
- test212_jdk8
- test213_jdk11
- test212_js
filters:
branches:
ignore: /.*/
Expand Down
32 changes: 21 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sbtcrossproject.CrossPlugin.autoImport.{ crossProject, CrossType }

val mainScala = "2.12.10"
val allScala = Seq("2.13.1", mainScala)

Expand All @@ -8,8 +10,6 @@ inThisBuild(
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
scalaVersion := mainScala,
parallelExecution in Test := false,
fork in Test := true,
fork in run := true,
pgpPassphrase := sys.env.get("PGP_PASSWORD").map(_.toArray),
pgpPublicRing := file("/tmp/public.asc"),
pgpSecretRing := file("/tmp/secret.asc"),
Expand All @@ -36,25 +36,35 @@ addCommandAlias("check", "all scalafmtSbtCheck scalafmtCheck test:scalafmtCheck"

lazy val root = project
.in(file("."))
.enablePlugins(ScalaJSPlugin)
.settings(skip in publish := true)
.aggregate(core, http4s)
.aggregate(coreJVM, coreJS, http4s)

lazy val core = project
lazy val core = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("core"))
.settings(name := "caliban")
.settings(commonSettings)
.settings(
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")),
libraryDependencies ++= Seq(
"com.lihaoyi" %% "fastparse" % "2.1.3",
"com.propensive" %% "magnolia" % "0.12.0",
"dev.zio" %% "zio" % "1.0.0-RC13",
"dev.zio" %% "zio-streams" % "1.0.0-RC13",
"dev.zio" %% "zio-test" % "1.0.0-RC13" % "test",
"dev.zio" %% "zio-test-sbt" % "1.0.0-RC13" % "test",
"com.lihaoyi" %%% "fastparse" % "2.1.3",
"com.propensive" %%% "magnolia" % "0.12.0",
"dev.zio" %%% "zio" % "1.0.0-RC13",
"dev.zio" %%% "zio-streams" % "1.0.0-RC13",
"dev.zio" %%% "zio-test" % "1.0.0-RC13" % "test",
"dev.zio" %%% "zio-test-sbt" % "1.0.0-RC13" % "test",
compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.0")
)
)
.jvmSettings(
fork in Test := true,
fork in run := true
)
lazy val coreJVM = core.jvm
lazy val coreJS = core.js.settings(
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % "2.0.0-RC3" % Test
)

lazy val http4s = project
.in(file("http4s"))
Expand All @@ -72,7 +82,7 @@ lazy val http4s = project
compilerPlugin("org.typelevel" %% "kind-projector" % "0.10.3")
)
)
.dependsOn(core)
.dependsOn(coreJVM)

lazy val examples = project
.in(file("examples"))
Expand Down
10 changes: 6 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.6")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.6")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.29")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1")

0 comments on commit 66f7271

Please sign in to comment.