diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..6bbe6d78 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,37 @@ +def label = "fs2-grpc-${UUID.randomUUID().toString().substring(0, 5)}" + +podTemplate(label: label, + containers: [containerTemplate(name: 'sbt', + image: 'eu.gcr.io/cognitedata/openjdk8-sbt:2018-06-22-c73da5c', + resourceRequestCpu: '100m', + resourceLimitCpu: '2000m', + resourceRequestMemory: '3000Mi', + resourceLimitMemory: '3000Mi', + ttyEnabled: true, + command: '/bin/cat -')], + volumes: [secretVolume(secretName: 'sbt-credentials', mountPath: '/sbt-credentials'), + secretVolume(secretName: 'jenkins-docker-builder', mountPath: '/jenkins-docker-builder')]) { + + node(label) { + container('jnlp') { + stage('Checkout') { + checkout(scm) + } + } + container('sbt') { + stage('Install SBT config') { + sh('mkdir -p /root/.sbt/1.0 && cp /sbt-credentials/credentials.sbt /root/.sbt/1.0/credentials.sbt') + sh('cp /sbt-credentials/repositories /root/.sbt/') + } + if (env.BRANCH_NAME == 'fork-master') { + stage('Deploy') { + sh('sbt publish') + } + } else { + stage('Test') { + sh('sbt test') + } + } + } + } +} \ No newline at end of file diff --git a/build.sbt b/build.sbt index 57ce8c0e..826f2ba6 100644 --- a/build.sbt +++ b/build.sbt @@ -1,14 +1,16 @@ +val artifactory = "https://cognite.jfrog.io/cognite/" inThisBuild( List( - organization := "org.lyranthe.fs2-grpc", + organization := "com.cognite.fs2-grpc", git.useGitDescribe := true, - scmInfo := Some(ScmInfo(url("https://github.com/fiadliel/fs2-grpc"), "git@github.com:fiadliel/fs2-grpc.git")) + scmInfo := Some(ScmInfo(url("https://github.com/cognitedata/fs2-grpc"), "git@github.com:cognitedata/fs2-grpc.git")), + resolvers += "libs-release" at artifactory + "libs-release/", + version := "0.4.10" )) lazy val root = project.in(file(".")) - .enablePlugins(GitVersioning, BuildInfoPlugin) + .enablePlugins(BuildInfoPlugin) .settings( - sonatypeProfileName := "org.lyranthe", skip in publish := true, pomExtra in Global := { https://github.com/fiadliel/fs2-grpc @@ -30,22 +32,25 @@ lazy val root = project.in(file(".")) .aggregate(`sbt-java-gen`, `java-runtime`) lazy val `sbt-java-gen` = project - .enablePlugins(GitVersioning, BuildInfoPlugin) + .enablePlugins(BuildInfoPlugin) .settings( - publishTo := sonatypePublishTo.value, sbtPlugin := true, crossSbtVersions := List(sbtVersion.value, "0.13.18"), buildInfoPackage := "org.lyranthe.fs2_grpc.buildinfo", addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.23"), - libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % scalapb.compiler.Version.scalapbVersion + libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % scalapb.compiler.Version.scalapbVersion, + publishTo := { + if (isSnapshot.value) + Some("snapshots" at artifactory + "libs-snapshot-local/") + else + Some("releases" at artifactory + "libs-release-local/") + } ) lazy val `java-runtime` = project - .enablePlugins(GitVersioning) .settings( scalaVersion := "2.12.8", crossScalaVersions := List(scalaVersion.value, "2.11.12", "2.13.0-M5"), - publishTo := sonatypePublishTo.value, libraryDependencies ++= List( "co.fs2" %% "fs2-core" % "1.0.4", "org.typelevel" %% "cats-effect" % "1.3.1", @@ -56,5 +61,11 @@ lazy val `java-runtime` = project ), mimaPreviousArtifacts := Set(organization.value %% name.value % "0.3.0"), testFrameworks += new TestFramework("minitest.runner.Framework"), - addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.9" cross CrossVersion.binary) + addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.9" cross CrossVersion.binary), + publishTo := { + if (isSnapshot.value) + Some("snapshots" at artifactory + "libs-snapshot-local/") + else + Some("releases" at artifactory + "libs-release-local/") + } ) diff --git a/project/plugins.sbt b/project/plugins.sbt index 558ad0c1..c352056a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,4 @@ addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.3") -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")