-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.drone.yml
275 lines (222 loc) · 5.75 KB
/
.drone.yml
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
---
kind: pipeline
type: docker
name: default
steps:
- name: merge master on testing
image: alpine/git
when:
event: push
branch: master
commands:
- cd /tmp
- git clone $DRONE_GIT_HTTP_URL
- cd volmdlr
- git checkout master
- git fetch origin testing
- git checkout testing
- git merge master
- git push
- name: merge testing on dev
image: alpine/git
when:
event: push
branch: testing
commands:
- cd /tmp
- git clone $DRONE_GIT_HTTP_URL
- cd volmdlr
- git checkout testing
- git fetch origin dev
- git checkout dev
- git merge testing
- git push
- name: check changelog update
image: python:3.9
when:
event: pull_request
commands:
- git fetch origin "$DRONE_TARGET_BRANCH":"refs/remotes/origin/$DRONE_TARGET_BRANCH"
- git fetch origin pull/$DRONE_PULL_REQUEST/head:refs/remotes/origin/pr/$DRONE_PULL_REQUEST
- bash code_changelog.sh
- name: check pep8 formatting
image: python:3.9
when:
event:
exclude:
- tag
- push
commands:
- pip3 install -U pip autopep8==2.0.0
- bash code_pep8.sh
volumes:
# Mount pip cache from host
- name: pip_cache
path: /root/.cache/pip
- name: check code complexity
image: dessia/python-ci:3.9
when:
event:
exclude:
- tag
- push
commands:
- pip install numpy Cython>3
- pip install pylint==2.17.3 pydocstyle==6.3.0 pre-commit shellcheck-py cython-lint pyenchant==3.2.2
- python code_pylint.py
- python code_pydocstyle.py
- pre-commit run -a
volumes:
# Mount pip cache from host
- name: pip_cache
path: /root/.cache/pip
- name: install, build doc run scripts and tutorials
image: python:3.9
when:
event: push
commands:
- git fetch --tags
- pip install .[doc,test]
- python setup.py build_ext --inplace
- cd tests
- coverage run --rcfile=../.coveragerc --data-file=../.coverage --source volmdlr -m unittest discover -v
- cd ../scripts
- coverage run --rcfile=../.coveragerc --data-file=../.coverage --source volmdlr -a ci_scripts.py
- cd ../tutorials
- coverage run --rcfile=../.coveragerc --data-file=../.coverage --source volmdlr -a ci_tutorials.py
- cd ../doc
- make html
- cd ..
- coverage json
- coverage report
- coverage html
- python coverage.py
volumes:
# Mount pip cache from host
- name: pip_cache
path: /root/.cache/pip
# Special step for fork pull request
- name: Fork only; install, build doc run scripts and tutorials
image: python:3.9
when:
event:
- pull_request
environment:
GITHUB_TOKEN:
from_secret: github_token
commands:
- apt-get update && apt-get install -y jq
- |
api_url="https://api.github.com/repos/${DRONE_REPO}/pulls/${DRONE_PULL_REQUEST}"
source_repo=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "$api_url" | jq -r .head.repo.full_name)
echo "Source Repository: $source_repo"
if [ -z "$source_repo" ] || [ "$source_repo" = "null" ]; then
echo "Failed to fetch source repository. The GitHub token may have expired or lacks the necessary permissions."
exit 1
fi
if [ "$source_repo" = "${DRONE_REPO}" ]; then
echo "Source repo is ${DRONE_REPO}. Skipping step..."
else
echo "Source repo is a fork. Performing install, build doc run scripts and tutorials..."
git fetch --tags
pip install .[doc,test]
python setup.py build_ext --inplace
cd tests
coverage run --rcfile=../.coveragerc --data-file=../.coverage --source volmdlr -m unittest discover -v
cd ../scripts
coverage run --rcfile=../.coveragerc --data-file=../.coverage --source volmdlr -a ci_scripts.py
cd ../tutorials
coverage run --rcfile=../.coveragerc --data-file=../.coverage --source volmdlr -a ci_tutorials.py
cd ../doc
make html
cd ..
coverage json
coverage report
coverage html
python coverage.py
fi
- name: generate sdist
image: python:3.9
when:
branch: master
commands:
- git fetch --tags
- pip install .
- python setup.py sdist
volumes:
# Mount pip cache from host
- name: pip_cache
path: /root/.cache/pip
- name: generate bdist_wheel
image: python:3.9
when:
branch: master
commands:
- git fetch --tags
- pip install wheel
- pip install .
- python setup.py bdist_wheel
volumes:
# Mount pip cache from host
- name: pip_cache
path: /root/.cache/pip
- name: upload to pypi
image: plugins/pypi
when:
event: tag
settings:
skip_build: True
username: dessia_tech
password:
from_secret: pypi_password
- name: upload_doc_master
image: appleboy/drone-scp
when:
branch: master
event: push
settings:
host: austerlitz.dessia.tech
target: /var/www/documentation/volmdlr/
source: doc/build/html/*
strip_components: 3
username: drone
password:
from_secret: ssh_drone_password
- name: upload coverage
image: appleboy/drone-scp
when:
event: push
failure: ignore
settings:
host: magenta.dessia.tech
target: /var/www/cdn/volmdlr/coverage/${DRONE_BRANCH}
source: htmlcov/*
strip_components: 1
username: drone
password:
from_secret: ssh_drone_password
- name: notify by email
when:
event: push
branch:
- master
- dev
status:
- failure
image: drillster/drone-email
settings:
host: mail.dessia.tech
username: technical@dessia.tech
password:
from_secret: email_password
from: technical@dessia.tech
volumes:
- name: cache
path: /root/.cache
volumes:
- name: pip_cache
host:
path: /tmp/cache/drone/pip
- name: cache
host:
path: /tmp/cache/drone