Skip to content

Commit 168ff06

Browse files
authored
Merge pull request #455 from CleverCloud/breaking/migrate-to-scala-3
[Breaking] Migrate to scala 3 Lot of thanks to @RemiBardon for the hard work! 🙇
2 parents 08dcbab + 4d9a270 commit 168ff06

File tree

31 files changed

+422
-288
lines changed

31 files changed

+422
-288
lines changed

.github/workflows/build.yml

+82-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ jobs:
4242
echo "name: ${{ steps.import_gpg.outputs.name }}"
4343
echo "email: ${{ steps.import_gpg.outputs.email }}"
4444
- name: run tests
45-
run: sbt ++2.12.16 test
45+
run: sbt ++2.12.17 test
4646

4747
- name: publish snapshot
48-
run: sbt ++2.12.16 publish
48+
run: sbt ++2.12.17 publish
4949
env:
5050
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
5151
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
@@ -81,10 +81,88 @@ jobs:
8181
echo "email: ${{ steps.import_gpg.outputs.email }}"
8282
8383
- name: run tests
84-
run: sbt ++2.13.8 test
84+
run: sbt ++2.13.10 test
8585

8686
- name: publish snapshot
87-
run: sbt ++2.13.8 publish
87+
run: sbt ++2.13.10 publish
88+
env:
89+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
90+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
91+
92+
scala-3:
93+
runs-on: ubuntu-latest
94+
steps:
95+
- name: checkout the repo
96+
uses: actions/checkout@v2
97+
with:
98+
fetch-depth: 0
99+
100+
- name: Set up JDK
101+
uses: actions/setup-java@v1
102+
with:
103+
java-version: 11
104+
105+
- name: Launch pulsar docker
106+
run: docker-compose up -d
107+
108+
- name: Import GPG key
109+
id: import_gpg
110+
uses: crazy-max/ghaction-import-gpg@v3
111+
with:
112+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
113+
passphrase: ${{ secrets.PGP_PASSPHRASE }}
114+
115+
- name: GPG user IDs
116+
run: |
117+
echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}"
118+
echo "keyid: ${{ steps.import_gpg.outputs.keyid }}"
119+
echo "name: ${{ steps.import_gpg.outputs.name }}"
120+
echo "email: ${{ steps.import_gpg.outputs.email }}"
121+
122+
- name: run tests
123+
run: sbt ++3.2.1 test
124+
125+
- name: publish snapshot
126+
run: sbt ++3.2.1 publish
127+
env:
128+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
129+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
130+
131+
scala-3:
132+
runs-on: ubuntu-latest
133+
steps:
134+
- name: checkout the repo
135+
uses: actions/checkout@v2
136+
with:
137+
fetch-depth: 0
138+
139+
- name: Set up JDK
140+
uses: actions/setup-java@v1
141+
with:
142+
java-version: 11
143+
144+
- name: Launch pulsar docker
145+
run: docker-compose up -d
146+
147+
- name: Import GPG key
148+
id: import_gpg
149+
uses: crazy-max/ghaction-import-gpg@v3
150+
with:
151+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
152+
passphrase: ${{ secrets.PGP_PASSPHRASE }}
153+
154+
- name: GPG user IDs
155+
run: |
156+
echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}"
157+
echo "keyid: ${{ steps.import_gpg.outputs.keyid }}"
158+
echo "name: ${{ steps.import_gpg.outputs.name }}"
159+
echo "email: ${{ steps.import_gpg.outputs.email }}"
160+
161+
- name: run tests
162+
run: sbt ++3.2.0 test
163+
164+
- name: publish snapshot
165+
run: sbt ++3.2.0 publish
88166
env:
89167
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
90168
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

.github/workflows/pr.yml

+21-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
run: docker-compose up -d
2626

2727
- name: run tests
28-
run: sbt ++2.12.16 test
28+
run: sbt ++2.12.17 test
2929

3030
scala-2_13:
3131
runs-on: ubuntu-latest
@@ -44,4 +44,23 @@ jobs:
4444
run: docker-compose up -d
4545

4646
- name: run tests
47-
run: sbt ++2.13.8 test
47+
run: sbt ++2.13.10 test
48+
49+
scala-3:
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: checkout the repo
53+
uses: actions/checkout@v2
54+
with:
55+
fetch-depth: 0
56+
57+
- name: Set up JDK
58+
uses: actions/setup-java@v1
59+
with:
60+
java-version: 11
61+
62+
- name: Launch pulsar docker
63+
run: docker-compose up -d
64+
65+
- name: run tests
66+
run: sbt ++3.2.1 test

