Skip to content

Commit df7b421

Browse files
authored
Merge pull request #1 from SOFTNETWORK-APP/crossScalaVersions
Cross scala versions
2 parents 847feaf + 8522cc0 commit df7b421

File tree

72 files changed

+978
-5971
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+978
-5971
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ permissions:
2323

2424
jobs:
2525
test:
26-
runs-on: self-hosted
27-
# runs-on: ubuntu-latest
26+
# runs-on: self-hosted
27+
runs-on: ubuntu-latest
2828
env:
2929
# define Java options for both official sbt and sbt-extras
3030
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
@@ -38,12 +38,14 @@ jobs:
3838
java-version: '8'
3939
distribution: 'temurin'
4040
# cache: 'sbt'
41+
- name: Setup sbt launcher
42+
uses: sbt/setup-sbt@v1
4143
- name: Run tests & Coverage Report
4244
run: sbt coverage test coverageReport
4345
- name: Upload coverage to Codecov
4446
uses: codecov/codecov-action@v3
4547
with:
46-
files: common/target/scala-2.12/coverage-report/cobertura.xml,core/target/scala-2.12/coverage-report/cobertura.xml,teskit/target/scala-2.12/coverage-report/cobertura.xml
48+
files: common/target/scala-2.12/coverage-report/cobertura.xml,common/testkit/target/scala-2.12/coverage-report/cobertura.xml,core/target/scala-2.12/coverage-report/cobertura.xml,core/teskit/target/scala-2.12/coverage-report/cobertura.xml,jdbc/target/scala-2.12/coverage-report/cobertura.xml,jdbc/teskit/target/scala-2.12/coverage-report/cobertura.xml,counter/target/scala-2.12/coverage-report/cobertura.xml,kv/target/scala-2.12/coverage-report/cobertura.xml,kv/target/scala-2.12/coverage-report/cobertura.xml,session/testkit/target/scala-2.12/coverage-report/cobertura.xml
4749
flags: unittests
4850
fail_ci_if_error: true
4951
verbose: true
@@ -59,5 +61,7 @@ jobs:
5961
java-version: '8'
6062
distribution: 'temurin'
6163
# cache: 'sbt'
64+
- name: Setup sbt launcher
65+
uses: sbt/setup-sbt@v1
6266
- name: Formatting
63-
run: sbt scalafmtSbtCheck scalafmtCheck test:scalafmtCheck
67+
run: sbt scalafmtSbtCheck scalafmtCheck Test/scalafmtCheck

.github/workflows/release.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ permissions:
2020

2121
jobs:
2222
release:
23-
runs-on: self-hosted
24-
# runs-on: ubuntu-latest
23+
# runs-on: self-hosted
24+
runs-on: ubuntu-latest
2525
env:
2626
# define Java options for both official sbt and sbt-extras
2727
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
@@ -35,17 +35,19 @@ jobs:
3535
java-version: '8'
3636
distribution: 'temurin'
3737
# cache: 'sbt'
38+
- name: Setup sbt launcher
39+
uses: sbt/setup-sbt@v1
3840
- name: Run tests & Coverage Report
3941
run: sbt coverage test coverageReport coverageAggregate
4042
- name: Upload coverage to Codecov
4143
uses: codecov/codecov-action@v3
4244
with:
43-
files: common/target/scala-2.12/coverage-report/cobertura.xml,common/testkit/target/scala-2.12/coverage-report/cobertura.xml,core/target/scala-2.12/coverage-report/cobertura.xml,core/teskit/target/scala-2.12/coverage-report/cobertura.xml,jdbc/target/scala-2.12/coverage-report/cobertura.xml,jdbc/teskit/target/scala-2.12/coverage-report/cobertura.xml,elastic/target/scala-2.12/coverage-report/cobertura.xml,elastic/teskit/target/scala-2.12/coverage-report/cobertura.xml,counter/target/scala-2.12/coverage-report/cobertura.xml,server/testkit/target/scala-2.12/coverage-report/cobertura.xml,session/testkit/target/scala-2.12/coverage-report/cobertura.xml
45+
files: common/target/scala-2.12/coverage-report/cobertura.xml,common/testkit/target/scala-2.12/coverage-report/cobertura.xml,core/target/scala-2.12/coverage-report/cobertura.xml,core/teskit/target/scala-2.12/coverage-report/cobertura.xml,jdbc/target/scala-2.12/coverage-report/cobertura.xml,jdbc/teskit/target/scala-2.12/coverage-report/cobertura.xml,counter/target/scala-2.12/coverage-report/cobertura.xml,kv/target/scala-2.12/coverage-report/cobertura.xml,kv/target/scala-2.12/coverage-report/cobertura.xml,session/testkit/target/scala-2.12/coverage-report/cobertura.xml
4446
flags: unittests
4547
fail_ci_if_error: false
4648
verbose: true
4749
- name: Publish
48-
run: sbt publish
50+
run: sbt + publish
4951

