forked from kwant-project/kwant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
217 lines (185 loc) · 5.37 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
image: kwant/testing
stages:
- build
- test
- deploy
- release
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
IGNORE_HOSTKEY: "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
build package:
stage: build
script:
- echo -e "[DEFAULT]\ndefine_macros = CYTHON_TRACE=1" >build.conf
- ./setup.py build
- ./setup.py build_ext -i
artifacts:
untracked: true
expire_in: 1 hour
check whitespace style:
stage: build
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
build documentation:
stage: test
script:
- pip3 install --upgrade matplotlib
- make -C doc realclean; make -C doc html SPHINXOPTS='-A website_deploy=True -n -W' SOURCE_LINK_TEMPLATE="$CI_PROJECT_URL"/blob/\$\$r/\$\$f
artifacts:
paths:
- doc/build/html/
expire_in: 1 month
build PDF documentation:
stage: test
script:
- pip3 install sympy
- pip3 install --upgrade matplotlib
- make -C doc latex SPHINXOPTS='-n -W'
- cd doc/build/latex
- make all-pdf
artifacts:
paths:
- doc/build/latex/kwant.pdf
expire_in: 1 month
run tests:
stage: test
script:
- py.test -r w --cov=kwant --cov-report term --cov-report html --flakes kwant --junitxml=tests.xml
artifacts:
paths:
- htmlcov
reports:
junit: tests.xml
check for broken links in doc:
stage: test
script:
- make -C doc linkcheck
allow_failure: true
.conda-template: &conda_job
stage: deploy
image: condaforge/linux-anvil
script:
- /usr/bin/sudo -n yum install -y devtoolset-2-gcc-gfortran
- git clone https://gitlab.kwant-project.org/kwant/conda-recipes.git
- conda config --add channels kwant
- conda build --python 3.5 conda-recipes/kwant-dev
- conda build --python 3.6 conda-recipes/kwant-dev
- mv /opt/conda/conda-bld/linux-64/kwant-dev*.tar.bz2 .
- if [ ! -z $ANACONDA_TOKEN ]; then anaconda --token=$ANACONDA_TOKEN upload --force kwant-dev*tar.bz2; fi
artifacts:
paths:
- kwant-dev*.tar.bz2
expire_in: 1 month
# build on master always
build and upload conda package:
<<: *conda_job
only:
- master@kwant/kwant
# manual triggers for branches other than master possible
build and upload conda package (manual):
<<: *conda_job
only:
- branches@kwant/kwant
except:
- master@kwant/kwant
when: manual
upload coverage:
stage: deploy
only:
- branches@kwant/kwant
environment:
name: coverage/$CI_BUILD_REF_NAME
url: https://kwant-project.org/coverage/$CI_BUILD_REF_SLUG
on_stop: remove_coverage
before_script:
- mkdir -p ~/.ssh
- echo $MASTER_WEBSITE_KEY | base64 -d > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
script:
- mv htmlcov $CI_BUILD_REF_SLUG
- rsync -rlv -e "$IGNORE_HOSTKEY" --delete --relative $CI_BUILD_REF_SLUG kwant@kwant-project.org:coverage/
after_script:
- rm -rf ~/.ssh
remove_coverage:
stage: deploy
only:
- branches@kwant/kwant
when: manual
environment:
name: coverage/$CI_BUILD_REF_NAME
action: stop
before_script:
- mkdir -p ~/.ssh
- echo $MASTER_WEBSITE_KEY | base64 -d > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
script:
- mkdir empty/
- rsync -rlv -e "$IGNORE_HOSTKEY" --delete empty/ kwant@kwant-project.org:coverage/$CI_BUILD_REF_SLUG
after_script:
- rm -rf ~/.ssh
upload documentation to the test server:
stage: deploy
environment:
name: docs review/$CI_BUILD_REF_NAME
url: https://test.kwant-project.org/doc/$CI_BUILD_REF_SLUG
on_stop: remove_docs
only:
- branches@kwant/kwant
before_script:
- mkdir -p ~/.ssh
- echo $TEST_WEBSITE_KEY | base64 -d > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
script:
- rsync -rlv -e "$IGNORE_HOSTKEY" --delete doc/build/html/* kwant@kwant-project.org:doc/$CI_BUILD_REF_SLUG
after_script:
- rm -rf ~/.ssh
remove_docs:
stage: deploy
when: manual
only:
- branches@kwant/kwant
environment:
name: docs review/$CI_BUILD_REF_NAME
action: stop
before_script:
- mkdir -p ~/.ssh
- echo $TEST_WEBSITE_KEY | base64 -d > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
script:
- mkdir empty
- rsync -arv -e "$IGNORE_HOSTKEY" --delete empty/ kwant@kwant-project.org:doc/$CI_BUILD_REF_SLUG/
after_script:
- rm -rf ~/.ssh
upload dev version docs:
stage: deploy
environment:
name: production
url: https://kwant-project.org/doc/dev
only:
- master@kwant/kwant
before_script:
- mkdir -p ~/.ssh
- echo $MASTER_WEBSITE_KEY | base64 -d > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
script:
- rsync -rlv -e "$IGNORE_HOSTKEY" --delete doc/build/html/* kwant@kwant-project.org:doc/dev
after_script:
- rm -rf ~/.ssh
# tagged version deploy
.tagged-version: &tagged_version
only:
- /^v[0-9]+\.[0-9]+.[0-9]+$/@kwant/kwant
gather release artifacts:
<<: *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