.github/workflows/release.yml

+84-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ jobs:
4343
echo "email: ${{ steps.import_gpg.outputs.email }}"
4444
4545
- name: run tests
46-
run: sbt ++2.12.16 test
46+
run: sbt ++2.12.17 test
4747

4848
- name: publish release
49-
run: sbt ++2.12.16 publishSigned
49+
run: sbt ++2.12.17 publishSigned
5050
env:
5151
RELEASE_VERSION: ${{ github.event.inputs.version }}
5252
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
@@ -83,11 +83,91 @@ jobs:
8383
echo "email: ${{ steps.import_gpg.outputs.email }}"
8484
8585
- name: run tests
86-
run: sbt ++2.13.8 test
86+
run: sbt ++2.13.10 test
8787

8888
- name: publish release
89-
run: sbt ++2.13.8 publishSigned
89+
run: sbt ++2.13.10 publishSigned
9090
env:
9191
RELEASE_VERSION: ${{ github.event.inputs.version }}
9292
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
93+
94+
release-scala-3:
95+
runs-on: ubuntu-latest
96+
steps:
97+
- name: checkout the repo
98+
uses: actions/checkout@v2
99+
with:
100+
fetch-depth: 0
101+
102+
- name: Set up JDK
103+
uses: actions/setup-java@v1
104+
with:
105+
java-version: 11
106+
107+
- name: Launch pulsar docker
108+
run: docker-compose up -d
109+
110+
- name: Import GPG key
111+
id: import_gpg
112+
uses: crazy-max/ghaction-import-gpg@v3
113+
with:
114+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
115+
passphrase: ${{ secrets.PGP_PASSPHRASE }}
116+
117+
- name: GPG user IDs
118+
run: |
119+
echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}"
120+
echo "keyid: ${{ steps.import_gpg.outputs.keyid }}"
121+
echo "name: ${{ steps.import_gpg.outputs.name }}"
122+
echo "email: ${{ steps.import_gpg.outputs.email }}"
123+
124+
- name: run tests
125+
run: sbt ++3.2.1 test
126+
127+
- name: publish release
128+
run: sbt ++3.2.1 publishSigned
129+
env:
130+
RELEASE_VERSION: ${{ github.event.inputs.version }}
131+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
132+
133+
release-scala-3:
134+
runs-on: ubuntu-latest
135+
steps:
136+
- name: checkout the repo
137+
uses: actions/checkout@v2
138+
with:
139+
fetch-depth: 0
140+
141+
- name: Set up JDK
142+
uses: actions/setup-java@v1
143+
with:
144+
java-version: 11
145+
146+
- name: Launch pulsar docker
147+
run: docker-compose up -d
148+
149+
- name: Import GPG key
150+
id: import_gpg
151+
uses: crazy-max/ghaction-import-gpg@v3
152+
with:
153+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
154+
passphrase: ${{ secrets.PGP_PASSPHRASE }}
155+
156+
- name: GPG user IDs
157+
run: |
158+
echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}"
159+
echo "keyid: ${{ steps.import_gpg.outputs.keyid }}"
160+
echo "name: ${{ steps.import_gpg.outputs.name }}"
161+
echo "email: ${{ steps.import_gpg.outputs.email }}"
162+
163+
- name: run tests
164+
run: sbt ++3.2.0 test
165+
166+
- name: publish release
167+
run: sbt ++3.2.0 publishSigned
168+
env:
169+
RELEASE_VERSION: ${{ github.event.inputs.version }}
170+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
171+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
172+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
93173
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

README.md

+25-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
pulsar4s - Apache Pulsar Scala Client
2-
==================================================
1+
# pulsar4s - Apache Pulsar Scala Client
32

