Skip to content

Commit

Permalink
Scala 3 support, drop Scala 2.12, zio-sbt, integration tests as separ… (
Browse files Browse the repository at this point in the history
#304)

* Scala 3 support, drop Scala 2.12, zio-sbt, integration tests as separate module

* reinstating ci-release
  • Loading branch information
sirocchj authored Jan 11, 2024
1 parent cd220b0 commit 47dc2c6
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 109 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
strategy:
matrix:
scala:
- 2.12.18
- 2.13.12
- 3.3.1
java: [ '11', '17' ]
os:
- ubuntu-latest
Expand All @@ -41,10 +41,10 @@ jobs:
java-version: ${{ matrix.java }}
cache: 'sbt'
- name: Test (${{ matrix.scala }}, ${{ matrix.java }})
run: sbt ++${{ matrix.scala }} test
publish_212:
run: sbt ++${{ matrix.scala }} core/test testkit/test
publish_213:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
name: Publish Snapshot 2.12
name: Publish Snapshot 2.13
needs: build
runs-on: ubuntu-20.04
steps:
Expand All @@ -68,17 +68,17 @@ jobs:
target
project/target
key: ${{ runner.os }}-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: Publish Snapshot for Scala 2.12
run: CI_SNAPSHOT_RELEASE=publish sbt ++2.12.18 releaseIt
- name: Publish Snapshot for Scala 2.13
run: CI_SNAPSHOT_RELEASE=publish sbt ++2.13.12 releaseIt
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
publish_213:
publish_3:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
name: Publish Snapshot 2.13
needs: publish_212
name: Publish Snapshot 3
needs: publish_213
runs-on: ubuntu-20.04
steps:
- name: Branch Checkout
Expand All @@ -101,8 +101,8 @@ jobs:
target
project/target
key: ${{ runner.os }}-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: Publish Snapshot for Scala 2.13
run: CI_SNAPSHOT_RELEASE=publish sbt ++2.13.12 releaseIt
- name: Publish Snapshot for Scala 3
run: CI_SNAPSHOT_RELEASE=publish sbt ++3.3.1 releaseIt
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/it.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
if: contains(github.event.pull_request.labels.*.name, 'safe for integration tests')
strategy:
matrix:
scala: [2.12.18, 2.13.12]
scala: [2.13.12, 3.3.1]
java: [ '11', '17' ]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
Expand All @@ -33,7 +33,7 @@ jobs:
OCI_PRIVATE_KEY_BASE64: ${{ secrets.OCI_PRIVATE_KEY_BASE64 }}

- name: Test (${{ matrix.scala }}, ${{ matrix.java }})
run: sbt ++${{ matrix.scala }} "IntegrationTest / test"
run: sbt ++${{ matrix.scala }} integration-tests/test
env:
OCI_USER_ID: ${{ secrets.OCI_USER_ID }}
OCI_TENANT_ID: ${{ secrets.OCI_TENANT_ID }}
Expand Down
130 changes: 36 additions & 94 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,122 +1,64 @@
lazy val scala_212 = "2.12.18"
lazy val scala_213 = "2.13.12"

lazy val V = new {
val ociSdk = "3.30.0"
val scalaCollectionCompat = "2.11.0"
val zio = "2.0.19"
val `zio-nio` = "2.0.2"
val ociSdk = "3.31.1"
val `zio-nio` = "2.0.2"
}

lazy val D = new {
val objectStorage = Seq(
"com.oracle.oci.sdk" % "oci-java-sdk-objectstorage" % V.ociSdk
)

val scalaModules = Seq(
"org.scala-lang.modules" %% "scala-collection-compat" % V.scalaCollectionCompat
)

val zio = Seq(
"dev.zio" %% "zio" % V.zio,
"dev.zio" %% "zio-streams" % V.zio
)

val `zio-nio` = "dev.zio" %% "zio-nio" % V.`zio-nio`

val zioTest = Seq(
"dev.zio" %% "zio-test" % V.zio,
"dev.zio" %% "zio-test-sbt" % V.zio
)

val `httpclient-jersey` = "com.oracle.oci.sdk" % "oci-java-sdk-common-httpclient-jersey" % V.ociSdk
val objectStorage = "com.oracle.oci.sdk" % "oci-java-sdk-objectstorage" % V.ociSdk
val `zio-nio` = "dev.zio" %% "zio-nio" % V.`zio-nio`
val `httpclient-jersey` = "com.oracle.oci.sdk" % "oci-java-sdk-common-httpclient-jersey" % V.ociSdk % Test
}

lazy val flags = Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-explaintypes",
"-Yrangepos",
"-feature",
"-language:higherKinds",
"-language:existentials",
"-language:implicitConversions",
"-unchecked",
"-Xlint:_,-type-parameter-shadow",
"-Xsource:2.13",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Xfatal-warnings",
"-Ywarn-unused",
"-opt-warnings",
"-Xlint:constant",
"-Ywarn-extra-implicit"
)

