-
Notifications
You must be signed in to change notification settings - Fork 24
/
.gitlab-ci.yml
390 lines (331 loc) · 9.53 KB
/
.gitlab-ci.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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
image: gitlab.kwant-project.org:5005/kwant/kwant
stages:
- build-env
- build
- test
- deploy
- release
before_script:
# Here and below, a workaround for gitlab runner not fetching tags
# See https://gitlab.com/gitlab-org/gitaly/-/issues/2221
- git config --global --add safe.directory /builds/kwant/kwant
- git fetch --tags
variables:
# rsync is used to send documentation to our web servers: we never send any
# secret information, and using 'ssh-keyscan' causes the CI server's IP to be blacklisted
SSH_COMMAND: "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
# Turn off threading to avoid slowdowns
OPENBLAS_NUM_THREADS : 1
OMP_NUM_THREADS : 1
MKL_DYNAMIC : FALSE
MKL_NUM_THREADS : 1
## Building Docker environments
## Only runs when docker specifications change
.build-env:
stage: build-env
when: manual
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
before_script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- git config --global --add safe.directory /builds/kwant/kwant
- git fetch --tags
build-env:ubuntu:
extends: .build-env
script:
- /kaniko/executor
--context $CI_PROJECT_DIR/docker
--dockerfile $CI_PROJECT_DIR/docker/Dockerfile.ubuntu
--destination $CI_REGISTRY_IMAGE/ubuntu
build-env:debian:
extends: .build-env
script:
- /kaniko/executor
--context $CI_PROJECT_DIR/docker
--dockerfile $CI_PROJECT_DIR/docker/Dockerfile.debian
--destination $CI_REGISTRY_IMAGE/debian
build-env:default:
extends: .build-env
script:
- /kaniko/executor
--context $CI_PROJECT_DIR/docker
--dockerfile $CI_PROJECT_DIR/docker/Dockerfile.conda
--destination $CI_REGISTRY_IMAGE
## Build environment specifications
.build:
stage: build
script:
- echo -e "[DEFAULT]\ndefine_macros = CYTHON_TRACE=1 NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION" >build.conf
- ./setup.py build
- ./setup.py build_ext -i
artifacts:
untracked: true
expire_in: 2 hour
.stable-env:
before_script:
- eval "$(micromamba shell hook --shell bash)"
- micromamba activate kwant-stable
- git config --global --add safe.directory /builds/kwant/kwant
- git fetch --tags
.no-extras-env:
before_script:
- eval "$(micromamba shell hook --shell bash)"
- micromamba activate kwant-stable-no-extras
- git config --global --add safe.directory /builds/kwant/kwant
- git fetch --tags
# Note that this is 'latest' as of when the image was last built
.latest-env:
before_script:
- eval "$(micromamba shell hook --shell bash)"
- micromamba activate kwant-latest
- git config --global --add safe.directory /builds/kwant/kwant
- git fetch --tags
.bleeding-edge-env:
before_script:
- eval "$(micromamba shell hook --shell bash)"
- micromamba activate kwant-latest
- micromamba update --all
- git config --global --add safe.directory /builds/kwant/kwant
- git fetch --tags
.ubuntu-env:
image: gitlab.kwant-project.org:5005/kwant/kwant/ubuntu
.debian-env:
image: gitlab.kwant-project.org:5005/kwant/kwant/debian
## Build Jobs
build:ubuntu:
extends:
- .build
- .ubuntu-env
build:debian:
extends:
- .build
- .debian-env
build:stable:
extends:
- .build
- .stable-env
build:no-extras:
extends:
- .build
- .no-extras-env
build:latest:
extends:
- .build
- .latest-env
build:bleeding-edge:
extends:
- .build
- .bleeding-edge-env
only:
- schedules
allow_failure: true
## Test Jobs
check whitespace style:
stage: test
script: ./check_whitespace
allow_failure: true
check for dependencies installed:
stage: test
script:
- if [ -d .eggs ]; then echo "$(ls -d .eggs/*/) downloaded by build, update build environment" >&2; fi
allow_failure: true
.test:
stage: test
script:
- py.test -r w --flakes kwant --junitxml=tests.xml --durations=10
artifacts:
reports:
junit: tests.xml
.coverage:
stage: test
script:
- py.test -r w --cov=kwant --cov-report term --cov-report html --flakes kwant --junitxml=tests.xml --durations=10
artifacts:
paths:
- htmlcov
reports:
junit: tests.xml
test:stable:
extends:
- .test
- .stable-env
dependencies:
- build:stable
test:no-extras:
extends:
- .test
- .no-extras-env
dependencies:
- build:no-extras
test:ubuntu:
extends:
- .test
- .ubuntu-env
dependencies:
- build:ubuntu
test:debian:
extends:
- .test
- .debian-env
dependencies:
- build:debian
test:latest:
extends:
- .test
- .latest-env
dependencies:
- build:latest
test:bleeding-edge:
extends:
- .test
- .bleeding-edge-env
dependencies:
- build:bleeding-edge
only:
- schedules
allow_failure: true
test:python-mumps:
extends:
- .test
- .latest-env
dependencies:
- build:latest
script:
- micromamba install -y -c conda-forge python-mumps
- py.test -r w --flakes kwant --junitxml=tests.xml --durations=10
coverage:latest:
extends:
- .coverage
- .latest-env
dependencies:
- build:latest
only:
- schedules
## Documentation building
build documentation:
extends: .latest-env
dependencies:
- build:latest
stage: test
script:
- pip install --editable . # Makefile executes from folders
- python -c 'from matplotlib import pyplot' # Pre-generate font cache
- pip install ipykernel # Temporary, should be removed after a jupyter-sphinx feedstock update.
- python -m ipykernel install --user --name kwant-latest # Register the kernel
- make -C doc clean; make -C doc html SPHINXOPTS='-A website_deploy=True -n -D jupyter_execute_default_kernel=kwant-latest' SOURCE_LINK_TEMPLATE="$CI_PROJECT_URL"/blob/\$\$r/\$\$f
artifacts:
paths:
- doc/build/html/
expire_in: 1 month
build PDF documentation:
extends: .latest-env
dependencies:
- build:latest
stage: test
script:
- pip install --editable . # Makefile executes from folders
- python -c 'from matplotlib import pyplot' # Pre-generate font cache
- pip install ipykernel # Temporary, should be removed after a jupyter-sphinx feedstock update.
- python -m ipykernel install --user --name kwant-latest # Register the kernel
- make -C doc latex SPHINXOPTS='-n -D jupyter_execute_default_kernel=kwant-latest'
- cd doc/build/latex
- make all-pdf
artifacts:
paths:
- doc/build/latex/kwant.pdf
expire_in: 1 month
check for broken links in doc:
extends: .latest-env
dependencies:
- build:latest
stage: test
script:
- pip install --editable . # Makefile executes from folders
- pip install ipykernel # Temporary, should be removed after a jupyter-sphinx feedstock update.
- python -m ipykernel install --user --name kwant-latest # Register the kernel
- make -C doc linkcheck SPHINXOPTS='-n -D jupyter_execute_default_kernel=kwant-latest'
allow_failure: true
## Upload coverage reports and dev documentation
upload coverage:
stage: deploy
only:
- schedules
dependencies:
- coverage:latest
environment:
name: coverage/$CI_COMMIT_REF_NAME
url: https://kwant-project.org/coverage/$CI_COMMIT_REF_SLUG
on_stop: remove_coverage
script:
- eval $(ssh-agent -s)
- echo $MASTER_WEBSITE_KEY | base64 -d | ssh-add -
- mv htmlcov $CI_COMMIT_REF_SLUG
- rsync -rlv -e "$SSH_COMMAND" --delete --relative $CI_COMMIT_REF_SLUG [email protected]:coverage/
remove_coverage:
stage: deploy
only:
- branches@kwant/kwant
when: manual
environment:
name: coverage/$CI_COMMIT_REF_NAME
action: stop
script:
- eval $(ssh-agent -s)
- echo $MASTER_WEBSITE_KEY | base64 -d | ssh-add -
- mkdir empty/
- rsync -rlv -e "$SSH_COMMAND" --delete empty/ [email protected]:coverage/$CI_COMMIT_REF_SLUG
upload documentation to the test server:
stage: deploy
environment:
name: docs review/$CI_COMMIT_REF_NAME
url: https://test.kwant-project.org/doc/$CI_COMMIT_REF_SLUG
on_stop: remove_docs
only:
- branches@kwant/kwant
script:
- eval $(ssh-agent -s)
- echo $TEST_WEBSITE_KEY | base64 -d | ssh-add -
- rsync -rlv -e "$SSH_COMMAND" --delete doc/build/html/* [email protected]:doc/$CI_COMMIT_REF_SLUG
remove_docs:
stage: deploy
when: manual
only:
- branches@kwant/kwant
environment:
name: docs review/$CI_COMMIT_REF_NAME
action: stop
script:
- eval $(ssh-agent -s)
- echo $TEST_WEBSITE_KEY | base64 -d | ssh-add -
- mkdir empty
- rsync -arv -e "$SSH_COMMAND" --delete empty/ [email protected]:doc/$CI_COMMIT_REF_SLUG/
upload dev version docs:
stage: deploy
environment:
name: production
url: https://kwant-project.org/doc/dev
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PROJECT_PATH == "kwant/kwant"
script:
- eval $(ssh-agent -s)
- echo $MASTER_WEBSITE_KEY | base64 -d | ssh-add -
- rsync -rlv -e "$SSH_COMMAND" --delete doc/build/html/* [email protected]:doc/dev
## Build documentation for tagged releases
.tagged-version:
only:
- /^v[0-9]+\.[0-9]+.[0-9]+$/@kwant/kwant
gather release artifacts:
extends: .tagged-version
stage: release
script:
- ./setup.py sdist
- mkdir docs
- mv doc/build/latex/kwant.pdf docs/kwant-doc-${CI_COMMIT_TAG//v}.pdf
- mv doc/build/html docs/html
- zip -r docs/kwant-doc-${CI_COMMIT_TAG//v}.zip docs/html
artifacts:
paths:
- docs
- dist