From 7ce98dc7cc6d8a3abb438f31cb726c307871afb9 Mon Sep 17 00:00:00 2001 From: Christopher Davenport Date: Mon, 3 Apr 2023 08:24:56 -0700 Subject: [PATCH 1/8] Add Timeout Mechanism, default to 60 seconds --- build.sbt | 4 +- .../rediculous/RedisConnection.scala | 63 ++++++++++++++----- .../rediculous/RedisPubSub.scala | 7 +-- 3 files changed, 52 insertions(+), 22 deletions(-) diff --git a/build.sbt b/build.sbt index 0f03833..975fb96 100644 --- a/build.sbt +++ b/build.sbt @@ -15,8 +15,8 @@ ThisBuild / tlSonatypeUseLegacyHost := true val catsV = "2.8.0" -val catsEffectV = "3.3.14" -val fs2V = "3.3.0" +val catsEffectV = "3.4.8" +val fs2V = "3.6.1" val munitCatsEffectV = "2.0.0-M3" diff --git a/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisConnection.scala b/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisConnection.scala index 9b2563c..b0d8cf5 100644 --- a/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisConnection.scala +++ b/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisConnection.scala @@ -80,9 +80,14 @@ object RedisConnection{ val out = calls.flatMap(resp => Resp.CodecUtils.codec.encode(resp).toEither.traverse(bits => Chunk.byteVector(bits.bytes)) ).sequence.leftMap(err => new Throwable(s"Failed To Encode Response $err")).liftTo[F] - out.flatMap(socket.write) >> - Stream.eval(socket.read(maxBytes)).repeat.unNoneTerminate.unchunks.through(fs2.interop.scodec.StreamDecoder.many(Resp.CodecUtils.codec).toPipeByte) - .take(calls.size) + out.flatMap(socket.write) >> + Stream.eval(socket.read(maxBytes)) + .repeat + .debug(c => c.map(_.toByteVector.decodeAsciiLenient).toString) + .unNoneTerminate + .unchunks + .through(fs2.interop.scodec.StreamDecoder.many(Resp.CodecUtils.codec).toPipeByte) + .take(calls.size.toLong) .compile .to(Chunk) } @@ -102,7 +107,7 @@ object RedisConnection{ def runRequest[F[_]: Concurrent, A: RedisResult](connection: RedisConnection[F])(input: NonEmptyList[ByteVector], key: Option[ByteVector]): F[Either[Resp, A]] = runRequestInternal(connection)(Chunk.singleton(input), key).flatMap(head[F]).map(resp => RedisResult[A].decode(resp)) - def runRequestTotal[F[_]: Concurrent, A: RedisResult](input: NonEmptyList[ByteVector], key: Option[ByteVector]): Redis[F, A] = Redis(Kleisli{(connection: RedisConnection[F]) => + def runRequestTotal[F[_]: Concurrent, A: RedisResult](input: NonEmptyList[ByteVector], key: Option[ByteVector]): Redis[F, A] = Redis(Kleisli{(connection: RedisConnection[F]) => runRequest(connection)(input, key).flatMap{ case Right(a) => a.pure[F] case Left(e@Resp.Error(_)) => ApplicativeError[F, Throwable].raiseError[A](e) @@ -127,6 +132,7 @@ object RedisConnection{ val clusterUseDynamicRefreshSource: Boolean = true // Set to false to only use initially provided host for topology refresh val clusterCacheTopologySeconds: FiniteDuration = 1.second // How long topology will not be rechecked for after a succesful refresh val useTLS: Boolean = false + val requestTimeout: Duration = 60.seconds } def direct[F[_]: Temporal: Network]: DirectConnectionBuilder[F] = @@ -137,7 +143,8 @@ object RedisConnection{ None, TLSParameters.Default, None, - Defaults.useTLS + Defaults.useTLS, + Defaults.requestTimeout ) @deprecated("Use overload that takes a Network", "0.4.1") @@ -152,6 +159,7 @@ object RedisConnection{ private val tlsParameters: TLSParameters, private val auth: Option[(Option[String], String)], private val useTLS: Boolean, + private val defaultTimeout: Duration, ) { self => private def copy( @@ -161,7 +169,8 @@ object RedisConnection{ tlsContext: Option[TLSContext[F]] = self.tlsContext, tlsParameters: TLSParameters = self.tlsParameters, auth: Option[(Option[String], String)] = self.auth, - useTLS: Boolean = self.useTLS + useTLS: Boolean = self.useTLS, + defaultTimeout: Duration = self.defaultTimeout ): DirectConnectionBuilder[F] = new DirectConnectionBuilder( sg, host, @@ -169,7 +178,8 @@ object RedisConnection{ tlsContext, tlsParameters, auth, - useTLS + useTLS, + defaultTimeout ) def withHost(host: Host) = copy(host = host) @@ -182,6 +192,7 @@ object RedisConnection{ def withoutAuth = copy(auth = None) def withTLS = copy(useTLS = true) def withoutTLS = copy(useTLS = false) + def withTimeout(timeout: Duration) = copy(defaultTimeout = timeout) def build: Resource[F,RedisConnection[F]] = for { @@ -199,7 +210,7 @@ object RedisConnection{ case Some((None, password)) => RedisCommands.auth[Redis[F, *]](password).run(DirectConnection(out)).void }) - } yield RedisConnection.DirectConnection(out) + } yield new TimeoutConnection(RedisConnection.DirectConnection(out), defaultTimeout) } def pool[F[_]: Temporal: Network]: PooledConnectionBuilder[F] = @@ -211,6 +222,7 @@ object RedisConnection{ TLSParameters.Default, None, Defaults.useTLS, + Defaults.requestTimeout, ) @deprecated("Use overload that takes a Network", "0.4.1") @@ -225,6 +237,7 @@ object RedisConnection{ private val tlsParameters: TLSParameters, private val auth: Option[(Option[String], String)], private val useTLS: Boolean, + private val defaultTimeout: Duration, ) { self => private def copy( @@ -235,6 +248,7 @@ object RedisConnection{ tlsParameters: TLSParameters = self.tlsParameters, auth: Option[(Option[String], String)] = self.auth, useTLS: Boolean = self.useTLS, + defaultTimeout: Duration = self.defaultTimeout, ): PooledConnectionBuilder[F] = new PooledConnectionBuilder( sg, host, @@ -242,7 +256,8 @@ object RedisConnection{ tlsContext, tlsParameters, auth, - useTLS + useTLS, + defaultTimeout ) def withHost(host: Host) = copy(host = host) @@ -255,6 +270,7 @@ object RedisConnection{ def withoutAuth = copy(auth = None) def withTLS = copy(useTLS = true) def withoutTLS = copy(useTLS = false) + def withTimeout(timeout: Duration) = copy(defaultTimeout = timeout) def build: Resource[F,RedisConnection[F]] = for { tlsContextOptWithDefault <- @@ -263,7 +279,7 @@ object RedisConnection{ _.some.pure[Resource[F, *]] ) kp <- KeyPool.Builder[F, Unit, Socket[F]]( - {_ => sg.client(SocketAddress(host,port), Nil) + {(_: Unit) => sg.client(SocketAddress(host,port), Nil) .flatMap(elevateSocket(_, tlsContextOptWithDefault, tlsParameters, useTLS)) .evalTap(socket => auth match { @@ -276,7 +292,7 @@ object RedisConnection{ ) } ).build - } yield PooledConnection[F](kp) + } yield new TimeoutConnection(PooledConnection[F](kp), defaultTimeout) } @@ -292,6 +308,7 @@ object RedisConnection{ Defaults.chunkSizeLimit, None, Defaults.useTLS, + Defaults.requestTimeout, ) @deprecated("Use overload that takes a Network", "0.4.1") @@ -309,6 +326,7 @@ object RedisConnection{ private val chunkSizeLimit: Int, private val auth: Option[(Option[String], String)], private val useTLS: Boolean, + private val defaultTimeout: Duration, ) { self => private def copy( @@ -322,6 +340,7 @@ object RedisConnection{ chunkSizeLimit: Int = self.chunkSizeLimit, auth: Option[(Option[String], String)] = self.auth, useTLS: Boolean = self.useTLS, + defaultTimeout: Duration = self.defaultTimeout ): QueuedConnectionBuilder[F] = new QueuedConnectionBuilder( sg, host, @@ -333,6 +352,7 @@ object RedisConnection{ chunkSizeLimit, auth, useTLS, + defaultTimeout, ) def withHost(host: Host) = copy(host = host) @@ -350,6 +370,7 @@ object RedisConnection{ def withTLS = copy(useTLS = true) def withoutTLS = copy(useTLS = false) + def withTimeout(timeout: Duration) = copy(defaultTimeout = timeout) def build: Resource[F,RedisConnection[F]] = { for { @@ -374,7 +395,7 @@ object RedisConnection{ ) } ).build - _ <- + _ <- Stream.fromQueueUnterminatedChunk(queue, chunkSizeLimit).chunks.map{chunk => val s = if (chunk.nonEmpty) { Stream.eval( @@ -404,7 +425,7 @@ object RedisConnection{ .compile .drain .background - } yield Queued(queue, keypool.take(())) + } yield new TimeoutConnection(Queued(queue, keypool.take(())), defaultTimeout) } } @@ -423,6 +444,7 @@ object RedisConnection{ Defaults.clusterCacheTopologySeconds, None, Defaults.useTLS, + Defaults.requestTimeout, ) @deprecated("Use overload that takes a Network", "0.4.1") @@ -443,6 +465,7 @@ object RedisConnection{ private val cacheTopologySeconds: FiniteDuration, // How long topology will not be rechecked for after a succesful refresh private val auth: Option[(Option[String], String)], private val useTLS: Boolean, + private val defaultTimeout: Duration, ) { self => private def copy( @@ -459,6 +482,7 @@ object RedisConnection{ cacheTopologySeconds: FiniteDuration = self.cacheTopologySeconds, auth: Option[(Option[String], String)] = self.auth, useTLS: Boolean = self.useTLS, + defaultTimeout: Duration = self.defaultTimeout ): ClusterConnectionBuilder[F] = new ClusterConnectionBuilder( sg, host, @@ -472,7 +496,8 @@ object RedisConnection{ useDynamicRefreshSource, cacheTopologySeconds, auth, - useTLS + useTLS, + defaultTimeout, ) def withHost(host: Host) = copy(host = host) @@ -495,6 +520,7 @@ object RedisConnection{ def withTLS = copy(useTLS = true) def withoutTLS = copy(useTLS = false) + def withTimeout(timeout: Duration) = copy(defaultTimeout = timeout) def build: Resource[F,RedisConnection[F]] = { for { @@ -615,7 +641,7 @@ object RedisConnection{ .compile .drain .background - } yield cluster + } yield new TimeoutConnection(cluster, defaultTimeout) } } @@ -640,4 +666,11 @@ object RedisConnection{ private def raceNThrowFirst[F[_]: Concurrent, A](nel: NonEmptyList[F[A]]): F[A] = Stream(Stream.emits(nel.toList).evalMap(identity)).covary[F].parJoinUnbounded.take(1).compile.lastOrError + + private class TimeoutConnection[F[_]: Temporal](rC: RedisConnection[F], duration: Duration) extends RedisConnection[F] { + + def runRequest(inputs: Chunk[NonEmptyList[ByteVector]], key: Option[ByteVector]): F[Chunk[Resp]] = + rC.runRequest(inputs, key).timeout(duration) + + } } \ No newline at end of file diff --git a/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisPubSub.scala b/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisPubSub.scala index 0acf89f..e99a1cd 100644 --- a/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisPubSub.scala +++ b/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisPubSub.scala @@ -5,13 +5,10 @@ import fs2.io.net._ import cats._ import cats.syntax.all._ import cats.effect._ -import cats.effect.syntax.all._ import cats.data.NonEmptyList -import scala.concurrent.duration._ import _root_.io.chrisdavenport.rediculous.implicits._ import org.typelevel.keypool.Reusable import scodec.bits._ -import java.nio.charset.StandardCharsets import RedisCtx.syntax.all._ /** @@ -64,9 +61,9 @@ object RedisPubSub { val emptyBV = ByteVector.empty val pongBV = ByteVector.encodeUtf8("pong").fold(throw _, identity) def decode(resp: Resp): Either[Resp,PubSubReply] = resp match { - case r@Resp.Array(Some(Resp.BulkString(Some(pong)) :: Resp.BulkString(Some(empty)) :: Nil)) if pong == pongBV && empty == emptyBV => + case Resp.Array(Some(Resp.BulkString(Some(pong)) :: Resp.BulkString(Some(empty)) :: Nil)) if pong == pongBV && empty == emptyBV => Pong.asRight - case r@Resp.Array(Some(r0 :: r1 :: r2 :: rs)) => + case r@Resp.Array(Some(r0 :: r1 :: r2 :: rs)) => r0.decode[String].flatMap{ case "message" => (r1.decode[String], r2.decode[String]) From 1cc6942a77557f065f8f461973bcebc062029251 Mon Sep 17 00:00:00 2001 From: Christopher Davenport Date: Mon, 3 Apr 2023 08:30:21 -0700 Subject: [PATCH 2/8] Fix Native Type Inference --- .../rediculous/RedisConnection.scala | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisConnection.scala b/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisConnection.scala index b0d8cf5..4d86ffa 100644 --- a/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisConnection.scala +++ b/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisConnection.scala @@ -192,7 +192,7 @@ object RedisConnection{ def withoutAuth = copy(auth = None) def withTLS = copy(useTLS = true) def withoutTLS = copy(useTLS = false) - def withTimeout(timeout: Duration) = copy(defaultTimeout = timeout) + def withRequestTimeout(timeout: Duration) = copy(defaultTimeout = timeout) def build: Resource[F,RedisConnection[F]] = for { @@ -270,7 +270,7 @@ object RedisConnection{ def withoutAuth = copy(auth = None) def withTLS = copy(useTLS = true) def withoutTLS = copy(useTLS = false) - def withTimeout(timeout: Duration) = copy(defaultTimeout = timeout) + def withRequestTimeout(timeout: Duration) = copy(defaultTimeout = timeout) def build: Resource[F,RedisConnection[F]] = for { tlsContextOptWithDefault <- @@ -370,7 +370,7 @@ object RedisConnection{ def withTLS = copy(useTLS = true) def withoutTLS = copy(useTLS = false) - def withTimeout(timeout: Duration) = copy(defaultTimeout = timeout) + def withRequestTimeout(timeout: Duration) = copy(defaultTimeout = timeout) def build: Resource[F,RedisConnection[F]] = { for { @@ -382,7 +382,7 @@ object RedisConnection{ _.some.pure[Resource[F, *]] ) keypool <- KeyPool.Builder.apply[F, Unit, Socket[F]]( - {_ => sg.client(SocketAddress(host,port), Nil) + {(_: Unit) => sg.client(SocketAddress(host,port), Nil) .flatMap(elevateSocket(_, tlsContextOptWithDefault, tlsParameters, useTLS)) .evalTap(socket => auth match { @@ -520,7 +520,7 @@ object RedisConnection{ def withTLS = copy(useTLS = true) def withoutTLS = copy(useTLS = false) - def withTimeout(timeout: Duration) = copy(defaultTimeout = timeout) + def withRequestTimeout(timeout: Duration) = copy(defaultTimeout = timeout) def build: Resource[F,RedisConnection[F]] = { for { @@ -530,7 +530,10 @@ object RedisConnection{ _.some.pure[Resource[F, *]] ) keypool <- KeyPool.Builder[F, (Host, Port), Socket[F]]( - {case ((host: Host, port: Port)) => sg.client(SocketAddress(host, port), Nil) + {(t: (Host, Port)) => + val host = t._1 + val port = t._2 + sg.client(SocketAddress(host, port), Nil) .flatMap(elevateSocket(_, tlsContextOptWithDefault, tlsParameters, useTLS)) .evalTap(socket => auth match { From 9a6e55c141d1bc3802212af1bc19532039a5f700 Mon Sep 17 00:00:00 2001 From: Christopher Davenport Date: Mon, 3 Apr 2023 09:39:51 -0700 Subject: [PATCH 3/8] Update cats --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 975fb96..96609b7 100644 --- a/build.sbt +++ b/build.sbt @@ -14,7 +14,7 @@ ThisBuild / tlCiReleaseBranches := Seq("main") ThisBuild / tlSonatypeUseLegacyHost := true -val catsV = "2.8.0" +val catsV = "2.9.0" val catsEffectV = "3.4.8" val fs2V = "3.6.1" From c48484d15cdc6bfd4aef57f73776c53a54439f13 Mon Sep 17 00:00:00 2001 From: Christopher Davenport Date: Tue, 4 Apr 2023 07:52:20 -0700 Subject: [PATCH 4/8] Update scala 3 version --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 96609b7..fdb8fb6 100644 --- a/build.sbt +++ b/build.sbt @@ -20,7 +20,7 @@ val fs2V = "3.6.1" val munitCatsEffectV = "2.0.0-M3" -ThisBuild / crossScalaVersions := Seq("2.12.15","2.13.8", "3.1.3") +ThisBuild / crossScalaVersions := Seq("2.12.15","2.13.8", "3.2.2") ThisBuild / scalaVersion := "2.13.8" ThisBuild / versionScheme := Some("early-semver") From ec0ac0d4393c98394014fc68f0057c971ffcbf98 Mon Sep 17 00:00:00 2001 From: Christopher Davenport Date: Tue, 4 Apr 2023 07:54:42 -0700 Subject: [PATCH 5/8] githubWorkflowGenerate --- .github/workflows/ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44c7dc5..50e3cdf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.12.15, 2.13.8, 3.1.3] + scala: [2.12.15, 2.13.8, 3.2.2] java: [temurin@8] project: [rootJS, rootJVM, rootNative] runs-on: ${{ matrix.os }} @@ -207,32 +207,32 @@ jobs: tar xf targets.tar rm targets.tar - - name: Download target directories (3.1.3, rootJS) + - name: Download target directories (3.2.2, rootJS) uses: actions/download-artifact@v2 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.3-rootJS + name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.2-rootJS - - name: Inflate target directories (3.1.3, rootJS) + - name: Inflate target directories (3.2.2, rootJS) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (3.1.3, rootJVM) + - name: Download target directories (3.2.2, rootJVM) uses: actions/download-artifact@v2 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.3-rootJVM + name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.2-rootJVM - - name: Inflate target directories (3.1.3, rootJVM) + - name: Inflate target directories (3.2.2, rootJVM) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (3.1.3, rootNative) + - name: Download target directories (3.2.2, rootNative) uses: actions/download-artifact@v2 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.3-rootNative + name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.2-rootNative - - name: Inflate target directories (3.1.3, rootNative) + - name: Inflate target directories (3.2.2, rootNative) run: | tar xf targets.tar rm targets.tar From 619ac1019efb7bb23f75c3bb5db734a0d9cc8c1e Mon Sep 17 00:00:00 2001 From: Christopher Davenport Date: Tue, 4 Apr 2023 07:58:43 -0700 Subject: [PATCH 6/8] Update plugins --- project/plugins.sbt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 746b78b..7fd15bd 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ -addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.4.9") -addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.4.9") -addSbtPlugin("org.typelevel" % "sbt-typelevel-settings" % "0.4.9") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0") +addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.4.19") +addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.4.19") +addSbtPlugin("org.typelevel" % "sbt-typelevel-settings" % "0.4.19") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.12") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") From a02e85d8206441e5c737ca05d0df56c07d1692fe Mon Sep 17 00:00:00 2001 From: Christopher Davenport Date: Tue, 4 Apr 2023 08:37:11 -0700 Subject: [PATCH 7/8] githubworkflow2 --- .github/workflows/ci.yml | 70 ++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50e3cdf..86bbef7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,9 +9,9 @@ name: Continuous Integration on: pull_request: - branches: ['**'] + branches: ['**', '!update/**', '!pr/**'] push: - branches: ['**'] + branches: ['**', '!update/**', '!pr/**'] tags: [v*] env: @@ -34,28 +34,28 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Download Java (temurin@8) id: download-java-temurin-8 if: matrix.java == 'temurin@8' - uses: typelevel/download-java@v1 + uses: typelevel/download-java@v2 with: distribution: temurin java-version: 8 - name: Setup Java (temurin@8) if: matrix.java == 'temurin@8' - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: jdkfile java-version: 8 jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} - name: Cache sbt - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.sbt @@ -67,26 +67,26 @@ jobs: key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - name: Check that workflows are up to date - run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck + run: sbt githubWorkflowCheck - name: scalaJSLink if: matrix.project == 'rootJS' - run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/scalaJSLinkerResult + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/scalaJSLinkerResult - name: nativeLink if: matrix.project == 'rootNative' - run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/nativeLink + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/nativeLink - name: Test - run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test - name: Check binary compatibility - if: matrix.java == 'temurin@8' - run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' mimaReportBinaryIssues + if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest' + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues - name: Generate API documentation - if: matrix.java == 'temurin@8' - run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' doc + if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest' + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc - name: Make target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') @@ -98,7 +98,7 @@ jobs: - name: Upload target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }} path: targets.tar @@ -115,28 +115,28 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Download Java (temurin@8) id: download-java-temurin-8 if: matrix.java == 'temurin@8' - uses: typelevel/download-java@v1 + uses: typelevel/download-java@v2 with: distribution: temurin java-version: 8 - name: Setup Java (temurin@8) if: matrix.java == 'temurin@8' - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: jdkfile java-version: 8 jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} - name: Cache sbt - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.sbt @@ -148,7 +148,7 @@ jobs: key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - name: Download target directories (2.12.15, rootJS) - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJS @@ -158,7 +158,7 @@ jobs: rm targets.tar - name: Download target directories (2.12.15, rootJVM) - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJVM @@ -168,7 +168,7 @@ jobs: rm targets.tar - name: Download target directories (2.12.15, rootNative) - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootNative @@ -178,7 +178,7 @@ jobs: rm targets.tar - name: Download target directories (2.13.8, rootJS) - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJS @@ -188,7 +188,7 @@ jobs: rm targets.tar - name: Download target directories (2.13.8, rootJVM) - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJVM @@ -198,7 +198,7 @@ jobs: rm targets.tar - name: Download target directories (2.13.8, rootNative) - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootNative @@ -208,7 +208,7 @@ jobs: rm targets.tar - name: Download target directories (3.2.2, rootJS) - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.2-rootJS @@ -218,7 +218,7 @@ jobs: rm targets.tar - name: Download target directories (3.2.2, rootJVM) - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.2-rootJVM @@ -228,7 +228,7 @@ jobs: rm targets.tar - name: Download target directories (3.2.2, rootNative) - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.2-rootNative @@ -249,7 +249,7 @@ jobs: (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1) - name: Publish - run: sbt '++${{ matrix.scala }}' tlRelease + run: sbt '++ ${{ matrix.scala }}' tlCiRelease site: name: Generate Site @@ -261,28 +261,28 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Download Java (temurin@8) id: download-java-temurin-8 if: matrix.java == 'temurin@8' - uses: typelevel/download-java@v1 + uses: typelevel/download-java@v2 with: distribution: temurin java-version: 8 - name: Setup Java (temurin@8) if: matrix.java == 'temurin@8' - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: jdkfile java-version: 8 jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} - name: Cache sbt - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.sbt @@ -294,11 +294,11 @@ jobs: key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - name: Generate site - run: sbt '++${{ matrix.scala }}' site/tlSite + run: sbt '++ ${{ matrix.scala }}' site/tlSite - name: Publish site if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - uses: peaceiris/actions-gh-pages@v3.8.0 + uses: peaceiris/actions-gh-pages@v3.9.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: site/target/docs/site From 7eaab264b840ff85788fb371661a9b3972711ebb Mon Sep 17 00:00:00 2001 From: Christopher Davenport Date: Tue, 4 Apr 2023 09:09:48 -0700 Subject: [PATCH 8/8] Add jvmopts --- .jvmopts | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .jvmopts diff --git a/.jvmopts b/.jvmopts new file mode 100644 index 0000000..dce4e92 --- /dev/null +++ b/.jvmopts @@ -0,0 +1,6 @@ +-Dfile.encoding=UTF8 +-Xms1G +-Xmx6G +-XX:ReservedCodeCacheSize=250M +-XX:+TieredCompilation +-XX:+UseG1GC \ No newline at end of file