Skip to content

Commit 22c455d

Browse files
author
aonyshchuk
committed
move to scalatest 2.3.2
migrate to drone
1 parent 0ebfaf4 commit 22c455d

File tree

13 files changed

+363
-74
lines changed

13 files changed

+363
-74
lines changed

β€Ž.drone.jsonnet

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
local Project = "scala-xml-diff";
2+
3+
local Dir = Project + "/";
4+
5+
local AbstractPipeline(name) = {
6+
kind: "pipeline",
7+
type: "docker",
8+
name: name
9+
};
10+
11+
local Workspace(name) = {
12+
workspace: { path: name }
13+
};
14+
15+
local WsPipeline(ver) = AbstractPipeline(Dir + ver) + Workspace(ver);
16+
17+
local Pipeline(ver, build, notify) = WsPipeline(ver) + {
18+
kind: "pipeline",
19+
type: "docker",
20+
name: Dir + ver,
21+
steps: [ build, notify ]
22+
};
23+
24+
local BuildStep(ver) = {
25+
name: "build",
26+
image: "andyglow/sbt:latest",
27+
when: { "branch": "master" },
28+
environment: {
29+
SCALA_VER: ver,
30+
CODECOV_TOKEN: { from_secret: "codecov_token" },
31+
DRONE_WORKSPACE_PATH: "/drone/src/" + ver
32+
}
33+
};
34+
35+
local SbtCleanTest(ver) = BuildStep(ver) + {
36+
commands: [
37+
"sbt clean test"
38+
]
39+
};
40+
41+
local Coverage(name, ver) = BuildStep(ver) + {
42+
name: name,
43+
commands: [
44+
"sbt clean coverage test",
45+
"sbt coverageAggregate",
46+
"wget -O .codecov https://codecov.io/bash",
47+
"chmod +x .codecov",
48+
"./.codecov -X gcov -X coveragepy -X xcode -X gcovout"
49+
]
50+
};
51+
52+
local NotifyMessage = |||
53+
{{#success build.status}}
54+
{{repo.name}}: build {{build.number}} for ver %(ver)s succeeded (spent {{since build.started}}). Good job. {{build.link}}
55+
{{else}}
56+
{{repo.name}}: build {{build.number}} for ver %(ver)s failed. Fix please. {{build.link}}
57+
{{/success}}
58+
|||;
59+
60+
local Notify(name, ver) = {
61+
name: name,
62+
image: "plugins/slack",
63+
when: { status: [ "success", "failure" ] },
64+
settings: {
65+
webhook: { from_secret: "slack_webhook_url" },
66+
channel: "builds",
67+
username: "drone",
68+
link_names: true,
69+
template: NotifyMessage % { ver: ver }
70+
}
71+
};
72+
73+
[
74+
Pipeline("2.13", SbtCleanTest("2.13"), Notify("slack", "2.13")),
75+
Pipeline("2.12", SbtCleanTest("2.12"), Notify("slack", "2.12")),
76+
Pipeline("2.11", SbtCleanTest("2.11"), Notify("slack", "2.11")),
77+
AbstractPipeline("finalize") + Workspace("2.13") + {
78+
steps: [
79+
Coverage("scoverage", "2.13")
80+
],
81+
depends_on: [
82+
Dir + "2.13",
83+
Dir + "2.12",
84+
Dir + "2.11"
85+
]
86+
},
87+
]

β€Ž.drone.yml

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
---
2+
{
3+
"kind": "pipeline",
4+
"name": "scala-xml-diff/2.13",
5+
"steps": [
6+
{
7+
"commands": [
8+
"sbt clean test"
9+
],
10+
"environment": {
11+
"CODECOV_TOKEN": {
12+
"from_secret": "codecov_token"
13+
},
14+
"DRONE_WORKSPACE_PATH": "/drone/src/2.13",
15+
"SCALA_VER": "2.13"
16+
},
17+
"image": "andyglow/sbt:latest",
18+
"name": "build",
19+
"when": {
20+
"branch": "master"
21+
}
22+
},
23+
{
24+
"image": "plugins/slack",
25+
"name": "slack",
26+
"settings": {
27+
"channel": "builds",
28+
"link_names": true,
29+
"template": "{{#success build.status}}\n {{repo.name}}: build {{build.number}} for ver 2.13 succeeded (spent {{since build.started}}). Good job. {{build.link}}\n{{else}}\n {{repo.name}}: build {{build.number}} for ver 2.13 failed. Fix please. {{build.link}}\n{{/success}}\n",
30+
"username": "drone",
31+
"webhook": {
32+
"from_secret": "slack_webhook_url"
33+
}
34+
},
35+
"when": {
36+
"status": [
37+
"success",
38+
"failure"
39+
]
40+
}
41+
}
42+
],
43+
"type": "docker",
44+
"workspace": {
45+
"path": "2.13"
46+
}
47+
}
48+
---
49+
{
50+
"kind": "pipeline",
51+
"name": "scala-xml-diff/2.12",
52+
"steps": [
53+
{
54+
"commands": [
55+
"sbt clean test"
56+
],
57+
"environment": {
58+
"CODECOV_TOKEN": {
59+
"from_secret": "codecov_token"
60+
},
61+
"DRONE_WORKSPACE_PATH": "/drone/src/2.12",
62+
"SCALA_VER": "2.12"
63+
},
64+
"image": "andyglow/sbt:latest",
65+
"name": "build",
66+
"when": {
67+
"branch": "master"
68+
}
69+
},
70+
{
71+
"image": "plugins/slack",
72+
"name": "slack",
73+
"settings": {
74+
"channel": "builds",
75+
"link_names": true,
76+
"template": "{{#success build.status}}\n {{repo.name}}: build {{build.number}} for ver 2.12 succeeded (spent {{since build.started}}). Good job. {{build.link}}\n{{else}}\n {{repo.name}}: build {{build.number}} for ver 2.12 failed. Fix please. {{build.link}}\n{{/success}}\n",
77+
"username": "drone",
78+
"webhook": {
79+
"from_secret": "slack_webhook_url"
80+
}
81+
},
82+
"when": {
83+
"status": [
84+
"success",
85+
"failure"
86+
]
87+
}
88+
}
89+
],
90+
"type": "docker",
91+
"workspace": {
92+
"path": "2.12"
93+
}
94+
}
95+
---
96+
{
97+
"kind": "pipeline",
98+
"name": "scala-xml-diff/2.11",
99+
"steps": [
100+
{
101+
"commands": [
102+
"sbt clean test"
103+
],
104+
"environment": {
105+
"CODECOV_TOKEN": {
106+
"from_secret": "codecov_token"
107+
},
108+
"DRONE_WORKSPACE_PATH": "/drone/src/2.11",
109+
"SCALA_VER": "2.11"
110+
},
111+
"image": "andyglow/sbt:latest",
112+
"name": "build",
113+
"when": {
114+
"branch": "master"
115+
}
116+
},
117+
{
118+
"image": "plugins/slack",
119+
"name": "slack",
120+
"settings": {
121+
"channel": "builds",
122+
"link_names": true,
123+
"template": "{{#success build.status}}\n {{repo.name}}: build {{build.number}} for ver 2.11 succeeded (spent {{since build.started}}). Good job. {{build.link}}\n{{else}}\n {{repo.name}}: build {{build.number}} for ver 2.11 failed. Fix please. {{build.link}}\n{{/success}}\n",
124+
"username": "drone",
125+
"webhook": {
126+
"from_secret": "slack_webhook_url"
127+
}
128+
},
129+
"when": {
130+
"status": [
131+
"success",
132+
"failure"
133+
]
134+
}
135+
}
136+
],
137+
"type": "docker",
138+
"workspace": {
139+
"path": "2.11"
140+
}
141+
}
142+
---
143+
{
144+
"depends_on": [
145+
"scala-xml-diff/2.13",
146+
"scala-xml-diff/2.12",
147+
"scala-xml-diff/2.11"
148+
],
149+
"kind": "pipeline",
150+
"name": "finalize",
151+
"steps": [
152+
{
153+
"commands": [
154+
"sbt clean coverage test",
155+
"sbt coverageAggregate",
156+
"wget -O .codecov https://codecov.io/bash",
157+
"chmod +x .codecov",
158+
"./.codecov -X gcov -X coveragepy -X xcode -X gcovout"
159+
],
160+
"environment": {
161+
"CODECOV_TOKEN": {
162+
"from_secret": "codecov_token"
163+
},
164+
"DRONE_WORKSPACE_PATH": "/drone/src/2.13",
165+
"SCALA_VER": "2.13"
166+
},
167+
"image": "andyglow/sbt:latest",
168+
"name": "scoverage",
169+
"when": {
170+
"branch": "master"
171+
}
172+
}
173+
],
174+
"type": "docker",
175+
"workspace": {
176+
"path": "2.13"
177+
}
178+
}
179+
...

β€Ž.travis.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

β€Žbuild.sbt

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,29 @@
11
import xerial.sbt.Sonatype._
22
import ReleaseTransformations._
33
import scala.sys.process._
4-
4+
import ScalaVer._
55

66
name := "scala-xml-diff"
77

88
organization := "com.github.andyglow"
99

10-
scalaVersion := "2.13.0"
10+
scalaVersion := (ScalaVer.fromEnv getOrElse ScalaVer.default).full
11+
12+
crossScalaVersions := ScalaVer.values.map(_.full)
1113

12-
crossScalaVersions := Seq("2.11.12", "2.12.8", "2.13.0")
14+
scalaV := ScalaVer.fromString(scalaVersion.value) getOrElse ScalaVer.default
15+
16+
scalacOptions := CompilerOptions(scalaV.value)
1317

1418
scalacOptions in (Compile, doc) ++= Opts.doc.title("Scala XML Diff Tool")
1519

1620
scalacOptions in (Compile, doc) ++= Opts.doc.version(version.value)
1721

1822
libraryDependencies ++= Seq(
19-
"org.scala-lang.modules" %% "scala-xml" % "1.2.0",
20-
"org.scalatest" %% "scalatest" % "3.0.8" % Provided)
21-
22-
scalacOptions ++= {
23-
val options = Seq(
24-
"-encoding", "UTF-8",
25-
"-feature",
26-
"-unchecked",
27-
"-deprecation",
28-
"-Xfatal-warnings",
29-
"-Xlint",
30-
"-Yno-adapted-args",
31-
"-Ywarn-dead-code",
32-
"-Ywarn-numeric-widen",
33-
"-Xfuture")
34-
35-
// WORKAROUND https://github.com/scala/scala/pull/5402
36-
CrossVersion.partialVersion(scalaVersion.value) match {
37-
case Some((2, 12)) => options.map {
38-
case "-Xlint" => "-Xlint:-unused,_"
39-
case "-Ywarn-unused-import" => "-Ywarn-unused:imports,-patvars,-privates,-locals,-params,-implicits"
40-
case other => other
41-
}
42-
case Some((2, n)) if n >= 13 => options.filterNot { opt =>
43-
opt == "-Yno-adapted-args" || opt == "-Xfuture"
44-
} :+ "-Xsource:2.13"
45-
case _ => options
46-
}
47-
}
23+
"org.scala-lang.modules" %% "scala-xml" % "1.3.0",
24+
"org.scalatest" %% "scalatest" % "3.2.3" % Provided)
4825

4926
// release
50-
5127
publishTo := sonatypePublishTo.value
5228

5329
licenses ++= Seq(

β€Žproject/CompilerOptions.scala

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
object CompilerOptions {
2+
3+
private val base = Seq(
4+
"-encoding", "UTF-8",
5+
"-feature",
6+
"-unchecked",
7+
"-deprecation",
8+
"-language:higherKinds")
9+
10+
private val opts211 = base ++ Seq(
11+
"-Xfuture",
12+
"-Yno-adapted-args",
13+
"-Ywarn-dead-code",
14+
"-Ywarn-numeric-widen",
15+
"-Ywarn-value-discard",
16+
"-Ywarn-unused"
17+
)
18+
19+
private val opts212 = base ++ Seq(
20+
"-Ywarn-unused:imports,-patvars,-privates,-locals,-implicits",
21+
"-Xlint:-unused,_"
22+
)
23+
24+
private val opts213 = base ++ Seq(
25+
"-Ywarn-unused:imports,-patvars,-privates,-locals,-implicits",
26+
"-Xsource:2.13"
27+
)
28+
29+
def apply(v: ScalaVer): Seq[String] = {
30+
v match {
31+
case ScalaVer._211 => opts211
32+
case ScalaVer._212 => opts212
33+
case ScalaVer._213 => opts213
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)