-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.jsonnet
83 lines (74 loc) · 1.98 KB
/
.drone.jsonnet
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
local AbstractPipeline(name) = {
kind: "pipeline",
type: "docker",
name: name
};
local Workspace(name) = {
workspace: { path: name }
};
local WsPipeline(ver) = AbstractPipeline("scala-gpl/" + ver) + Workspace(ver);
local Pipeline(ver, build, notify) = WsPipeline(ver) + {
kind: "pipeline",
type: "docker",
name: "scala-gpl/" + ver,
steps: [ build, notify ]
};
local BuildStep(ver) = {
name: "build",
image: "andyglow/sbt:latest",
when: { "branch": "master" },
environment: {
SCALA_VER: ver,
CODECOV_TOKEN: { from_secret: "codecov_token" },
DRONE_WORKSPACE_PATH: "/drone/src/" + ver
}
};
local SbtCleanTest(ver) = BuildStep(ver) + {
commands: [
"sbt clean test"
]
};
local Coverage(name, ver) = BuildStep(ver) + {
name: name,
commands: [
"sbt clean coverage test",
"sbt coverageAggregate",
"wget -O .codecov https://codecov.io/bash",
"chmod +x .codecov",
"./.codecov -X gcov -X coveragepy -X xcode -X gcovout"
]
};
local NotifyMessage = |||
{{#success build.status}}
{{repo.name}}: build {{build.number}} for ver %(ver)s succeeded (spent {{since build.started}}). Good job. {{build.link}}
{{else}}
{{repo.name}}: build {{build.number}} for ver %(ver)s failed. Fix please. {{build.link}}
{{/success}}
|||;
local Notify(name, ver) = {
name: name,
image: "plugins/slack",
when: { status: [ "success", "failure" ] },
settings: {
webhook: { from_secret: "slack_webhook_url" },
channel: "builds",
username: "drone",
link_names: true,
template: NotifyMessage % { ver: ver }
}
};
[
Pipeline("2.13", SbtCleanTest("2.13"), Notify("slack", "2.13")),
Pipeline("2.12", SbtCleanTest("2.12"), Notify("slack", "2.12")),
Pipeline("2.11", SbtCleanTest("2.11"), Notify("slack", "2.11")),
AbstractPipeline("finalize") + Workspace("2.13") + {
steps: [
Coverage("scoverage", "2.13")
],
depends_on: [
"scala-gpl/2.13",
"scala-gpl/2.12",
"scala-gpl/2.11"
]
},
]