-
Notifications
You must be signed in to change notification settings - Fork 8
/
.drone.jsonnet
93 lines (88 loc) · 2.66 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
84
85
86
87
88
89
90
91
92
93
local volumes() = [
# Use this to cache installed Python code between steps
{
"name": "python_install",
"path": "/usr/local/"
}
];
# Pipeline template
local test_with(version, do_deploy=false) = {
kind: "pipeline",
type: "docker",
name: "py" + version,
steps:
# std.prune removes skipped pipeline stages, since they evaluate to a null element
std.prune([
{
name: "install",
image: "python:" + version + "-bookworm",
commands: [
"pip install -r requirements.txt",
"python setup.py install"
],
volumes: volumes()
},
{
name: "test",
image: "python:" + version + "-bookworm",
commands: [
"apt-get update",
"apt-get install -yy imagemagick gcc-mingw-w64 make",
"cd tests && make",
"python -m unittest discover . --verbose"
],
volumes: volumes()
},
if do_deploy then {
name: "pypi_upload",
image: "plugins/pypi",
settings: {
username: "__token__",
password: {
"from_secret": "pypi_token"
}
},
when: {
event: ["tag"],
}
},
if do_deploy then {
name: "doc",
image: "python:" + version + "-bookworm",
commands: [
"pip install pdoc3",
"pdoc --html icoextract --template-dir pdoc/templates",
"ln html/icoextract/index.html icoextract.html"
],
volumes: volumes(),
},
if do_deploy then {
name: "doc_upload",
image: "techknowlogick/drone-b2",
settings: {
bucket: "jlu5-ci-doc",
account: {from_secret: "b2_account"},
key: {from_secret: "b2_key"},
source: "icoextract.html",
target: "/",
},
when: {
branch: ["master", "ci-*"],
event: ["push"],
},
},
]),
volumes: [
{
name: "python_install",
temp: {}
},
],
};
[
test_with("3.8"),
test_with("3.9"),
test_with("3.10"),
test_with("3.11"),
test_with("3.12", do_deploy=true),
]