Skip to content

Commit

Permalink
Migrate to sbt-ci-release
Browse files Browse the repository at this point in the history
  • Loading branch information
guizmaii committed Sep 4, 2023
1 parent b31168f commit b0b53d1
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 246 deletions.
68 changes: 32 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,51 +18,47 @@ jobs:

strategy:
matrix:
scala: [3.3.0]
module: [sqltest, db, async, bigdata]
scala: [ 3.3.0 ]
module: [ sqltest, db, async, bigdata ]

steps:
- uses: actions/checkout@v2
- name: Setup Java and Scala
uses: actions/setup-java@v3.10.0
with:
distribution: temurin
java-version: '8'
check-latest: true
- uses: actions/checkout@v2
- name: Setup Java and Scala
uses: actions/setup-java@v3.10.0
with:
distribution: temurin
java-version: '8'
check-latest: true

- name: Scala ${{ matrix.scala }} Building ${{ matrix.module }}
env:
SCALA_VERSION: ${{ matrix.scala }}
run: |
echo "SCALA_VERSION='$SCALA_VERSION'"
./build/build.sh ${{ matrix.module }}
- name: Scala ${{ matrix.scala }} Building ${{ matrix.module }}
env:
SCALA_VERSION: ${{ matrix.scala }}
run: |
echo "SCALA_VERSION='$SCALA_VERSION'"
./build/build.sh ${{ matrix.module }}
release:
if: ${{github.event_name != 'pull_request'}}
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
scala: [3.3.0]
module: [base, db, async, bigdata, publish]
scala: [ 3.3.0 ]
module: [ base, db, async, bigdata, publish ]

