Skip to content

Commit

Permalink
Merge pull request #389 from davenverse/updateBuild
Browse files Browse the repository at this point in the history
Update Build, Add Native, 11 for caffeine
  • Loading branch information
ChristopherDavenport authored Apr 12, 2023
2 parents 2692200 + eb41c2f commit f2df7e2
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 77 deletions.
138 changes: 86 additions & 52 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,34 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.15, 2.13.8, 3.1.2]
java: [temurin@8]
project: [rootJS, rootJVM]
scala: [2.12.15, 2.13.8, 3.2.2]
java: [temurin@11]
project: [rootJS, rootJVM, rootNative]
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
- name: Download Java (temurin@11)
id: download-java-temurin-11
if: matrix.java == 'temurin@11'
uses: typelevel/download-java@v2
with:
distribution: temurin
java-version: 8
java-version: 11

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v3
with:
distribution: jdkfile
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.sbt
Expand All @@ -67,34 +67,38 @@ 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

- 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@11' && 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@11' && 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')
run: mkdir -p modules/noop/.jvm/target target .js/target modules/caffeine/target modules/core/.js/target modules/noop/.js/target modules/core/.jvm/target .jvm/target .native/target modules/reload/.js/target modules/reload/.jvm/target modules/bench/target project/target
run: mkdir -p modules/noop/.jvm/target target .js/target modules/core/.native/target modules/caffeine/target modules/noop/.native/target modules/core/.js/target modules/noop/.js/target modules/core/.jvm/target .jvm/target .native/target modules/reload/.js/target modules/reload/.jvm/target modules/bench/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 modules/noop/.jvm/target target .js/target modules/caffeine/target modules/core/.js/target modules/noop/.js/target modules/core/.jvm/target .jvm/target .native/target modules/reload/.js/target modules/reload/.jvm/target modules/bench/target project/target
run: tar cf targets.tar modules/noop/.jvm/target target .js/target modules/core/.native/target modules/caffeine/target modules/noop/.native/target modules/core/.js/target modules/noop/.js/target modules/core/.jvm/target .jvm/target .native/target modules/reload/.js/target modules/reload/.jvm/target modules/bench/target project/target

- 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
Expand All @@ -106,33 +110,33 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.1.2]
java: [temurin@8]
scala: [3.2.2]
java: [temurin@11]
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
- name: Download Java (temurin@11)
id: download-java-temurin-11
if: matrix.java == 'temurin@11'
uses: typelevel/download-java@v2
with:
distribution: temurin
java-version: 8
java-version: 11

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v3
with:
distribution: jdkfile
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.sbt
Expand All @@ -144,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

Expand All @@ -154,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

Expand All @@ -163,8 +167,18 @@ jobs:
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.15, rootNative)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootNative

- name: Inflate target directories (2.12.15, rootNative)
run: |
tar xf targets.tar
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

Expand All @@ -174,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

Expand All @@ -183,22 +197,42 @@ jobs:
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.2, rootJS)
uses: actions/download-artifact@v2
- name: Download target directories (2.13.8, rootNative)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootNative

- name: Inflate target directories (2.13.8, rootNative)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.2.2, rootJS)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.2-rootJS

- name: Inflate target directories (3.2.2, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.2.2, rootJVM)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.2-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.2-rootJVM

- name: Inflate target directories (3.1.2, rootJS)
- name: Inflate target directories (3.2.2, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.2, rootJVM)
uses: actions/download-artifact@v2
- name: Download target directories (3.2.2, rootNative)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.2-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.2-rootNative

