mdedetrich / scalajson

ScalaJSON - JSON for Scala, currently contains minimal AST
BSD 3-Clause "New" or "Revised" License
55 stars 10 forks source link

Add sbt-platform and set up the new CI #44

Closed jvican closed 6 years ago

jvican commented 7 years ago

This pull request adds sbt-platform and simplifies the build as much as possible. I've tried to stick to good sbt practices that help readability and follow the way scopes work.

This pull request coincidentally upgrades to sbt 1.0 too, since sbt-platform is set up directly to work with 1.0.

The documentation of sbt-platform is not yet ready, but it relies on battle-tested plugins like sbt-release-early to release everything in the CI. For a motivation of why this is a good idea, I suggest reading the sbt-release-early docs: https://github.com/scalacenter/sbt-release-early, which features both tags and on-merge releases.

There is one thing that changes significantly your workflow, Matthew. You don't need to set up the version from now on, sbt-platform will set up the version from your git environment thanks to sbt-dynver:

sbt @ root > show version
[info] scalaJsonJS/*:version
[info]  1.0.0-M4+7-dbfc4948+20171019-1059
[info] scalaJsonJVM/*:version
[info]  1.0.0-M4+7-dbfc4948+20171019-1059
[info] root/*:version
[info]  1.0.0-M4+7-dbfc4948+20171019-1059

The version is derived from the last pushed git tag. Git tags are the only source of truth when it comes to versions. This helps reproducibility and encourages fast workflows.

This pull request is still work in progress since I need to set up the new CI (Drone on Linux). The idea is to add a Windows CI based on Jenkins in the future.

Let me know what you think about this.

jvican commented 7 years ago

I need admin rights to set up the CI configuration file and sign it for this repo. @mdedetrich

mdedetrich commented 7 years ago

@jvican Getting the following

[error] java.lang.RuntimeException: Undefined environment variable GITHUB_PLATFORM_TOKEN.
54s
1302
[error]     at scala.sys.package$.error(package.scala:27)
54s
1303
[error]     at ch.epfl.scala.platform.PlatformPluginImplementation$Defaults$.$anonfun$platformGitHubToken$2(PlatformPlugin.scala:140)
54s
1304
[error]     at scala.collection.MapLike.getOrElse(MapLike.scala:128)
54s
1305
[error]     at scala.collection.MapLike.getOrElse$(MapLike.scala:126)
54s
1306
[error]     at scala.collection.AbstractMap.getOrElse(Map.scala:59)
54s
1307
[error]     at ch.epfl.scala.platform.PlatformPluginImplementation$Defaults$.$anonfun$platformGitHubToken$1(PlatformPlugin.scala:140)
54s
1308
[error]     at sbt.internal.util.EvaluateSettings.$anonfun$constant$1(INode.scala:197)
54s
1309
[error]     at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:214)
54s
1310
[error]     at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:159)
54s
1311
[error]     at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate$1(INode.scala:82)
54s
1312
[error]     at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:93)
54s
1313
[error]     at sbt.internal.util.EvaluateSettings$$anon$3.run(INode.scala:89)
54s
1314
[error]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
54s
1315
[error]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
54s
1316
[error]     at java.lang.Thread.run(Thread.java:748)
54s
1317
[error] Undefined environment variable GITHUB_PLATFORM_TOKEN.
54s
1318
[error] Use 'last' for the full log.

From https://ci.scala-lang.org/mdedetrich/scalajson/3/6

jvican commented 7 years ago

Yup, I know. Everything is under control :smile:.