5052
lint:
5153
runs-on: ubuntu-latest
@@ -58,5 +60,7 @@ jobs:
5860
java-version: '8'
5961
distribution: 'temurin'
6062
# cache: 'sbt'
63+
- name: Setup sbt launcher
64+
uses: sbt/setup-sbt@v1
6165
- name: Formatting
62-
run: sbt scalafmtSbtCheck scalafmtCheck test:scalafmtCheck
66+
run: sbt scalafmtSbtCheck scalafmtCheck Test/scalafmtCheck

build.sbt

Lines changed: 93 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,37 @@ import app.softnetwork.*
44
// Defaults
55
/////////////////////////////////
66

7+
lazy val scala212 = "2.12.20"
8+
lazy val scala213 = "2.13.16"
9+
lazy val javacCompilerVersion = "1.8"
10+
lazy val scalacCompilerOptions = Seq(
11+
"-deprecation",
12+
"-feature",
13+
s"-target:jvm-$javacCompilerVersion"
14+
)
15+
716
ThisBuild / organization := "app.softnetwork"
817

918
name := "generic-persistence-api"
1019

11-
ThisBuild / version := "0.7.3"
20+
ThisBuild / version := "0.8-SNAPSHOT"
21+
22+
lazy val moduleSettings = Seq(
23+
crossScalaVersions := Seq(scala212, scala213),
24+
scalacOptions ++= {
25+
CrossVersion.partialVersion(scalaVersion.value) match {
26+
case Some((2, 12)) => scalacCompilerOptions :+ "-Ypartial-unification"
27+
case Some((2, 13)) => scalacCompilerOptions
28+
case _ => Seq.empty
29+
}
30+
}
31+
)
1232

13-
ThisBuild / scalaVersion := "2.12.18"
33+
ThisBuild / javacOptions ++= Seq("-source", javacCompilerVersion, "-target", javacCompilerVersion)
1434

15-
ThisBuild / scalacOptions ++= Seq("-deprecation", "-feature", "-target:jvm-1.8", "-Ypartial-unification")
35+
ThisBuild / scalaVersion := scala212
1636

17-
ThisBuild / javacOptions ++= Seq("-source", "1.8", "-target", "1.8")
37+
//ThisBuild / versionScheme := Some("early-semver")
1838

