Skip to content

Commit

Permalink
Swithced to sbt-ci-release (#194)
Browse files Browse the repository at this point in the history
* Swithced to sbt-ci-release

* Removed codecove push
  • Loading branch information
barambani authored Jun 25, 2020
1 parent 75e91d9 commit 7cdad14
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 90 deletions.
80 changes: 66 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,78 @@
dist: xenial
sudo: false

language: scala

before_install:
- git fetch --tags

before_cache:
- rm -fv $HOME/.ivy2/.sbt.ivy.lock
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
- find $HOME/.sbt -name "*.lock" -print -delete

sbt_args: -Dfile.encoding=UTF8 -Dsbt.color=always

stages:
- name: Format
if: tag IS NOT present
- name: Test
if: tag IS NOT present
- name: Publish Snapshot 2.12
if: branch = master AND type = push AND tag IS NOT present AND NOT fork
- name: Publish Snapshot 2.13
if: branch = master AND type = push AND tag IS NOT present AND NOT fork
- name: Release 2.12
if: type != pull_request AND tag IS present AND NOT fork
- name: Release 2.13
if: type != pull_request AND tag IS present AND NOT fork

scala:
- 2.12.11
- 2.13.2

jdk:
- openjdk8
- openjdk11
- openjdk13

script:
- sbt ++$TRAVIS_SCALA_VERSION fullCiBuild
script: sbt ++$TRAVIS_SCALA_VERSION ciBuild

jobs:
include:
- stage: Format
name: Check with Scalafmt
script: sbt ++$TRAVIS_SCALA_VERSION checkFormat
jdk: openjdk8
scala: 2.13.2

- stage: Publish Snapshot 2.12
name: Publish a snapshot for Scala 2.12
script: CI_SNAPSHOT_RELEASE=publish sbt ++$TRAVIS_SCALA_VERSION releaseIt
jdk: openjdk8
scala: 2.12.11

- stage: Publish Snapshot 2.13
name: Publish a snapshot for Scala 2.13
script: CI_SNAPSHOT_RELEASE=publish sbt ++$TRAVIS_SCALA_VERSION releaseIt
jdk: openjdk8
scala: 2.13.2

- stage: Release 2.12
name: Release for Scala 2.12
script: CI_RELEASE=publishSigned sbt ++$TRAVIS_SCALA_VERSION releaseIt
jdk: openjdk8
scala: 2.12.11

- stage: Release 2.13
name: Release for Scala 2.13
script: CI_RELEASE=publishSigned sbt ++$TRAVIS_SCALA_VERSION releaseIt
jdk: openjdk8
scala: 2.13.2

cache:
directories:
- "$HOME/.coursier/cache"
- "$HOME/.ivy2/cache"
- "$HOME/.sbt"

before_cache:
- find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm
- find $HOME/.ivy2/cache -name "*SNAPSHOT*" | xargs rm -rf
- find $HOME/.ivy2/cache -name "*.lock" | xargs rm -rf
- find $HOME/.coursier/cache -name "*.lock" -type f -delete
- "$HOME/.cache/coursier"
- "$HOME/.ivy2/cache"
- "$HOME/.sbt/boot/"
- "$HOME/.sbt"
- "lib_managed"
- "target"
- "project/target"
90 changes: 20 additions & 70 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._

lazy val scala212Options = Seq(
"-deprecation",
"-encoding",
Expand Down Expand Up @@ -115,71 +113,9 @@ lazy val crossBuildSettings = Seq(
parallelExecution in Test := false
)

lazy val format = Command.command("format") { state =>
"scalafmt" :: "test:scalafmt" :: "scalafmtSbt" :: state
}

lazy val checkFormat = Command.command("checkFormat") { state =>
"scalafmtCheck" :: "test:scalafmtCheck" :: "scalafmtSbtCheck" :: state
}

lazy val fullCiBuild = Command.command("fullCiBuild") { state =>
"checkFormat" :: "clean" :: "test" :: state
}

lazy val customCommands: Seq[Def.Setting[_]] = Seq(
commands ++= Seq(format, checkFormat, fullCiBuild)
)

val scalafmtCheckStep = ReleaseStep(
action = st => {
val extracted = Project.extract(st)
val ref = extracted.get(thisProjectRef)
extracted.runAggregated(scalafmtCheck in Compile in ref, st)
},
enableCrossBuild = false
)

val scalafmtCheckTestStep = ReleaseStep(
action = st => {
val extracted = Project.extract(st)
val ref = extracted.get(thisProjectRef)
extracted.runAggregated(scalafmtCheck in Test in ref, st)
},
enableCrossBuild = false
)

val scalafmtCheckSbtStep = ReleaseStep(
action = st => {
val extracted = Project.extract(st)
val ref = extracted.get(thisProjectRef)
extracted.runAggregated(scalafmtSbtCheck in Test in ref, st)
},
enableCrossBuild = false
)

lazy val releaseSettings: Seq[Def.Setting[_]] = Seq(
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
runClean,
scalafmtCheckStep,
scalafmtCheckTestStep,
scalafmtCheckSbtStep,
inquireVersions,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
publishArtifacts,
setNextVersion,
releaseStepCommand("sonatypeRelease"),
commitNextVersion,
pushChanges
),
releaseCrossBuild := true,
publishMavenStyle := true,
credentials := Credentials(Path.userHome / ".sbt" / "sonatype_credentials") :: Nil,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
publishArtifact in Test := false,
pomIncludeRepository := { _ => false },
licenses := Seq(
Expand All @@ -206,17 +142,34 @@ lazy val root = project
.in(file("."))
.aggregate(core, fs2, zio, interop)
.settings(crossBuildSettings)
.settings(customCommands)
.settings(releaseSettings)
.settings(
name := "log-effect",
publishArtifact := false
publishArtifact := false,
addCommandAlias("format", ";scalafmt;test:scalafmt;scalafmtSbt"),
addCommandAlias(
"checkFormat",
";scalafmtCheck;test:scalafmtCheck;scalafmtSbtCheck"
),
addCommandAlias(
"ciBuild",
";clean;test"
),
addCommandAlias(
"fullBuild",
";checkFormat;ciBuild"
),
// travis release aliases
addCommandAlias(
"setReleaseOptions",
"set scalacOptions ++= Seq(\"-opt:l:method\", \"-opt:l:inline\", \"-opt-inline-from:laserdisc.**\", \"-opt-inline-from:<sources>\")"
),
addCommandAlias("releaseIt", ";clean;setReleaseOptions;session list;compile;ci-release")
)

lazy val core = project
.in(file("core"))
.settings(crossBuildSettings)
.settings(customCommands)
.settings(releaseSettings)
.settings(
name := "log-effect-core",
Expand All @@ -227,7 +180,6 @@ lazy val fs2 = project
.in(file("fs2"))
.dependsOn(core)
.settings(crossBuildSettings)
.settings(customCommands)
.settings(releaseSettings)
.settings(
name := "log-effect-fs2",
Expand All @@ -238,7 +190,6 @@ lazy val zio = project
.in(file("zio"))
.dependsOn(core)
.settings(crossBuildSettings)
.settings(customCommands)
.settings(releaseSettings)
.settings(
name := "log-effect-zio",
Expand All @@ -249,7 +200,6 @@ lazy val interop = project
.in(file("interop"))
.dependsOn(core, fs2)
.settings(crossBuildSettings)
.settings(customCommands)
.settings(releaseSettings)
.settings(
name := "log-effect-interop",
Expand Down
11 changes: 5 additions & 6 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.3")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0")
addSbtPlugin("com.dwijnand" % "sbt-travisci" % "1.2.0")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.3")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0")
addSbtPlugin("com.dwijnand" % "sbt-travisci" % "1.2.0")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.3")

0 comments on commit 7cdad14

Please sign in to comment.