forked from zio/zio-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
144 lines (134 loc) · 4.51 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
import BuildHelper._
import Dependencies._
import sbt.librarymanagement.ScalaArtifacts.isScala3
val releaseDrafterVersion = "5"
// Setting default log level to INFO
val _ = sys.props += ("ZHttpLogLevel" -> Debug.ZHttpLogLevel)
// CI Configuration
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.graalvm("21.1.0", "11"), JavaSpec.temurin("8"))
ThisBuild / githubWorkflowPREventTypes := Seq(
PREventType.Opened,
PREventType.Synchronize,
PREventType.Reopened,
PREventType.Edited,
PREventType.Labeled,
)
ThisBuild / githubWorkflowAddedJobs :=
Seq(
WorkflowJob(
id = "update_release_draft",
name = "Release Drafter",
steps = List(WorkflowStep.Use(UseRef.Public("release-drafter", "release-drafter", s"v${releaseDrafterVersion}"))),
cond = Option("${{ github.base_ref == 'main' }}"),
),
WorkflowJob(
id = "update_docs",
name = "Publish Documentation",
steps = List(
WorkflowStep.Use(UseRef.Public("actions", "checkout", s"v2")),
WorkflowStep.Use(UseRef.Public("actions", "setup-node", s"v2")),
WorkflowStep.Run(
env = Map("GIT_PASS" -> "${{secrets.ACTIONS_PAT}}", "GIT_USER" -> "${{secrets.GIT_USER}}"),
commands = List(
"cd ./docs/website",
"npm install",
"git config --global user.name \"${{secrets.GIT_USER}}\"",
"npm run deploy",
),
),
),
cond = Option("${{ github.ref == 'refs/heads/main' }}"),
),
) ++ ScoverageWorkFlow(50, 60) ++ BenchmarkWorkFlow() ++ JmhBenchmarkWorkflow(1)
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches += RefPredicate.StartsWith(Ref.Tag("v"))
ThisBuild / githubWorkflowPublish :=
Seq(
WorkflowStep.Sbt(
List("ci-release"),
env = Map(
"PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}",
"PGP_SECRET" -> "${{ secrets.PGP_SECRET }}",
"SONATYPE_PASSWORD" -> "${{ secrets.SONATYPE_PASSWORD }}",
"SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}",
"CI_SONATYPE_RELEASE" -> "${{ secrets.CI_SONATYPE_RELEASE }}",
),
),
)
//scala fix isn't available for scala 3 so ensure we only run the fmt check
//using the latest scala 2.13
ThisBuild / githubWorkflowBuildPreamble := Seq(
WorkflowStep.Run(
name = Some("Check formatting"),
commands = List(s"sbt ++${Scala213} fmtCheck"),
cond = Some(s"matrix.scala == '${Scala213}'"),
),
)
ThisBuild / githubWorkflowBuildPostamble :=
WorkflowJob(
"checkDocGeneration",
"Check doc generation",
List(
WorkflowStep.Run(
commands = List(s"sbt ++${Scala213} doc"),
name = Some("Check doc generation"),
cond = Some("${{ github.event_name == 'pull_request' }}"),
),
),
scalas = List(Scala213),
).steps
lazy val root = (project in file("."))
.settings(stdSettings("root"))
.settings(publishSetting(false))
.aggregate(
zhttp,
zhttpBenchmarks,
zhttpLogging,
example,
)
lazy val zhttp = (project in file("zio-http"))
.settings(stdSettings("zhttp"))
.settings(publishSetting(true))
.settings(meta)
.settings(
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"),
libraryDependencies ++= netty ++ Seq(
`zio`,
`zio-streams`,
`zio-test`,
`zio-test-sbt`,
`netty-incubator`,
),
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n <= 12 => Seq(`scala-compact-collection`)
case _ => Seq.empty
}
},
)
.dependsOn(zhttpLogging)
lazy val zhttpBenchmarks = (project in file("zio-http-benchmarks"))
.enablePlugins(JmhPlugin)
.dependsOn(zhttp)
.settings(stdSettings("zhttpBenchmarks"))
.settings(publishSetting(false))
.settings(libraryDependencies ++= Seq(zio))
lazy val zhttpLogging = (project in file("zio-http-logging"))
.settings(stdSettings("zhttp-logging"))
.settings(publishSetting(true))
.settings(
libraryDependencies ++= {
if (isScala3(scalaVersion.value)) Seq.empty
else Seq(reflect.value % Provided)
},
)
.settings(
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"),
libraryDependencies ++= Seq(`zio-test`, `zio-test-sbt`),
)
lazy val example = (project in file("./example"))
.settings(stdSettings("example"))
.settings(publishSetting(false))
.settings(runSettings(Debug.Main))
.settings(libraryDependencies ++= Seq(`jwt-core`))
.dependsOn(zhttp)