Browse code

enable coverage reports on scheduled builds only

Joseph Weston authored on 06/05/2019 10:10:38
Showing 1 changed files
... ...
@@ -173,6 +173,16 @@ check for dependencies installed:
173 173
     reports:
174 174
       junit: tests.xml
175 175
 
176
+.coverage: &coverage
177
+  stage: test
178
+  script:
179
+    - py.test -r w --cov=kwant --cov-report term --cov-report html --flakes kwant --junitxml=tests.xml --durations=10
180
+  artifacts:
181
+    paths:
182
+      - htmlcov
183
+    reports:
184
+      junit: tests.xml
185
+
176 186
 
177 187
 test:stable:
178 188
   <<: *test
... ...
@@ -213,6 +223,14 @@ test:bleeding-edge:
213 223
     - schedules
214 224
   allow_failure: true
215 225
 
226
+coverage:latest
227
+  << *coverage
228
+  << *latest_env
229
+  dependencies:
230
+    - build:latest
231
+  only:
232
+    - schedules
233
+
216 234
 ## Documentation building
217 235
 
218 236
 build documentation:
... ...
@@ -251,7 +269,44 @@ check for broken links in doc:
251 269
   allow_failure: true
252 270
 
253 271
 
254
-## Upload dev documentation
272
+## Upload coverage reports and dev documentation
273
+
274
+upload coverage:
275
+  stage: deploy
276
+  only:
277
+    - schedules
278
+  dependencies:
279
+    - coverage:latest
280
+  environment:
281
+    name: coverage/$CI_BUILD_REF_NAME
282
+    url: https://kwant-project.org/coverage/$CI_BUILD_REF_SLUG
283
+    on_stop: remove_coverage
284
+  before_script:
285
+    - mkdir -p ~/.ssh
286
+    - echo $MASTER_WEBSITE_KEY | base64 -d > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
287
+  script:
288
+    - mv htmlcov $CI_BUILD_REF_SLUG
289
+    - rsync -rlv -e "$IGNORE_HOSTKEY" --delete --relative $CI_BUILD_REF_SLUG kwant@kwant-project.org:coverage/
290
+  after_script:
291
+    - rm -rf ~/.ssh
292
+
293
+
294
+remove_coverage:
295
+  stage: deploy
296
+  only:
297
+    - branches@kwant/kwant
298
+  when: manual
299
+  environment:
300
+    name: coverage/$CI_BUILD_REF_NAME
301
+    action: stop
302
+  before_script:
303
+    - mkdir -p ~/.ssh
304
+    - echo $MASTER_WEBSITE_KEY | base64 -d > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
305
+  script:
306
+    - mkdir empty/
307
+    - rsync -rlv -e "$IGNORE_HOSTKEY" --delete empty/ kwant@kwant-project.org:coverage/$CI_BUILD_REF_SLUG
308
+  after_script:
309
+    - rm -rf ~/.ssh
255 310
 
256 311
 
257 312
 upload documentation to the test server: