Skip to content

Commit

Permalink
Merge pull request #18 from commercetools/prepare-opensource
Browse files Browse the repository at this point in the history
Prepare open sourcing
  • Loading branch information
satabin committed May 14, 2024
2 parents 71a4b3b + 18d4f47 commit d30f33e
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ jobs:

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p unidocs/target project/target
run: mkdir -p circe/.jvm/target unidocs/target otel4s/.jvm/target aws/sqs/.jvm/target core/.jvm/target azure/service-bus/.jvm/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: tar cf targets.tar unidocs/target project/target
run: tar cf targets.tar circe/.jvm/target unidocs/target otel4s/.jvm/target aws/sqs/.jvm/target core/.jvm/target azure/service-bus/.jvm/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
Expand Down Expand Up @@ -211,7 +211,7 @@ jobs:

- name: Publish site
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3.9.3
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site/target/docs/site
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import software.amazon.awssdk.services.sqs.SqsAsyncClient
import software.amazon.awssdk.services.sqs.model.{MessageSystemAttributeName, ReceiveMessageRequest}

import java.time.Instant
import scala.annotation.nowarn
import scala.concurrent.duration.FiniteDuration
import scala.jdk.CollectionConverters._

Expand All @@ -50,7 +51,8 @@ class SQSPuller[F[_], T](
.maxNumberOfMessages(batchSize)
.waitTimeSeconds(waitingTime.toSeconds.toInt)
.attributeNamesWithStrings(MessageSystemAttributeName.SENT_TIMESTAMP.toString())
.build())
.build(): @nowarn("msg=method attributeNamesWithStrings in trait Builder is deprecated")
)
}
}.flatMap { response =>
Chunk
Expand All @@ -61,8 +63,11 @@ class SQSPuller[F[_], T](
.map { payload =>
new SQSMessageContext(
payload = payload,
enqueuedAt =
Instant.ofEpochMilli(message.attributes().get(MessageSystemAttributeName.SENT_TIMESTAMP).toLong),
enqueuedAt = Instant.ofEpochMilli(
message
.attributes()
.get(MessageSystemAttributeName.SENT_TIMESTAMP)
.toLong),
metadata = message.attributesAsStrings().asScala.toMap,
receiptHandle = message.receiptHandle(),
messageId = message.messageId(),
Expand Down
15 changes: 6 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ ThisBuild / startYear := Some(2024)
ThisBuild / licenses := Seq(License.Apache2)
ThisBuild / tlCiDependencyGraphJob := false

val Scala213 = "2.13.12"
val Scala213 = "2.13.14"
ThisBuild / crossScalaVersions := Seq(Scala213, "3.3.3")
ThisBuild / scalaVersion := Scala213

ThisBuild / tlSonatypeUseLegacyHost := true

lazy val root = tlCrossRootProject.aggregate(core, azureServiceBus, awsSQS, awsSqsIt, circe, otel4s, unidocs)

ThisBuild / tlSitePublishBranch := Some("main")
Expand All @@ -36,7 +38,6 @@ val commonSettings = List(
lazy val core = crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("core"))
.enablePlugins(NoPublishPlugin)
.settings(commonSettings)
.settings(
name := "fs2-queues-core"
Expand Down Expand Up @@ -68,21 +69,19 @@ ThisBuild / githubWorkflowBuildPreamble := List(
lazy val otel4s = crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("otel4s"))
.enablePlugins(NoPublishPlugin)
.settings(commonSettings)
.settings(
name := "fs2-queues-otel4s",
description := "Support for metrics and tracing using otel4s",
libraryDependencies ++= List(
"org.typelevel" %%% "otel4s-core" % "0.4.0"
"org.typelevel" %%% "otel4s-core" % "0.7.0"
)
)
.dependsOn(core % "compile->compile;test->test")

lazy val circe = crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("circe"))
.enablePlugins(NoPublishPlugin)
.settings(commonSettings)
.settings(
name := "fs2-queues-circe",
Expand All @@ -95,25 +94,23 @@ lazy val circe = crossProject(JVMPlatform)
lazy val azureServiceBus = crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("azure/service-bus"))
.enablePlugins(NoPublishPlugin)
.settings(commonSettings)
.settings(
name := "fs2-queues-azure-service-bus",
libraryDependencies ++= List(
"com.azure" % "azure-messaging-servicebus" % "7.15.1"
"com.azure" % "azure-messaging-servicebus" % "7.17.0"
)
)
.dependsOn(core, testkit % Test)

lazy val awsSQS = crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("aws/sqs"))
.enablePlugins(NoPublishPlugin)
.settings(commonSettings)
.settings(
name := "fs2-queues-aws-sqs",
libraryDependencies ++= List(
"software.amazon.awssdk" % "sqs" % "2.18.35"
"software.amazon.awssdk" % "sqs" % "2.25.50"
)
)
.dependsOn(core)
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.8"
services:
localstack:
container_name: sqs
image: localstack/localstack
image: localstack/localstack:latest
ports:
- "127.0.0.1:4566:4566"
environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ object MeasuringQueueClient {
case inner: MeasuringQueueClient[F] => wrap(inner.underlying)
case _ =>
meter
.counter(requestMetricsName)
.counter[Long](requestMetricsName)
.withUnit("call")
.withDescription("Counts the calls to the underlying queue service")
.create
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ import org.typelevel.otel4s.Attribute
import org.typelevel.otel4s.meta.InstrumentMeta
import org.typelevel.otel4s.metrics.Counter

import scala.collection.immutable

class NaiveCounter(val records: Ref[IO, Chain[(Long, List[Attribute[_]])]]) extends Counter[IO, Long] {

override val backend: Counter.Backend[IO, Long] = new Counter.LongBackend[IO] {

override val meta: InstrumentMeta[IO] = InstrumentMeta.enabled

override def add(value: Long, attributes: Attribute[_]*): IO[Unit] =
override def add(value: Long, attributes: immutable.Iterable[Attribute[_]]): IO[Unit] =
records.update(_.append((value, attributes.toList)))

}
Expand Down
4 changes: 2 additions & 2 deletions project/Version.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
object Versions {
val fs2 = "3.9.4"
val fs2 = "3.10.2"
val http4s = "0.23.25"
val munit = "0.7.29"
val munitCatsEffect = "1.0.7"
val circe = "0.14.6"
val circe = "0.14.7"
val circeGenericExtras = "0.14.3"
}
6 changes: 3 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.7")
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.6.7")
addSbtPlugin("org.typelevel" % "sbt-typelevel-scalafix" % "0.6.7")
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.7.1")
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.7.1")
addSbtPlugin("org.typelevel" % "sbt-typelevel-scalafix" % "0.7.1")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.2")

0 comments on commit d30f33e

Please sign in to comment.