Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add elastic library #233

Merged
merged 7 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ jobs:
java-version: 17
cache: sbt

- run: docker compose up -d

- name: Check that workflows are up to date
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck

- name: Build project
run: sbt '++ ${{ matrix.scala }}' test

- name: Compress target directories
run: tar cf targets.tar akka-components-persistence-projection-lagom-api/.js/target akka-components-testkit/target akka-components-persistence-projection-api/.jvm/target target schevo/.js/target akka-components-persistence-projection-api/.js/target lagom-api-circe/.jvm/target common-circe/.js/target akka-stream-utils/jvm/target akka-components-persistence-projection/target akka-components-persistence-projection-r2dbc/target akka-components-persistence-projection-cassandra/target akka-stream-utils/js/target schevo-circe/.js/target lagom-server-circe/target schevo/.jvm/target akka-components-persistence-utils/target akka-components-persistence-projection-lagom-api/.jvm/target akka-components-persistence-cassandra-lagom-api/.jvm/target common-circe/.jvm/target akka-components-persistence-cassandra-lagom-api/.js/target akka-circe/target lagom-api-circe/.js/target akka-components-persistence-projection-lagom/target akka-components/target lagom-server-circe-testkit/target akka-components-lagom/target schevo-circe-example-akka/target schevo-circe/.jvm/target logstage-elastic/target common-tzdb/.js/target akka-components-persistence-cassandra-lagom/target project/target
run: tar cf targets.tar akka-components-persistence-projection-lagom-api/.js/target akka-components-testkit/target akka-components-persistence-projection-api/.jvm/target target schevo/.js/target elastic/core/target akka-components-persistence-projection-api/.js/target lagom-api-circe/.jvm/target common-circe/.js/target akka-stream-utils/jvm/target akka-components-persistence-projection/target akka-components-persistence-projection-r2dbc/target akka-components-persistence-projection-cassandra/target akka-stream-utils/js/target schevo-circe/.js/target lagom-server-circe/target schevo/.jvm/target akka-components-persistence-utils/target elastic/lagom/service/target akka-components-persistence-projection-lagom-api/.jvm/target akka-components-persistence-cassandra-lagom-api/.jvm/target common-circe/.jvm/target akka-components-persistence-cassandra-lagom-api/.js/target akka-circe/target lagom-api-circe/.js/target akka-components-persistence-projection-lagom/target akka-components/target lagom-server-circe-testkit/target akka-components-lagom/target schevo-circe-example-akka/target schevo-circe/.jvm/target elastic/lagom/api/.jvm/target logstage-elastic/target common-tzdb/.js/target akka-components-persistence-cassandra-lagom/target elastic/lagom/api/.js/target project/target

- name: Upload target directories
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -79,6 +81,8 @@ jobs:
java-version: 17
cache: sbt

- run: docker compose up -d

- name: Download target directories (2.13.11)
uses: actions/download-artifact@v3
with:
Expand Down
54 changes: 52 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Dependencies._
import Dependencies.*
import sbtcrossproject.CrossType
import sbtghactions.JavaSpec.Distribution.Adopt

Expand Down Expand Up @@ -28,6 +28,10 @@ lazy val sc8s = (project in file("."))
`common-circe`.js,
`common-circe`.jvm,
`common-tzdb`.js,
`elastic-core`,
`elastic-lagom-api`.js,
`elastic-lagom-api`.jvm,
`elastic-lagom-service`,
`lagom-api-circe`.js,
`lagom-api-circe`.jvm,
`lagom-server-circe-testkit`,
Expand Down Expand Up @@ -320,6 +324,47 @@ lazy val `akka-stream-utils` = crossProject(JSPlatform, JVMPlatform)
idePackagePrefix := Some("net.sc8s.akka.stream")
)

lazy val `elastic-core` = (project in file("elastic/core"))
.settings(
libraryDependencies ++= Seq(
scalaTest.value % Test,
akka.actor,
akka.typed,
akka.stream,
akka.testkitTyped % Test,
elastic4s.core,
elastic4s.jsonCirce,
elastic4s.clientAkka % Test,
elastic4s.testkit % Test,
elastic4s.elasticTestFramework % Test,
elastic4s.httpStreams,
circe.core.value,
circe.parser.value,
circe.generic.value,
circe.genericExtras.value,
nameOf,
macwire.macros,
),
)
.dependsOn(`logstage-elastic`, `schevo-circe`.jvm, `akka-stream-utils`.jvm, `akka-components`)

lazy val `elastic-lagom-api` =
crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("elastic/lagom/api"))
.jvmSettings(libraryDependencies += lagom.scaladslApi)
.jsSettings(libraryDependencies += lagom.js.scalaDslApi.value)

lazy val `elastic-lagom-service` = (project in file("elastic/lagom/service"))
.settings(
libraryDependencies ++= Seq(
elastic4s.core,
elastic4s.clientAkka,
macwire.macros
)
)
.dependsOn(`elastic-core`, `elastic-lagom-api`.jvm)

// empty project to avoid regeneration in other projects https://github.com/cquiroz/sbt-tzdb/issues/88
lazy val `common-tzdb` = crossProject(JSPlatform)
.crossType(CrossType.Pure)
Expand All @@ -346,6 +391,9 @@ inThisBuild(Seq(
libraryDependencySchemes ++= Seq(
"org.scala-lang.modules" %% "scala-java8-compat" % "always",
),
resolvers ++= Seq(
"antex public" at "https://mymavenrepo.com/repo/zeKhQjbzBED1vIds46Kj/"
),
scmInfo := Some(ScmInfo(url("https://github.com/an-tex/sc8s"), "scm:git:git://github.com/an-tex/sc8s.git")),
githubWorkflowJavaVersions := Seq(JavaSpec(Adopt, "11.0.13+8")),
githubWorkflowTargetTags := Seq("*"),
Expand All @@ -358,6 +406,7 @@ inThisBuild(Seq(
"SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}"
)
)),
githubWorkflowJobSetup += WorkflowStep.Run(List("docker compose up -d")),
githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v"))),
versionScheme := Some("early-semver"),
dependencyOverrides ++= Dependencies.overrides ++ Seq(
Expand All @@ -368,4 +417,5 @@ inThisBuild(Seq(
githubWorkflowJavaVersions := Seq(JavaSpec.temurin("17"))
))

Global / excludeLintKeys += idePackagePrefix
Global / excludeLintKeys += idePackagePrefix
Global / onChangedBuildSource := ReloadOnSourceChanges
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# used for tests only

services:
elastic8:
image: docker.elastic.co/elasticsearch/elasticsearch:8.8.2
restart: always
environment:
discovery.type: single-node
network.host: 0.0.0.0
xpack.security.http.ssl.enabled: false
xpack.security.enabled: false
ports:
- 9210:9200
- 9310:9300
deploy:
resources:
limits:
memory: 1024M
3 changes: 3 additions & 0 deletions elastic/core/src/main/resources/logback-elastic-evolution.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<included>
<logger name="com.sksamuel.elastic4s.streams.PublishActor" level="WARN"/>
</included>
Loading