diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9d53fbc..544e63c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,8 +26,8 @@ jobs: strategy: matrix: scala: - - 2.12.18 - 2.13.12 + - 3.3.1 java: [ '11', '17' ] os: - ubuntu-latest @@ -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: @@ -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 @@ -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 }} diff --git a/.github/workflows/it.yaml b/.github/workflows/it.yaml index 9466f7e..073bb18 100644 --- a/.github/workflows/it.yaml +++ b/.github/workflows/it.yaml @@ -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 }} @@ -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 }} diff --git a/build.sbt b/build.sbt index 32a47ef..0480d57 100644 --- a/build.sbt +++ b/build.sbt @@ -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", "amir@glgdgt.com", 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", "amir@glgdgt.com", 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:\")" diff --git a/core/src/it/scala/zio/oci/objectstorage/ObjectStorageTest.scala b/it/src/test/scala/zio/oci/objectstorage/ObjectStorageTest.scala similarity index 100% rename from core/src/it/scala/zio/oci/objectstorage/ObjectStorageTest.scala rename to it/src/test/scala/zio/oci/objectstorage/ObjectStorageTest.scala diff --git a/project/plugins.sbt b/project/plugins.sbt index b96fb42..0da064d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -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")