From 73535cce027c779b26458705c79279b2ba7871bf Mon Sep 17 00:00:00 2001 From: Filippo Mariotti Date: Thu, 25 Jun 2020 12:45:51 +0100 Subject: [PATCH 1/2] Swithced to sbt-ci-release --- .travis.yml | 83 ++++++++++++++++++++++++++++++++++------- build.sbt | 90 ++++++++++----------------------------------- project/plugins.sbt | 11 +++--- 3 files changed, 94 insertions(+), 90 deletions(-) diff --git a/.travis.yml b/.travis.yml index bd6a5691..ef263850 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,81 @@ 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 + +after_success: + - bash <(curl -s https://codecov.io/bash) + +sbt_args: -Dfile.encoding=UTF8 -Dsbt.color=always -Dsbt.supershell=false + +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 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 -script: - - sbt ++$TRAVIS_SCALA_VERSION fullCiBuild + - 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" diff --git a/build.sbt b/build.sbt index c2b734f8..bd89c2e6 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,3 @@ -import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ - lazy val scala212Options = Seq( "-deprecation", "-encoding", @@ -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( @@ -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:\")" + ), + 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", @@ -227,7 +180,6 @@ lazy val fs2 = project .in(file("fs2")) .dependsOn(core) .settings(crossBuildSettings) - .settings(customCommands) .settings(releaseSettings) .settings( name := "log-effect-fs2", @@ -238,7 +190,6 @@ lazy val zio = project .in(file("zio")) .dependsOn(core) .settings(crossBuildSettings) - .settings(customCommands) .settings(releaseSettings) .settings( name := "log-effect-zio", @@ -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", diff --git a/project/plugins.sbt b/project/plugins.sbt index 58bd6467..2d356f04 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -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") From 9a4b0c6885832c6487b18646f12a913c0aa6189d Mon Sep 17 00:00:00 2001 From: Filippo Mariotti Date: Thu, 25 Jun 2020 12:53:02 +0100 Subject: [PATCH 2/2] Removed codecove push --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index ef263850..62683380 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,10 +10,7 @@ before_cache: - find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete - find $HOME/.sbt -name "*.lock" -print -delete -after_success: - - bash <(curl -s https://codecov.io/bash) - -sbt_args: -Dfile.encoding=UTF8 -Dsbt.color=always -Dsbt.supershell=false +sbt_args: -Dfile.encoding=UTF8 -Dsbt.color=always stages: - name: Format