From 4e0fe33b028803c1c82a56c99948c71a1f22d473 Mon Sep 17 00:00:00 2001 From: Pierre Ricadat Date: Sun, 5 May 2019 10:22:38 +0900 Subject: [PATCH] Setup CircleCI --- .circleci/config.yml | 104 +++++++++++++++++++++++++++++++++++++++++++ build.sbt | 97 ++++++++++++++++++++++++++++++++-------- project/plugins.sbt | 5 ++- 3 files changed, 186 insertions(+), 20 deletions(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..3549f848d --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,104 @@ +version: 2.1 +jobs: + lint212_jdk8: + docker: + - image: hseeberger/scala-sbt:8u181_2.12.8_1.2.8 + steps: + - checkout + - restore_cache: + key: sbt-cache + - run: sbt ++2.12.8! check + - save_cache: + key: sbt-cache + paths: + - "~/.ivy2/cache" + - "~/.sbt" + - "~/.m2" + lint212_jdk11: + docker: + - image: hseeberger/scala-sbt:11.0.2_2.12.8_1.2.8 + steps: + - checkout + - restore_cache: + key: sbt-cache + - run: sbt ++2.12.8! check + - save_cache: + key: sbt-cache + paths: + - "~/.ivy2/cache" + - "~/.sbt" + - "~/.m2" + test212_jdk8: + docker: + - image: hseeberger/scala-sbt:8u181_2.12.8_1.2.8 + steps: + - checkout + - restore_cache: + key: sbt-cache + - run: sbt ++2.12.8! test + - save_cache: + key: sbt-cache + paths: + - "~/.ivy2/cache" + - "~/.sbt" + - "~/.m2" + test212_jdk11: + docker: + - image: hseeberger/scala-sbt:11.0.2_2.12.8_1.2.8 + steps: + - checkout + - restore_cache: + key: sbt-cache + - run: sbt ++2.12.8! test + - save_cache: + key: sbt-cache + paths: + - "~/.ivy2/cache" + - "~/.sbt" + - "~/.m2" + release: + docker: + - image: hseeberger/scala-sbt:8u181_2.12.8_1.2.8 + steps: + - checkout + - run: git fetch --tags + - restore_cache: + key: sbt-cache + - run: echo -n "${PGP_PUBLIC}" | base64 -d > /tmp/public.asc + - run: echo -n "${PGP_SECRET}" | base64 -d > /tmp/secret.asc + - run: sbt releaseEarly + +workflows: + version: 2 + build: + jobs: + - lint212_jdk8: + filters: + tags: + only: /^v[0-9]+(\.[0-9]+)*$/ + - lint212_jdk11: + filters: + tags: + only: /^v[0-9]+(\.[0-9]+)*$/ + - test212_jdk8: + requires: + - lint212_jdk8 + filters: + tags: + only: /^v[0-9]+(\.[0-9]+)*$/ + - test212_jdk11: + requires: + - lint212_jdk11 + filters: + tags: + only: /^v[0-9]+(\.[0-9]+)*$/ + - release: + context: Sonatype + requires: + - test212_jdk8 + - test212_jdk11 + filters: + branches: + ignore: /.*/ + tags: + only: /^v[0-9]+(\.[0-9]+)*$/ diff --git a/build.sbt b/build.sbt index f433c4559..c9ae1250b 100644 --- a/build.sbt +++ b/build.sbt @@ -1,19 +1,80 @@ -lazy val root = (project in file(".")) - .settings( - inThisBuild( - List( - organization := "dev.zio", - scalaVersion := "2.12.8", - version := "0.1.0-SNAPSHOT" - ) - ), - name := "zio-kafka", - libraryDependencies ++= Seq( - "org.apache.kafka" % "kafka-clients" % "2.2.0", - "org.scalaz" %% "scalaz-zio" % "1.0-RC4" - ), - addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.4"), - scalafmtOnCompile := true, - fork := true, - Test / fork := true +val mainScala = "2.12.8" +val allScala = Seq("2.11.12", mainScala) + +organization := "dev.zio" +homepage := Some(url("https://github.com/zio/zio-kafka")) +name := "zio-kafka" +licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")) +scalaVersion := mainScala +parallelExecution in Test := false +scalafmtOnCompile := true +fork in Test := true +pgpPublicRing := file("/tmp/public.asc") +pgpSecretRing := file("/tmp/secret.asc") +releaseEarlyWith := SonatypePublisher +scmInfo := Some( + ScmInfo(url("https://github.com/zio/zio-kafka/"), "scm:git:git@github.com:zio/zio-kafka.git") +) +developers := List( + Developer( + "iravid", + "Itamar Ravid", + "iravid@iravid.com", + url("https://github.com/iravid") ) +) + +libraryDependencies ++= Seq( + "org.scalaz" %% "scalaz-zio" % "1.0-RC4", + "org.apache.kafka" % "kafka-clients" % "2.2.0", + compilerPlugin("org.spire-math" %% "kind-projector" % "0.9.10") +) + +scalacOptions ++= Seq( + "-deprecation", + "-encoding", + "UTF-8", + "-explaintypes", + "-Yrangepos", + "-feature", + "-Xfuture", + "-language:higherKinds", + "-language:existentials", + "-unchecked", + "-Xlint:_,-type-parameter-shadow", + "-Ywarn-numeric-widen", + "-Ywarn-unused", + "-Ywarn-value-discard" +) ++ (CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, 11)) => + Seq( + "-Yno-adapted-args", + "-Ypartial-unification", + "-Ywarn-inaccessible", + "-Ywarn-infer-any", + "-Ywarn-nullary-override", + "-Ywarn-nullary-unit" + ) + case Some((2, 12)) => + Seq( + "-Xsource:2.13", + "-Yno-adapted-args", + "-Ypartial-unification", + "-Ywarn-extra-implicit", + "-Ywarn-inaccessible", + "-Ywarn-infer-any", + "-Ywarn-nullary-override", + "-Ywarn-nullary-unit", + "-opt-inline-from:", + "-opt-warnings", + "-opt:l:inline" + ) + case _ => Nil +}) + +fork in run := true + +crossScalaVersions := allScala + +addCommandAlias("fmt", "all scalafmtSbt scalafmt test:scalafmt") +addCommandAlias("check", "all scalafmtSbtCheck scalafmtCheck test:scalafmtCheck") diff --git a/project/plugins.sbt b/project/plugins.sbt index f037e729b..297ce1c94 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,3 @@ -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.0") -addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.6") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.0") +addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.6") +addSbtPlugin("ch.epfl.scala" % "sbt-release-early" % "2.1.1")