steps:
- uses: actions/checkout@v2
- name: Setup Java and Scala
uses: actions/setup-java@v3.10.0
with:
distribution: temurin
java-version: '8'
check-latest: true
- run: |
echo "PULL_REQUEST='$PULL_REQUEST'"
export BRANCH=$(git for-each-ref ${{ github.ref }} --format='%(refname:short)')
echo "BRANCH='$BRANCH'"
./build/release.sh ${{ matrix.module }}
env:
ENCRYPTION_PASSWORD: ${{ secrets.ENCRYPTION_PASSWORD }}
PULL_REQUEST: ${{ !!github.event.pull_request }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
- uses: actions/checkout@v2
- name: Setup Java and Scala
uses: actions/setup-java@v3.10.0
with:
distribution: temurin
java-version: '8'
check-latest: true
- run: sbt ci-release
env:
ENCRYPTION_PASSWORD: ${{ secrets.ENCRYPTION_PASSWORD }}
PULL_REQUEST: ${{ !!github.event.pull_request }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
91 changes: 1 addition & 90 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,36 +1,10 @@
import ReleaseTransformations._
//import com.typesafe.sbt.SbtScalariform.ScalariformKeys
//import scalariform.formatter.preferences._
import com.jsuereth.sbtpgp.PgpKeys.publishSigned
import sbtrelease.ReleasePlugin
import scala.sys.process.Process
import java.io.{File => JFile}

ThisBuild / versionScheme := Some("always")

addCommandAlias("runCommunityBuild", "; quill-sql/test; quill-sql-tests/test; quill-cassandra/Test/compile")
addCommandAlias("fmt", "all scalafmt test:scalafmt")

// During release cycles, GPG will expect passphrase user-input EVEN when --passphrase is specified
// this should add --pinentry-loopback in order to disable that. See here for more info:
// https://github.com/sbt/sbt-pgp/issues/178
Global / useGpgPinentry := true

releaseVersion := { ver =>
println(s"=== Releasing on initially specified version: ${ver}")
ver
}
releaseNextVersion := { ver =>
val withoutLast = ver.reverse.dropWhile(_.isDigit).reverse
val last = ver.reverse.takeWhile(_.isDigit).reverse
println(s"=== Detected original version: ${ver}. Which is ${withoutLast} + ${last}")
// see if the last group of chars are numeric, if they are, just increment
val actualLast = scala.util.Try(last.toInt).map(i => (i + 1).toString).getOrElse(last)
val newVer = withoutLast + actualLast + "-SNAPSHOT"
println(s"=== Final computed version is: ${newVer}")
newVer
}

val isCommunityBuild =
sys.props.getOrElse("community", "false").toBoolean

Expand Down Expand Up @@ -106,10 +80,6 @@ val filteredModules = {
lazy val `quill` = {
(project in file("."))
.settings(commonSettings: _*)
// Unless release settings bubbled up here, they won't actually be used for the project
// release. E.g. if you don't want to run tests on a release (i.e. if they were run on a previous step)
// and release-settings here are not included tests will still be run etc...
.settings(releaseSettings: _*)
.aggregate(filteredModules.map(_.project): _*)
.dependsOn(filteredModules: _*)
.settings(
Expand All @@ -123,7 +93,6 @@ lazy val `quill` = {
lazy val `quill-sql` =
(project in file("quill-sql"))
.settings(commonSettings: _*)
.settings(releaseSettings: _*)
.settings(
resolvers ++= Seq(
Resolver.mavenLocal,
Expand Down Expand Up @@ -158,6 +127,7 @@ lazy val `quill-sql` =
// Moving heavy tests to separate module so it can be compiled in parallel with others
lazy val `quill-sql-tests` =
(project in file("quill-sql-tests"))
.settings(publish / skip := true)
.settings(commonSettings: _*)
.settings(
Test / testOptions += Tests.Argument("-oF")
Expand All @@ -169,15 +139,13 @@ lazy val `quill-sql-tests` =
lazy val `quill-jdbc` =
(project in file("quill-jdbc"))
.settings(commonSettings: _*)
.settings(releaseSettings: _*)
.settings(jdbcTestingSettings: _*)
.dependsOn(`quill-sql` % "compile->compile;test->test")

ThisBuild / libraryDependencySchemes += "org.typelevel" %% "cats-effect" % "always"
lazy val `quill-doobie` =
(project in file("quill-doobie"))
.settings(commonSettings: _*)
.settings(releaseSettings: _*)
.settings(jdbcTestingSettings: _*)
.settings(
libraryDependencies ++= Seq(
Expand All @@ -190,7 +158,6 @@ lazy val `quill-doobie` =
lazy val `quill-jasync` =
(project in file("quill-jasync"))
.settings(commonSettings: _*)
.settings(releaseSettings: _*)
.settings(
Test / fork := true,
libraryDependencies ++= Seq(
Expand All @@ -202,7 +169,6 @@ lazy val `quill-jasync` =
lazy val `quill-jasync-postgres` =
(project in file("quill-jasync-postgres"))
.settings(commonSettings: _*)
.settings(releaseSettings: _*)
.settings(
Test / fork := true,
libraryDependencies ++= Seq(
Expand All @@ -214,7 +180,6 @@ lazy val `quill-jasync-postgres` =
lazy val `quill-caliban` =
(project in file("quill-caliban"))
.settings(commonSettings: _*)
.settings(releaseSettings: _*)
.settings(
Test / fork := true,
libraryDependencies ++= Seq(
Expand All @@ -235,7 +200,6 @@ lazy val `quill-caliban` =
lazy val `quill-zio` =
(project in file("quill-zio"))
.settings(commonSettings: _*)
.settings(releaseSettings: _*)
.settings(
Test / fork := true,
libraryDependencies ++= Seq(
Expand All @@ -248,7 +212,6 @@ lazy val `quill-zio` =
lazy val `quill-jdbc-zio` =
(project in file("quill-jdbc-zio"))
.settings(commonSettings: _*)
.settings(releaseSettings: _*)
.settings(jdbcTestingLibraries: _*)
.settings(
libraryDependencies ++= Seq(
Expand Down Expand Up @@ -276,7 +239,6 @@ lazy val `quill-jdbc-zio` =
lazy val `quill-cassandra` =
(project in file("quill-cassandra"))
.settings(commonSettings: _*)
.settings(releaseSettings: _*)
.settings(
Test / fork := false,
libraryDependencies ++= Seq(
Expand All @@ -288,7 +250,6 @@ lazy val `quill-cassandra` =
lazy val `quill-cassandra-zio` =
(project in file("quill-cassandra-zio"))
.settings(commonSettings: _*)
.settings(releaseSettings: _*)
.settings(
Test / fork := true,
libraryDependencies ++= Seq(
Expand Down Expand Up @@ -358,53 +319,3 @@ lazy val basicSettings = Seq(
"-language:implicitConversions", "-explain"
)
)

lazy val releaseSettings = ReleasePlugin.extraReleaseCommands ++ Seq(
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
publishMavenStyle := true,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
pgpSecretRing := file("local.secring.gpg"),
pgpPublicRing := file("local.pubring.gpg"),
releaseVersionBump := sbtrelease.Version.Bump.Next,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
releaseProcess := {
Seq[ReleaseStep]() ++
doOnDefault(checkSnapshotDependencies) ++
doOnDefault(inquireVersions) ++
doOnDefault(runClean) ++
doOnPush (setReleaseVersion) ++
doOnPush (commitReleaseVersion) ++
doOnPush (tagRelease) ++
doOnDefault(publishArtifacts) ++
doOnPush (setNextVersion) ++
doOnPush (commitNextVersion) ++
//doOnPush(releaseStepCommand("sonatypeReleaseAll")) ++
doOnPush (pushChanges)
},
homepage := Some(url("http://github.com/getquill/protoquill")),
licenses := List(("Apache License 2.0", url("https://raw.githubusercontent.com/getquill/protoquill/master/LICENSE.txt"))),
developers := List(
Developer("deusaquilus", "Alexander Ioffe", "", url("https://github.com/deusaquilus"))
),
scmInfo := Some(
ScmInfo(url("https://github.com/getquill/protoquill"), "git:git@github.com:getquill/protoquill.git")
)
)

def doOnDefault(steps: ReleaseStep*): Seq[ReleaseStep] =
Seq[ReleaseStep](steps: _*)

def doOnPush(steps: ReleaseStep*): Seq[ReleaseStep] =
if (skipPush)
Seq[ReleaseStep]()
else
Seq[ReleaseStep](steps: _*)

val skipPush =
sys.props.getOrElse("skipPush", "false").toBoolean
Binary file removed build/credentials.sbt.enc
Binary file not shown.
Binary file removed build/deploy_key.pem.enc
Binary file not shown.
Binary file removed build/pubring.gpg.enc
Binary file not shown.
116 changes: 0 additions & 116 deletions build/release.sh

This file was deleted.

Binary file removed build/secring.gpg.enc
Binary file not shown.
Loading

0 comments on commit b0b53d1

Please sign in to comment.