diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1f257918..b5bd9c4f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: - name: Run test container run: docker-compose -f docker-compose.yml up -d - name: Run integration tests - run: ./sbt ++${{ matrix.scala }}! it:test + run: ./sbt ++${{ matrix.scala }}! integration/test website: runs-on: ubuntu-20.04 diff --git a/build.sbt b/build.sbt index a6e187c1f..4126a3d93 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,4 @@ import BuildHelper._ -import sbt.librarymanagement.Configurations.IntegrationTest Global / onChangedBuildSource := ReloadOnSourceChanges @@ -34,7 +33,7 @@ lazy val root = project .in(file(".")) .settings(publish / skip := true) - .aggregate(library, example, docs) + .aggregate(library, integration, example, docs) lazy val library = project @@ -44,9 +43,7 @@ lazy val library = .settings(stdSettings("zio-elasticsearch")) .settings(buildInfoSettings("zio.elasticsearch")) .settings(scalacOptions += "-language:higherKinds") - .configs(IntegrationTest.extend(Test)) .settings( - Defaults.itSettings, libraryDependencies ++= List( "com.softwaremill.sttp.client3" %% "zio" % "3.8.16", "com.softwaremill.sttp.client3" %% "zio-json" % "3.8.16", @@ -55,12 +52,22 @@ lazy val library = "dev.zio" %% "zio-schema" % "0.4.12", "dev.zio" %% "zio-schema-json" % "0.4.12", "org.apache.commons" % "commons-lang3" % "3.12.0", - "dev.zio" %% "zio-test" % "2.0.15" % Tests, - "dev.zio" %% "zio-test-sbt" % "2.0.15" % Tests + "dev.zio" %% "zio-test" % "2.0.15" % Test, + "dev.zio" %% "zio-test-sbt" % "2.0.15" % Test ), testFrameworks := List(new TestFramework("zio.test.sbt.ZTestFramework")) ) +lazy val integration = + project + .in(file("modules/integration")) + .disablePlugins(RevolverPlugin) + .settings(stdSettings("integration")) + .dependsOn(library % "test->test") + .settings( + publish / skip := true + ) + lazy val example = project .in(file("modules/example")) @@ -102,5 +109,3 @@ lazy val docs = docusaurusCreateSite := docusaurusCreateSite.dependsOn(Compile / unidoc).value, docusaurusPublishGhpages := docusaurusPublishGhpages.dependsOn(Compile / unidoc).value ) - -val Tests = List(IntegrationTest, Test).mkString(",") diff --git a/modules/library/src/it/scala/zio/elasticsearch/HttpExecutorSpec.scala b/modules/integration/src/test/scala/zio/elasticsearch/HttpExecutorSpec.scala similarity index 99% rename from modules/library/src/it/scala/zio/elasticsearch/HttpExecutorSpec.scala rename to modules/integration/src/test/scala/zio/elasticsearch/HttpExecutorSpec.scala index 81f190f14..447e12c2a 100644 --- a/modules/library/src/it/scala/zio/elasticsearch/HttpExecutorSpec.scala +++ b/modules/integration/src/test/scala/zio/elasticsearch/HttpExecutorSpec.scala @@ -27,13 +27,11 @@ import zio.elasticsearch.domain.{PartialTestDocument, TestDocument, TestSubDocum import zio.elasticsearch.executor.Executor import zio.elasticsearch.query.DistanceUnit.Kilometers import zio.elasticsearch.query.FunctionScoreFunction.randomScoreFunction -import zio.elasticsearch.query.{FunctionScoreBoostMode, FunctionScoreFunction, InnerHits} import zio.elasticsearch.query.sort.SortMode.Max import zio.elasticsearch.query.sort.SortOrder._ import zio.elasticsearch.query.sort.SourceType.NumberType -import zio.elasticsearch.query.{Distance, FunctionScoreBoostMode, FunctionScoreFunction} +import zio.elasticsearch.query.{Distance, FunctionScoreBoostMode, FunctionScoreFunction, InnerHits} import zio.elasticsearch.request.{CreationOutcome, DeletionOutcome} -import zio.elasticsearch.result._ import zio.elasticsearch.result.{Item, MaxAggregationResult, UpdateByQueryResult} import zio.elasticsearch.script.{Painless, Script} import zio.json.ast.Json.{Arr, Str} @@ -129,7 +127,6 @@ object HttpExecutorSpec extends IntegrationSpec { Executor.execute(ElasticRequest.deleteIndex(firstSearchIndex)).orDie ), test("aggregate using min aggregation") { - val expectedResponse = ("aggregationInt", MinAggregationResult(value = 23.0)) checkOnce(genDocumentId, genTestDocument, genDocumentId, genTestDocument) { (firstDocumentId, firstDocument, secondDocumentId, secondDocument) => for { diff --git a/modules/library/src/it/scala/zio/elasticsearch/IntegrationSpec.scala b/modules/integration/src/test/scala/zio/elasticsearch/IntegrationSpec.scala similarity index 100% rename from modules/library/src/it/scala/zio/elasticsearch/IntegrationSpec.scala rename to modules/integration/src/test/scala/zio/elasticsearch/IntegrationSpec.scala index e330e874e..92dfc8357 100644 --- a/modules/library/src/it/scala/zio/elasticsearch/IntegrationSpec.scala +++ b/modules/integration/src/test/scala/zio/elasticsearch/IntegrationSpec.scala @@ -22,11 +22,11 @@ import zio.elasticsearch.ElasticQuery.matchAll import zio.elasticsearch.data.GeoPoint import zio.elasticsearch.domain._ import zio.elasticsearch.executor.Executor +import zio.elasticsearch.utils.unsafeWrap import zio.test.Assertion.{containsString, hasMessage} import zio.test.CheckVariants.CheckN import zio.test.TestAspect.beforeAll import zio.test.{Assertion, Gen, TestAspect, ZIOSpecDefault, checkN} -import zio.elasticsearch.utils.unsafeWrap import java.time.LocalDate diff --git a/project/BuildHelper.scala b/project/BuildHelper.scala index 47b6920dc..58d311038 100644 --- a/project/BuildHelper.scala +++ b/project/BuildHelper.scala @@ -18,10 +18,9 @@ object BuildHelper { scalacOptions := stdOptions ++ extraOptions(scalaVersion.value), semanticdbEnabled := scalaVersion.value != Scala3, // enable SemanticDB semanticdbOptions += "-P:semanticdb:synthetics:on", - semanticdbVersion := scalafixSemanticdb.revision, - ThisBuild / scalafixScalaBinaryVersion := CrossVersion.binaryScalaVersion(scalaVersion.value), - ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.6.0", - Test / parallelExecution := true, + semanticdbVersion := scalafixSemanticdb.revision, + ThisBuild / scalafixScalaBinaryVersion := CrossVersion.binaryScalaVersion(scalaVersion.value), + Test / parallelExecution := true, incOptions ~= (_.withLogRecompileOnMacro(false)), autoAPIMappings := true )