43
![build](https://github.com/CleverCloud/pulsar4s/workflows/build/badge.svg)
4+
[<img src="https://img.shields.io/maven-central/v/com.clever-cloud.pulsar4s/pulsar4s-core_3.svg?label=latest%20release%20for%203"/>](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22pulsar4s-core_3%22)
55
[<img src="https://img.shields.io/maven-central/v/com.clever-cloud.pulsar4s/pulsar4s-core_2.13.svg?label=latest%20release%20for%202.13"/>](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22pulsar4s-core_2.13%22)
66
[<img src="https://img.shields.io/maven-central/v/com.clever-cloud.pulsar4s/pulsar4s-core_2.12.svg?label=latest%20release%20for%202.12"/>](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22pulsar4s-core_2.12%22)
7+
[<img src="https://img.shields.io/nexus/s/https/oss.sonatype.org/com.clever-cloud.pulsar4s/pulsar4s-core_3.svg?label=latest%20snapshot&style=plastic"/>](https://oss.sonatype.org/content/repositories/snapshots/com/sksamuel/pulsar4s/)
78
[<img src="https://img.shields.io/nexus/s/https/oss.sonatype.org/com.clever-cloud.pulsar4s/pulsar4s-core_2.13.svg?label=latest%20snapshot&style=plastic"/>](https://oss.sonatype.org/content/repositories/snapshots/com/sksamuel/pulsar4s/)
89

910
pulsar4s is a concise, idiomatic, reactive, type safe Scala client for [Apache Pulsar](https://pulsar.apache.org/).
@@ -19,6 +20,28 @@ As a simple wrapper over the Java client, we benefit from the reliability and pe
1920
* [FS2](https://github.com/typelevel/fs2) Reader and Writer
2021
* Circe, SprayJson, PlayJson and Jackson implementations of Schema typeclass
2122

23+
## Warning!!
24+
25+
(This disclaimer was written on 2023-01-05.)
26+
27+
Starting in version 2.9.0, we support scala 3. This means we had to perform some
28+
"aggressive" bumps on libs:
29+
30+
Libs that were bumped for everyone:
31+
- play-json 2.10 (Currently in RC7)
32+
- cats-effect 3.3 (was 2.x)
33+
- ZIO 2.0 (was 1.x) & zio-cats-interop 23.0.0
34+
35+
Libs that come in different versions across scala versions:
36+
- avro4s
37+
- for Scala 3: 5.0+
38+
- for Scala 2: 4.1+
39+
- scala-java8-compat
40+
- for Scala ≥2.13: 1.0.2
41+
- for Scala 2.12: 0.8.0 (Was already the case before scala 3)
42+
43+
Check carefully that bumping pulsar4s will not break, especially with **cats-effect**!
44+
2245
## Using the client
2346

2447
The first step is to create a client attached to the pulsar cluster, providing the service url.

build.sbt

+37-22
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,44 @@ def isRelease = releaseVersion != ""
44
def githubRunNumber = sys.env.getOrElse("GITHUB_RUN_NUMBER", "")
55
def ossrhUsername = sys.env.getOrElse("OSSRH_USERNAME", "")
66
def ossrhPassword = sys.env.getOrElse("OSSRH_PASSWORD", "")
7-
def publishVersion = if (isRelease) releaseVersion else if (isGithubActions) "2.8.2." + githubRunNumber + "-SNAPSHOT" else "0.0.0-LOCAL"
7+
def publishVersion = if (isRelease) releaseVersion else if (isGithubActions) "2.9.0." + githubRunNumber + "-SNAPSHOT" else "0.0.0-LOCAL"
88

99
val org = "com.clever-cloud.pulsar4s"
10-
val AkkaStreamVersion = "2.6.19" // compatible with Akka 2.5.x and 2.6.x
11-
val CatsEffectVersion = "3.3.14"
12-
val CirceVersion = "0.14.2"
10+
val AkkaStreamVersion = "2.6.20" // compatible with Akka 2.5.x and 2.6.x
11+
val CatsEffectVersion = "3.4.4"
12+
val CirceVersion = "0.14.3"
1313
val CommonsIoVersion = "2.4"
1414
val ExtsVersion = "1.61.1"
15-
val JacksonVersion = "2.13.3"
16-
val Log4jVersion = "2.17.2"
15+
val JacksonVersion = "2.14.1"
16+
val Log4jVersion = "2.19.0"
1717
val MonixVersion = "3.4.1"
18-
val PlayJsonVersion = "2.8.2" // compatible with 2.7.x and 2.8.x
19-
val PulsarVersion = "2.10.1"
18+
val PlayJsonVersion = "2.10.0-RC7"
19+
val PulsarVersion = "2.10.3"
2020
val ReactiveStreamsVersion = "1.0.2"
21-
val FunctionalStreamsVersion = "3.2.14"
22-
val Json4sVersion = "4.0.5"
23-
val Avro4sVersion = "4.0.13"
24-
val ScalaVersion = "2.13.8"
25-
val ScalatestVersion = "3.2.13"
26-
val ScalazVersion = "7.2.34"
27-
val Slf4jVersion = "1.7.36"
21+
val FunctionalStreamsVersion = "3.4.0"
22+
val Json4sVersion = "4.0.6"
23+
// Version of Avro4s for Scala 2.X
24+
val Avro4sVersionFor2 = "4.1.0"
25+
// Version of Avro4s for Scala 3.X
26+
val Avro4sVersionFor3 = "5.0.3"
27+
val ScalaVersion = "3.2.1"
28+
val ScalatestVersion = "3.2.15"
29+
val ScalazVersion = "7.2.35"
30+
val Slf4jVersion = "2.0.6"
2831
val SprayJsonVersion = "1.3.6"
29-
val ZIOVersion = "1.0.16"
30-
val ZIOInteropCatsVersion = "3.2.9.1"
32+
val ZIOVersion = "2.0.5"
33+
val ZIOInteropCatsVersion = "23.0.0.0"
3134

3235
lazy val commonScalaVersionSettings = Seq(
3336
scalaVersion := ScalaVersion,
34-
crossScalaVersions := Seq("2.12.16", "2.13.8")
37+
crossScalaVersions := Seq("2.12.17", "2.13.10", ScalaVersion)
3538
)
3639

3740
lazy val warnUnusedImport = Seq(
38-
scalacOptions ++= Seq("-Ywarn-unused:imports"),
41+
scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
42+
case Some((3, _)) => Seq()
43+
case _ => Seq("-Ywarn-unused:imports")
44+
}),
3945
Compile / console / scalacOptions ~= {
4046
_.filterNot(Set("-Ywarn-unused-import", "-Ywarn-unused:imports"))
4147
},
@@ -50,7 +56,13 @@ lazy val commonSettings = Seq(
5056
Global / parallelExecution := false,
5157
Global / concurrentRestrictions += Tags.limit(Tags.Test, 1),
5258
Compile / doc / scalacOptions := (Compile / doc / scalacOptions).value.filter(_ != "-Xfatal-warnings"),
53-
scalacOptions ++= Seq("-unchecked", "-deprecation", "-encoding", "utf8")
59+
scalacOptions ++= Seq("-unchecked", "-encoding", "utf8")
60+
++ (CrossVersion.partialVersion(scalaVersion.value) match {
61+
case Some((2, _)) => Seq(
62+
"-deprecation",
63+
)
64+
case _ => Seq()
65+
})
5466
)
5567

5668
lazy val publishSettings = Seq(
@@ -85,7 +97,7 @@ lazy val commonJvmSettings = Seq(
8597

8698
lazy val commonDeps = Seq(
8799
libraryDependencies ++= Seq(
88-
"com.sksamuel.exts" %% "exts" % ExtsVersion,
100+
"com.sksamuel.exts" %% "exts" % ExtsVersion cross CrossVersion.for3Use2_13,
89101
"org.slf4j" % "slf4j-api" % Slf4jVersion,
90102
"org.scalatest" %% "scalatest" % ScalatestVersion % "test",
91103
"org.apache.logging.log4j" % "log4j-api" % Log4jVersion % "test",
@@ -275,7 +287,10 @@ lazy val avro = Project("pulsar4s-avro", file("pulsar4s-avro"))
275287
.settings(name := "pulsar4s-avro")
276288
.settings(allSettings)
277289
.settings(libraryDependencies ++= Seq(
278-
"com.sksamuel.avro4s" %% "avro4s-core" % Avro4sVersion
290+
"com.sksamuel.avro4s" %% "avro4s-core" % (CrossVersion.partialVersion(scalaVersion.value) match {
291+
case Some((3, _)) => Avro4sVersionFor3
292+
case _ => Avro4sVersionFor2
293+
})
279294
))
280295

281296
lazy val akka_streams = Project("pulsar4s-akka-streams", file("pulsar4s-akka-streams"))

project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.7.1
1+
sbt.version=1.7.3

project/plugins.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
resolvers += Classpaths.sbtPluginReleases
22

3-
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
3+
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")

0 commit comments

Comments
 (0)