- name: Inflate target directories (3.1.2, rootJVM)
- name: Inflate target directories (3.2.2, rootNative)
run: |
tar xf targets.tar
rm targets.tar
Expand All @@ -215,4 +249,4 @@ 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
31 changes: 18 additions & 13 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ThisBuild / tlBaseVersion := "0.6"
ThisBuild / tlBaseVersion := "0.7"
ThisBuild / organization := "io.chrisdavenport"
ThisBuild / organizationName := "Christopher Davenport"
ThisBuild / licenses := Seq(License.MIT)
Expand All @@ -8,19 +8,22 @@ ThisBuild / developers := List(
ThisBuild / tlCiReleaseBranches := Seq("main")
ThisBuild / tlSonatypeUseLegacyHost := true

ThisBuild / crossScalaVersions := Seq("2.12.15", "2.13.8", "3.1.2")
ThisBuild / crossScalaVersions := Seq("2.12.15", "2.13.8", "3.2.2")
ThisBuild / scalaVersion := "3.2.2"

ThisBuild / testFrameworks += new TestFramework("munit.Framework")

ThisBuild / versionScheme := Some("early-semver")

ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11"))

val catsV = "2.8.0"
val catsEffectV = "3.3.13"
val catsCollectionV = "0.9.3"

val munitV = "0.7.25"
val munitCEV = "1.0.7"
val catsV = "2.9.0"
val catsEffectV = "3.4.8"
val catsCollectionV = "0.9.6"

val munitV = "1.0.0-M7"
val munitCEV = "2.0.0-M3"

lazy val mules = tlCrossRootProject
.aggregate(core, caffeine, reload, noop, bench)
Expand All @@ -31,16 +34,16 @@ lazy val bench = project.in(file("modules/bench"))
.enablePlugins(NoPublishPlugin)
.dependsOn(core.jvm, caffeine)

lazy val core = crossProject(JSPlatform, JVMPlatform)
lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("modules/core"))
.settings(
name := "mules",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsV,
"org.typelevel" %%% "cats-effect" % catsEffectV,
"io.chrisdavenport" %%% "mapref" % "0.2.1",
),
tlJdkRelease := Some(8)
).settings(testDeps)
.jsSettings(
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule)},
Expand All @@ -51,16 +54,17 @@ lazy val caffeine = project.in(file("modules/caffeine"))
.settings(
name := "mules-caffeine",
libraryDependencies ++= Seq(
"com.github.ben-manes.caffeine" % "caffeine" % "2.9.3"
"com.github.ben-manes.caffeine" % "caffeine" % "3.1.6"
),
).settings(testDeps)

lazy val noop = crossProject(JSPlatform, JVMPlatform)
lazy val noop = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("modules/noop"))
.dependsOn(core)
.settings(
name := "mules-noop"
name := "mules-noop",
tlJdkRelease := Some(8)
).settings(testDeps)
.jsSettings(
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule)},
Expand All @@ -75,6 +79,7 @@ lazy val reload = crossProject(JSPlatform, JVMPlatform)
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-collections-core" % catsCollectionV
),
tlJdkRelease := Some(8),
).settings(testDeps)
.jsSettings(
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule)},
Expand All @@ -85,6 +90,6 @@ lazy val testDeps = Seq(
"org.typelevel" %%% "cats-effect-laws" % catsEffectV % Test,
"org.scalameta" %%% "munit" % munitV % Test,
"org.scalameta" %%% "munit-scalacheck" % munitV % Test,
"org.typelevel" %%% "munit-cats-effect-3" % munitCEV % Test,
"org.typelevel" %%% "munit-cats-effect" % munitCEV % Test,
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import cats.effect.implicits._
import cats.implicits._

import scala.collection.immutable.Map
import io.chrisdavenport.mapref.MapRef
import io.chrisdavenport.mapref.MapRef.fromSeqRefs
import cats.effect.std.MapRef
import cats.effect.std.MapRef.fromSeqRefs

import java.util.concurrent.ConcurrentHashMap
import scala.collection.mutable
Expand Down Expand Up @@ -361,7 +361,7 @@ private[mules] object PurgeableMapRef {
}
}

def ofConcurrentHashMap[F[_]: Concurrent, K, V](
def ofConcurrentHashMap[F[_]: Async, K, V](
initialCapacity: Int = 16,
loadFactor: Float = 0.75f,
concurrencyLevel: Int = 16,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import cats.effect.syntax.all._
import cats.syntax.all._
import scala.collection.immutable.Map

import io.chrisdavenport.mapref.MapRef
import io.chrisdavenport.mapref.implicits._
import cats.effect.std.MapRef
import cats.effect.std.syntax.all._

final class MemoryCache[F[_], K, V] private[MemoryCache] (
private val mapRef: MapRef[F, K, Option[MemoryCache.MemoryCacheItem[V]]],
Expand Down Expand Up @@ -338,7 +338,7 @@ object MemoryCache {
)
}

def ofConcurrentHashMap[F[_]: Temporal, K, V](
def ofConcurrentHashMap[F[_]: Async, K, V](
defaultExpiration: Option[TimeSpec],
initialCapacity: Int = 16,
loadFactor: Float = 0.75f,
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.6.2
sbt.version=1.8.2
11 changes: 6 additions & 5 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.4.12")
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.4.12")
addSbtPlugin("org.typelevel" % "sbt-typelevel-settings" % "0.4.12")
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.12")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.0")

0 comments on commit f2df7e2

Please sign in to comment.