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

update building infrastructure #5

Merged
merged 2 commits into from
Apr 25, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
scala:
- 2.13.12
- 2.13.13

steps:
- uses: actions/checkout@v4
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# sbt specific
.cache
.history
.lib/
dist/*
target/
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Pool of [cats-effect](https://typelevel.org/cats-effect/) resources
## Example

```scala
import com.evolution.resourcepool.ResourcePool.implicits._
import com.evolution.resourcepool.ResourcePool.implicits.*

trait Connection {
def query(): IO[Any]
Expand All @@ -37,7 +37,6 @@ connection
connection.query() // here you have access to the connection
}
}

```

## Setup
Expand Down
32 changes: 13 additions & 19 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,28 @@ import Dependencies._
name := "resource-pool"

organization := "com.evolution"

homepage := Some(new URL("http://github.com/evolution-gaming/resource-pool"))

startYear := Some(2023)

organizationName := "Evolution"
organizationHomepage := Some(url("https://evolution.com"))
homepage := Some(url("https://github.com/evolution-gaming/resource-pool"))
startYear := Some(2023)

organizationHomepage := Some(url("http://evolution.com"))

crossScalaVersions := Seq("2.13.13")
scalaVersion := crossScalaVersions.value.head

crossScalaVersions := Seq("2.13.12")

scalacOptions := Seq(
"-release:17",
"-Xsource:3-cross",
)
releaseCrossBuild := true
autoAPIMappings := true
versionScheme := Some("early-semver")
publishTo := Some(Resolver.evolutionReleases)

libraryDependencies += compilerPlugin(`kind-projector` cross CrossVersion.full)

scalacOptsFailOnWarn := Some(false)

libraryDependencies ++= Seq(
`cats-effect`,
scalatest % Test,
scalatest,
)

licenses := Seq(("MIT", url("https://opensource.org/licenses/MIT")))

releaseCrossBuild := true

versionScheme := Some("early-semver")

autoAPIMappings := true
addCommandAlias("build", "all compile test")
4 changes: 2 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sbt._

object Dependencies {
val scalatest = "org.scalatest" %% "scalatest" % "3.2.17"
val `kind-projector` = "org.typelevel" % "kind-projector" % "0.13.2"
val scalatest = "org.scalatest" %% "scalatest" % "3.2.18" % Test
val `kind-projector` = "org.typelevel" % "kind-projector" % "0.13.3"
val `cats-effect` = "org.typelevel" %% "cats-effect" % "3.4.11"
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.6
sbt.version=1.9.9
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.11")

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.11")

addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")

addSbtPlugin("com.evolution" % "sbt-scalac-opts-plugin" % "0.0.9")

Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/com/evolution/resourcepool/ResourcePool.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package com.evolution.resourcepool
import cats.Functor
import cats.effect.kernel.Resource.ExitCase
import cats.effect.{Async, Deferred, MonadCancel, MonadCancelThrow, Ref, Resource, Sync, Temporal}
import cats.effect.syntax.all._
import cats.syntax.all._
import com.evolution.resourcepool.IntHelper._
import cats.effect.syntax.all.*
import cats.syntax.all.*
import com.evolution.resourcepool.IntHelper.*

import scala.collection.immutable.Queue
import scala.concurrent.duration.FiniteDuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.evolution.resourcepool

import org.scalatest.funsuite.AnyFunSuite
import com.evolution.resourcepool.IntHelper._
import com.evolution.resourcepool.IntHelper.*
import org.scalatest.matchers.should.Matchers

class IntHelperTest extends AnyFunSuite with Matchers {
Expand Down
15 changes: 6 additions & 9 deletions src/test/scala/com/evolution/resourcepool/ResourcePoolTest.scala
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package com.evolution.resourcepool

import cats.effect.kernel.{Concurrent, Ref}
import cats.effect.syntax.all._
import cats.effect.{Deferred, IO, Resource, Temporal}
import com.evolution.resourcepool.util.IOSuite._
import cats.syntax.all._
import com.evolution.resourcepool.ResourcePool.implicits._
import cats.effect.syntax.all.*
import cats.effect.{Concurrent, Deferred, IO, Ref, Resource, Temporal}
import cats.syntax.all.*
import com.evolution.resourcepool.util.IOSuite.*
import com.evolution.resourcepool.ResourcePool.implicits.*
import org.scalatest.funsuite.AsyncFunSuite
import org.scalatest.matchers.should.Matchers

import scala.concurrent.TimeoutException
import scala.concurrent.duration._
import scala.concurrent.duration.*
import scala.util.control.NoStackTrace

class ResourcePoolTest extends AsyncFunSuite with Matchers {
Expand Down Expand Up @@ -315,7 +314,6 @@ class ResourcePoolTest extends AsyncFunSuite with Matchers {
.run()
}


test("resource allocation fails after some time") {
val error = new RuntimeException("error") with NoStackTrace
val result = for {
Expand Down Expand Up @@ -504,7 +502,6 @@ class ResourcePoolTest extends AsyncFunSuite with Matchers {
.run()
}


test("cancel `resource.use") {
val result = for {
deferred0 <- Deferred[IO, Unit]
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/com/evolution/resourcepool/util/IOSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package com.evolution.resourcepool.util
import cats.Applicative
import cats.effect.unsafe.implicits.global
import cats.effect.{IO, Resource}
import cats.syntax.all._
import cats.syntax.all.*
import org.scalatest.Succeeded

import scala.concurrent.duration._
import scala.concurrent.duration.*
import scala.concurrent.{ExecutionContext, ExecutionContextExecutor, Future}

object IOSuite {
Expand Down
Loading