1939
ThisBuild / resolvers ++= Seq(
2040
"Softnetwork Server" at "https://softnetwork.jfrog.io/artifactory/releases/",
@@ -24,35 +44,54 @@ ThisBuild / resolvers ++= Seq(
2444

2545
ThisBuild / libraryDependencies ++= Seq(
2646
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf",
27-
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.1"
47+
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
2848
)
2949

3050
ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
3151

52+
ThisBuild / dependencyOverrides ++= Seq(
53+
"com.github.jnr" % "jnr-ffi" % "2.2.17",
54+
"com.github.jnr" % "jffi" % "1.3.13" classifier "native",
55+
"org.lmdbjava" % "lmdbjava" % "0.9.1" exclude("org.slf4j", "slf4j-api"),
56+
)
57+
3258
Test / parallelExecution := false
3359

3460
lazy val common = project.in(file("common"))
3561
.configs(IntegrationTest)
36-
.settings(Defaults.itSettings)
62+
.settings(
63+
Defaults.itSettings,
64+
moduleSettings
65+
)
3766

3867
lazy val commonTestkit = project.in(file("common/testkit"))
3968
.configs(IntegrationTest)
40-
.settings(Defaults.itSettings)
69+
.settings(
70+
Defaults.itSettings,
71+
moduleSettings
72+
)
4173
.dependsOn(
4274
common % "compile->compile;test->test;it->it"
4375
)
4476

4577
lazy val core = project.in(file("core"))
4678
.configs(IntegrationTest)
4779
.enablePlugins(BuildInfoPlugin)
48-
.settings(Defaults.itSettings, app.softnetwork.Info.infoSettings)
80+
.settings(
81+
Defaults.itSettings,
82+
app.softnetwork.Info.infoSettings,
83+
moduleSettings
84+
)
4985
.dependsOn(
5086
common % "compile->compile;test->test;it->it"
5187
)
5288

5389
lazy val coreTestkit = project.in(file("core/testkit"))
5490
.configs(IntegrationTest)
55-
.settings(Defaults.itSettings)
91+
.settings(
92+
Defaults.itSettings,
93+
moduleSettings
94+
)
5695
.dependsOn(
5796
core % "compile->compile;test->test;it->it"
5897
)
@@ -62,15 +101,21 @@ lazy val coreTestkit = project.in(file("core/testkit"))
62101

63102
lazy val server = project.in(file("server"))
64103
.configs(IntegrationTest)
65-
.settings(Defaults.itSettings)
104+
.settings(
105+
Defaults.itSettings,
106+
moduleSettings
107+
)
66108
.enablePlugins(AkkaGrpcPlugin)
67109
.dependsOn(
68110
core % "compile->compile;test->test;it->it"
69111
)
70112

71113
lazy val serverTestkit = project.in(file("server/testkit"))
72114
.configs(IntegrationTest)
73-
.settings(Defaults.itSettings)
115+
.settings(
116+
Defaults.itSettings,
117+
moduleSettings
118+
)
74119
.dependsOn(
75120
server % "compile->compile;test->test;it->it"
76121
)
@@ -80,22 +125,31 @@ lazy val serverTestkit = project.in(file("server/testkit"))
80125

81126
lazy val sessionCommon = project.in(file("session/common"))
82127
.configs(IntegrationTest)
83-
.settings(Defaults.itSettings)
128+
.settings(
129+
Defaults.itSettings,
130+
moduleSettings
131+
)
84132
.enablePlugins(AkkaGrpcPlugin)
85133
.dependsOn(
86134
server % "compile->compile;test->test;it->it"
87135
)
88136

89137
lazy val sessionCore = project.in(file("session/core"))
90138
.configs(IntegrationTest)
91-
.settings(Defaults.itSettings)
139+
.settings(
140+
Defaults.itSettings,
141+
moduleSettings
142+
)
92143
.dependsOn(
93144
sessionCommon % "compile->compile;test->test;it->it"
94145
)
95146

96147
lazy val sessionTestkit = project.in(file("session/testkit"))
97148
.configs(IntegrationTest)
98-
.settings(Defaults.itSettings)
149+
.settings(
150+
Defaults.itSettings,
151+
moduleSettings
152+
)
99153
.dependsOn(
100154
sessionCore % "compile->compile;test->test;it->it"
101155
)
@@ -105,14 +159,20 @@ lazy val sessionTestkit = project.in(file("session/testkit"))
105159

106160
lazy val jdbc = project.in(file("jdbc"))
107161
.configs(IntegrationTest)
108-
.settings(Defaults.itSettings)
162+
.settings(
163+
Defaults.itSettings,
164+
moduleSettings
165+
)
109166
.dependsOn(
110167
core % "compile->compile;test->test;it->it"
111168
)
112169

113170
lazy val jdbcTestkit = project.in(file("jdbc/testkit"))
114171
.configs(IntegrationTest)
115-
.settings(Defaults.itSettings)
172+
.settings(
173+
Defaults.itSettings,
174+
moduleSettings
175+
)
116176
.dependsOn(
117177
jdbc % "compile->compile;test->test;it->it"
118178
)
@@ -122,47 +182,33 @@ lazy val jdbcTestkit = project.in(file("jdbc/testkit"))
122182

123183
lazy val cassandra = project.in(file("cassandra"))
124184
.configs(IntegrationTest)
125-
.settings(Defaults.itSettings)
185+
.settings(
186+
Defaults.itSettings,
187+
moduleSettings
188+
)
126189
.dependsOn(
127190
core % "compile->compile;test->test;it->it"
128191
)
129192

130193
lazy val counter = project.in(file("counter"))
131194
.configs(IntegrationTest)
132-
.settings(Defaults.itSettings)
133-
.dependsOn(
134-
core % "compile->compile;test->test;it->it"
195+
.settings(
196+
Defaults.itSettings,
197+
moduleSettings
135198
)
136-
.dependsOn(
137-
coreTestkit % "test->test;it->it"
138-
)
139-
140-
lazy val elastic = project.in(file("elastic"))
141-
.configs(IntegrationTest)
142-
.settings(Defaults.itSettings)
143199
.dependsOn(
144200
core % "compile->compile;test->test;it->it"
145201
)
146-
147-
lazy val elasticTestkit = project.in(file("elastic/testkit"))
148-
.configs(IntegrationTest)
149-
.settings(Defaults.itSettings)
150-
.dependsOn(
151-
elastic % "compile->compile;test->test;it->it"
152-
)
153202
.dependsOn(
154-
commonTestkit % "compile->compile;test->test;it->it"
155-
)
156-
.dependsOn(
157-
coreTestkit % "compile->compile;test->test;it->it"
158-
)
159-
.dependsOn(
160-
jdbcTestkit % "compile->compile;test->test;it->it"
203+
coreTestkit % "test->test;it->it"
161204
)
162205

163206
lazy val kv = project.in(file("kv"))
164207
.configs(IntegrationTest)
165-
.settings(Defaults.itSettings)
208+
.settings(
209+
Defaults.itSettings,
210+
moduleSettings
211+
)
166212
.enablePlugins(AkkaGrpcPlugin)
167213
.dependsOn(
168214
core % "compile->compile;test->test;it->it"
@@ -181,8 +227,6 @@ lazy val root = project.in(file("."))
181227
jdbcTestkit,
182228
// cassandra,
183229
counter,
184-
elastic,
185-
elasticTestkit,
186230
kv,
187231
server,
188232
serverTestkit,
@@ -191,7 +235,11 @@ lazy val root = project.in(file("."))
191235
sessionTestkit
192236
)
193237
.configs(IntegrationTest)
194-
.settings(Defaults.itSettings, Publish.noPublishSettings)
238+
.settings(
239+
Defaults.itSettings,
240+
Publish.noPublishSettings,
241+
crossScalaVersions := Nil
242+
)
195243

196244
Test / envVars := Map(
197245
"POSTGRES_USER" -> "admin",

common/build.sbt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@ val configDependencies = Seq(
1010
)
1111

1212
val jackson = Seq(
13-
"com.fasterxml.jackson.core" % "jackson-databind" % Versions.jackson,
14-
"com.fasterxml.jackson.core" % "jackson-core" % Versions.jackson,
15-
"com.fasterxml.jackson.core" % "jackson-annotations" % Versions.jackson,
16-
"com.fasterxml.jackson.module" % "jackson-module-scala_2.12" % Versions.jackson
13+
"com.fasterxml.jackson.core" % "jackson-databind" % Versions.jackson,
14+
"com.fasterxml.jackson.core" % "jackson-core" % Versions.jackson,
15+
"com.fasterxml.jackson.core" % "jackson-annotations" % Versions.jackson,
16+
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-cbor" % Versions.jackson,
17+
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-yaml" % Versions.jackson,
18+
"com.fasterxml.jackson.datatype" % "jackson-datatype-jdk8" % Versions.jackson,
19+
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % Versions.jackson,
20+
"com.fasterxml.jackson.module" % "jackson-module-parameter-names" % Versions.jackson,
21+
"com.fasterxml.jackson.module" %% "jackson-module-scala" % Versions.jackson,
1722
)
1823

1924
val jacksonExclusions = Seq(
2025
ExclusionRule(organization = "com.fasterxml.jackson.core"),
26+
ExclusionRule(organization = "com.fasterxml.jackson.dataformat"),
27+
ExclusionRule(organization = "com.fasterxml.jackson.datatype"),
28+
ExclusionRule(organization = "com.fasterxml.jackson.module"),
2129
ExclusionRule(organization = "org.codehaus.jackson")
2230
)
2331

0 commit comments

Comments
 (0)