def versionDependent(scalaVersion: String) =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, major)) if major >= 13 =>
flags ++ Seq(
"-Wconf:any:error",
"-Ymacro-annotations",
"-Xlint:-byname-implicit"
)
case _ =>
flags ++ Seq(
"-Xfuture",
"-Xlint:by-name-right-associative",
"-Xlint:unsound-match",
"-Yno-adapted-args",
"-Ypartial-unification",
"-Ywarn-inaccessible",
"-Ywarn-infer-any",
"-Ywarn-nullary-override",
"-Ywarn-nullary-unit"
)
}
enablePlugins(ZioSbtEcosystemPlugin)

lazy val commonSettings = Seq(
organization := "io.laserdisc",
scalaVersion := scala_213,
crossScalaVersions := Seq(scala_212, scala_213),
scalacOptions ++= versionDependent(scalaVersion.value),
homepage := Some(url("https://github.com/laserdisc-io/zio-oci-objectstorage")),
licenses += "MIT" -> url("http://opensource.org/licenses/MIT"),
developers += Developer("amir", "Amir Saeid", "[email protected]", url("https://github.com/amir"))
inThisBuild(
Seq(
name := "ZIO OCI ObjectStorage",
zioVersion := "2.0.21",
organization := "io.laserdisc",
scalaVersion := scala213.value,
crossScalaVersions := Seq(scala213.value, scala3.value),
homepage := Some(url("https://github.com/laserdisc-io/zio-oci-objectstorage")),
licenses += "MIT" -> url("http://opensource.org/licenses/MIT"),
developers += Developer("amir", "Amir Saeid", "[email protected]", url("https://github.com/amir"))
)
)

lazy val testkit = project
.in(file("testkit"))
.settings(commonSettings)
.settings(enableZIO(enableStreaming = true))
.settings(
name := "zio-oci-objectstorage-testkit",
libraryDependencies ++= D.zio ++ D.objectStorage ++ D.zioTest.map(_ % Test) :+ D.`zio-nio`,
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
libraryDependencies ++= D.objectStorage :: D.`zio-nio` :: Nil
)
.dependsOn(`zio-oci-objectstorage`)
.dependsOn(core)

lazy val `zio-oci-objectstorage` = project
lazy val core = project
.in(file("core"))
.configs(IntegrationTest)
.settings(commonSettings)
.settings(Defaults.itSettings)
.settings(enableZIO(enableStreaming = true))
.settings(
name := "zio-oci-objectstorage",
libraryDependencies ++= D.zio ++ D.objectStorage ++ D.scalaModules ++ (D.zioTest :+ D.`httpclient-jersey`).map(_ % "it,test"),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
libraryDependencies ++= D.objectStorage :: D.`httpclient-jersey` :: Nil
)

lazy val `integration-tests` = project
.in(file("it"))
.settings(enableZIO(enableStreaming = true))
.settings(
name := "zio-oci-objectstorage-it",
libraryDependencies ++= D.objectStorage :: D.`httpclient-jersey` :: Nil,
publish / skip := true
)
.dependsOn(core)

lazy val root = project
.in(file("."))
.aggregate(`zio-oci-objectstorage`, testkit)
.settings(commonSettings)
.aggregate(core, `integration-tests`, testkit)
.settings(
publish / skip := true,
addCommandAlias("fmtCheck", ";scalafmtCheckAll;scalafmtSbtCheck"),
addCommandAlias("fmt", ";Test / scalafmtAll;scalafmtAll;scalafmtSbt;Test / scalafmtAll"),
addCommandAlias("fullTest", ";clean;test;IntegrationTest / test"),
addCommandAlias("fmt", ";scalafmtAll;scalafmtSbt;Test/scalafmtAll"),
addCommandAlias("fullTest", ";clean;test"),
addCommandAlias(
"setReleaseOptions",
"set scalacOptions ++= Seq(\"-opt:l:method\", \"-opt:l:inline\", \"-opt-inline-from:laserdisc.**\", \"-opt-inline-from:<sources>\")"
Expand Down
5 changes: 3 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("dev.zio" % "zio-sbt-ecosystem" % "0.4.0-alpha.22")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")

0 comments on commit 47dc2c6

Please sign in to comment.