-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sbt
192 lines (176 loc) · 6.33 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
val zioVersion = "1.0.15"
val circeVersion = "0.14.5"
val doobieVersion = "1.0.0-RC4"
val scala213 = "2.13.11"
val scala212 = "2.12.18"
inThisBuild(
List(
scalaVersion := scala212,
crossScalaVersions := Seq(scala213, scala212),
organization := "com.github.jatcwang",
homepage := Some(url("https://github.com/jatcwang/doobieroll")),
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer(
"jatcwang",
"Jacob Wang",
url("https://almostfunctional.com"),
),
),
),
)
lazy val core = Project("core", file("modules/core"))
.settings(commonSettings)
.settings(
name := "doobieroll",
// mimaPreviousArtifacts := Set("com.github.jatcwang" %% "doobieroll" % "0.1.6"),
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.7.0",
"org.scala-lang.modules" %% "scala-collection-compat" % "2.7.0",
"com.chuusai" %% "shapeless" % "2.3.9",
"org.tpolecat" %% "doobie-core" % doobieVersion,
),
)
lazy val coretest = Project("coretest", file("modules/coretest"))
.dependsOn(core)
.settings(commonSettings)
.settings(noPublishSettings)
.settings(
libraryDependencies ++= Seq(
"org.flywaydb" % "flyway-core" % "9.19.4",
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"dev.zio" %% "zio-test" % zioVersion,
"dev.zio" %% "zio-test-sbt" % zioVersion,
"dev.zio" %% "zio-test-magnolia" % zioVersion,
"dev.zio" %% "zio-interop-cats" % "3.2.9.1",
"javax.activation" % "activation" % "1.1.1", // Required for DataSource class in JDK 9+
"org.tpolecat" %% "doobie-postgres" % doobieVersion,
"org.tpolecat" %% "doobie-postgres-circe" % doobieVersion,
"org.tpolecat" %% "doobie-hikari" % doobieVersion,
"org.postgresql" % "postgresql" % "42.6.0",
"com.softwaremill.quicklens" %% "quicklens" % "1.8.8",
"com.whisk" %% "docker-testkit-impl-docker-java" % "0.9.9" % "test",
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"),
)
lazy val bench = Project("bench", file("modules/bench"))
.dependsOn(core, coretest)
.enablePlugins(JmhPlugin)
.settings(commonSettings)
.settings(noPublishSettings)
.settings(
libraryDependencies ++= Seq(
"org.tpolecat" %% "doobie-postgres" % doobieVersion,
"org.tpolecat" %% "doobie-postgres-circe" % doobieVersion,
"org.tpolecat" %% "doobie-hikari" % doobieVersion,
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % "2.13.30",
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.13.30" % "provided",
"org.tpolecat" %% "skunk-core" % "0.3.1",
),
)
lazy val docs = project
.dependsOn(core, coretest)
.enablePlugins(MicrositesPlugin)
.settings(
commonSettings,
publish / skip := true,
)
.settings(
mdocIn := file("docs/docs"),
mdocExtraArguments ++= Seq("--noLinkHygiene"),
micrositeName := "DoobieRoll",
micrositeDescription := "Collection of utilities for working with Doobie/SQL",
micrositeUrl := "https://jatcwang.github.io",
micrositeBaseUrl := "/doobieroll",
micrositeDocumentationUrl := s"${micrositeBaseUrl.value}/docs/assembler",
micrositeAuthor := "Jacob Wang",
micrositeGithubOwner := "jatcwang",
micrositeGithubRepo := "doobieroll",
micrositeHighlightTheme := "a11y-light",
micrositePushSiteWith := GitHub4s,
micrositeGithubToken := sys.env.get("GITHUB_TOKEN"),
)
.settings(
// Disble any2stringAdd deprecation in md files. Seems like mdoc macro generates code which
// use implicit conversion to string
scalacOptions ~= { opts =>
val extraOpts = Seq("-Wconf:msg=\".*method any2stringadd.*\":i")
val removes = Set("-Wdead-code", "-Ywarn-dead-code") // we use ??? in various places
(opts ++ extraOpts).filterNot(removes)
},
scalacOptions --= Seq("-Wdead-code", "-Ywarn-dead-code"), // we use ??? in various places
)
lazy val root = project
.in(new File("."))
.aggregate(bench, core, coretest, docs)
.settings(noPublishSettings)
.settings(commonSettings)
lazy val commonSettings = Seq(
scalacOptions ++= Seq(
"-Ywarn-macros:after",
),
versionScheme := Some("early-semver"),
doc / scalacOptions --= Seq("-Xfatal-warnings"),
scalacOptions --= {
if (sys.env.contains("CI")) {
Seq.empty
} else {
Seq("-Xfatal-warnings")
}
},
addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.13.2" cross CrossVersion.full),
addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1"),
)
lazy val noPublishSettings = Seq(
publish / skip := true,
)
ThisBuild / githubWorkflowJavaVersions := Seq("[email protected]")
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches :=
Seq(RefPredicate.StartsWith(Ref.Tag("v")))
ThisBuild / githubWorkflowPublish := Seq(
WorkflowStep.Sbt(
List("ci-release", "publishMicrosite"),
env = Map(
"PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}",
"PGP_SECRET" -> "${{ secrets.PGP_SECRET }}",
"SONATYPE_PASSWORD" -> "${{ secrets.SONATYPE_PASSWORD }}",
"SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}",
),
),
)
val setupJekyllSteps = Seq(
WorkflowStep.Use(
UseRef.Public("ruby", "setup-ruby", "v1"),
name = Some("Setup ruby"),
params = Map("ruby-version" -> "2.7"),
),
WorkflowStep.Run(
List("gem install jekyll -v 4.1.1"),
name = Some("Install Jekyll (to build microsite)"),
),
)
ThisBuild / githubWorkflowBuildPreamble ++= setupJekyllSteps ++ Seq(
WorkflowStep.Run(
List("docker pull postgres:12.3-alpine"),
name = Some("Pull Postgres image for integration tests"),
),
)
ThisBuild / githubWorkflowPublishPreamble ++= setupJekyllSteps
// Add makeMicrosite to the build step
ThisBuild / githubWorkflowBuild ~= { steps =>
steps.map {
case w: WorkflowStep.Sbt if w.commands == List("test") =>
w.copy(commands = List("test", "makeMicrosite"))
case w => w
}
}
// Filter out MacOS and Windows cache steps to make yaml less noisy
ThisBuild / githubWorkflowGeneratedCacheSteps ~= { currentSteps =>
currentSteps.filterNot(wf =>
wf.cond.exists(str => str.contains("macos") || str.contains("windows")),
)
}