-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.sbt
249 lines (227 loc) · 8.74 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
import sbtghactions.JavaSpec.Distribution.Adopt
val Scala213 = "2.13.10"
val Scala212 = "2.12.18"
val Java18 = JavaSpec(Adopt, "8")
val Java11 = JavaSpec(Adopt, "11")
enablePlugins(SonatypeCiReleasePlugin)
Global / onChangedBuildSource := ReloadOnSourceChanges
ThisBuild / mimaFailOnProblem := false
ThisBuild / mimaFailOnNoPrevious := false
ThisBuild / scalaVersion := Scala213
ThisBuild / crossScalaVersions := Seq(Scala213, Scala212)
ThisBuild / organization := "dev.fpinbo"
ThisBuild / organizationName := "Functional Programming in Bologna"
ThisBuild / publishFullName := "Alessandro Zoffoli"
ThisBuild / publishGithubUser := "al333z"
ThisBuild / githubWorkflowJavaVersions := Seq(Java18, Java11)
ThisBuild / baseVersion := "0.0.1"
//CI definition
val MicrositesCond = s"matrix.scala == '$Scala212'"
def micrositeWorkflowSteps(cond: Option[String] = None): List[WorkflowStep] = List(
WorkflowStep.Use(
UseRef.Public("ruby", "setup-ruby", "v1"),
params = Map("ruby-version" -> "2.6"),
cond = cond
),
WorkflowStep.Run(List("gem update --system"), cond = cond),
WorkflowStep.Run(List("gem install sass"), cond = cond),
WorkflowStep.Run(List("gem install jekyll -v 4"), cond = cond)
)
ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep
.Run(List("docker-compose up --renew-anon-volumes --force-recreate -d"), name = Some("Start docker containers")),
WorkflowStep.Sbt(List("test"), name = Some("Test")),
WorkflowStep.Run(List("docker-compose down"), name = Some("Stop docker containers"))
// WorkflowStep.Sbt(List("mimaReportBinaryIssues"), name = Some("Binary Compatibility Check"))
) ++ micrositeWorkflowSteps(Some(MicrositesCond)).toSeq :+ WorkflowStep.Sbt(
List("site/makeMicrosite"),
cond = Some(MicrositesCond)
)
ThisBuild / githubWorkflowAddedJobs ++= Seq(
WorkflowJob(
"scalafmt",
"Scalafmt",
githubWorkflowJobSetup.value.toList ::: List(
WorkflowStep.Sbt(List("scalafmtCheckAll"), name = Some("Scalafmt"))
),
// Awaiting release of https://github.com/scalameta/scalafmt/pull/2324/files
scalas = crossScalaVersions.value.toList.filter(_.startsWith("2."))
),
/* WorkflowJob(
"microsite",
"Microsite",
githubWorkflowJobSetup.value.toList ::: (micrositeWorkflowSteps(None) :+ WorkflowStep
.Sbt(List("site/makeMicrosite"), name = Some("Build the microsite"))),
scalas = List(Scala212)
),*/
WorkflowJob( //This step is to collect the entire build outcome since mergify is not acting properly with githubactions.
id = "build-success",
name = "Build Success",
needs = List("build", "scalafmt"),
steps = List(WorkflowStep.Run(List("echo Build Succeded"))),
oses = List("ubuntu-latest"),
//These are useless but we don't know how to remove the scalas and javas attributes
// (if you provide empty list it will create an empty list in the yml which is wrong)
scalas = List(Scala213),
javas = List(Java18)
)
)
ThisBuild / githubWorkflowTargetBranches := List("*")
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v")))
ThisBuild / githubWorkflowPublish := Seq(
WorkflowStep.Sbt(
List("release")
)
)
ThisBuild / githubWorkflowAddedJobs += WorkflowJob(
id = "site",
name = "Deploy site",
needs = List("build"),
javas = List(Java11),
scalas = List(Scala213),
cond = """
| always() &&
| needs.build.result == 'success' &&
| (github.ref == 'refs/heads/main')
""".stripMargin.trim.linesIterator.mkString.some,
steps = githubWorkflowGeneratedDownloadSteps.value.toList :+
WorkflowStep.Use(
UseRef.Public("peaceiris", "actions-gh-pages", "v3"),
name = Some(s"Deploy site"),
params = Map(
"publish_dir" -> "./site/target/site",
"github_token" -> "${{ secrets.GITHUB_TOKEN }}"
)
)
)
val catsV = "2.10.0"
val jmsV = "2.0.1"
val ibmMQV = "9.3.4.0"
val activeMQV = "2.19.1"
val catsEffectV = "3.5.2"
val catsEffectScalaTestV = "1.5.0"
val fs2V = "3.9.3"
val log4catsV = "2.6.0"
val log4jSlf4jImplV = "2.22.0"
val kindProjectorV = "0.13.2"
val betterMonadicForV = "0.3.1"
// Projects
lazy val jms4s = project
.in(file("."))
.enablePlugins(NoPublishPlugin)
.aggregate(core, ibmMQ, activeMQArtemis, tests, examples, site)
.settings(commonSettings, releaseSettings)
lazy val core = project
.in(file("core"))
.settings(commonSettings, releaseSettings)
.settings(name := "jms4s")
.settings(Test / parallelExecution := false)
lazy val ibmMQ = project
.in(file("ibm-mq"))
.settings(commonSettings, releaseSettings)
.settings(name := "jms4s-ibm-mq")
.settings(libraryDependencies += "com.ibm.mq" % "com.ibm.mq.allclient" % ibmMQV)
.settings(Test / parallelExecution := false)
.dependsOn(core)
lazy val activeMQArtemis = project
.in(file("active-mq-artemis"))
.settings(commonSettings, releaseSettings)
.settings(name := "jms4s-active-mq-artemis")
.settings(libraryDependencies += "org.apache.activemq" % "artemis-jms-client-all" % activeMQV)
.settings(Test / parallelExecution := false)
.dependsOn(core)
lazy val tests = project
.in(file("tests"))
.settings(commonSettings, releaseSettings)
.enablePlugins(NoPublishPlugin)
.settings(libraryDependencies += "org.apache.logging.log4j" % "log4j-slf4j-impl" % log4jSlf4jImplV % Runtime)
.settings(Test / parallelExecution := false)
.dependsOn(ibmMQ, activeMQArtemis)
lazy val examples = project
.in(file("examples"))
.settings(commonSettings, releaseSettings)
.enablePlugins(NoPublishPlugin)
.dependsOn(ibmMQ, activeMQArtemis)
lazy val site = project
.in(file("site"))
.enablePlugins(MicrositesPlugin)
.enablePlugins(MdocPlugin)
.enablePlugins(NoPublishPlugin)
.settings(commonSettings)
.dependsOn(core, ibmMQ, activeMQArtemis)
.settings {
import microsites._
Seq(
micrositeName := "jms4s",
micrositeDescription := "a functional wrapper for jms",
micrositeAuthor := "fp-in-bo",
micrositeGithubOwner := "fp-in-bo",
micrositeGithubRepo := "jms4s",
micrositeBaseUrl := "/jms4s",
micrositeFooterText := None,
micrositeGitterChannel := false,
scalacOptions --= Seq(
"-Xfatal-warnings",
"-Ywarn-unused-import",
"-Ywarn-unused:imports",
"-Ywarn-numeric-widen",
"-Ywarn-dead-code",
"-Xlint:-missing-interpolator,_"
),
micrositePushSiteWith := GitHub4s,
micrositeGithubToken := sys.env.get("GITHUB_TOKEN"),
micrositeExtraMdFiles := Map(
file("README.md") -> ExtraMdFileConfig(
"index.md",
"home",
Map("section" -> "home", "position" -> "0", "permalink" -> "/")
),
file("CODE_OF_CONDUCT.md") -> ExtraMdFileConfig(
"code-of-conduct.md",
"page",
Map("title" -> "Code of conduct", "section" -> "code of conduct", "position" -> "100")
),
file("LICENSE") -> ExtraMdFileConfig(
"license.md",
"page",
Map("title" -> "License", "section" -> "license", "position" -> "101")
)
)
)
}
// General Settings
lazy val commonSettings = Seq(
scalafmtOnCompile := true,
addCompilerPlugin("org.typelevel" %% "kind-projector" % kindProjectorV cross CrossVersion.full),
addCompilerPlugin("com.olegpy" %% "better-monadic-for" % betterMonadicForV),
libraryDependencies ++= Seq(
"javax.jms" % "javax.jms-api" % jmsV,
"org.typelevel" %% "cats-core" % catsV,
"org.typelevel" %% "cats-effect" % catsEffectV,
"co.fs2" %% "fs2-core" % fs2V,
"org.typelevel" %% "log4cats-slf4j" % log4catsV,
"org.typelevel" %% "cats-effect-testing-scalatest" % catsEffectScalaTestV % Test
)
)
lazy val releaseSettings = {
Seq(
Test / publishArtifact := false,
homepage := Some(url("https://github.com/fp-in-bo/jms4s")),
startYear := Some(2020),
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT")),
scmInfo := Some(
ScmInfo(
url("https://github.com/fp-in-bo/jms4s"),
"[email protected]:fp-in-bo/jms4s.git"
)
),
developers := List(
Developer("azanin", "Alessandro Zanin", "[email protected]", url("https://github.com/azanin")),
Developer("al333z", "Alessandro Zoffoli", "[email protected]", url("https://github.com/al333z")),
Developer("faustin0", "Fausto Di Natale", "[email protected]", url("https://github.com/faustin0")),
Developer("r-tomassetti", "Renato Tomassetti", "[email protected]", url("https://github.com/r-tomassetti"))
)
)
}
addCommandAlias("buildAll", ";clean;scalafmtAll;+test;mdoc")