-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
125 lines (117 loc) · 3.1 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
variables:
GIT_STRATEGY: clone
stages:
- build
- test
- deploy
.virtenv: &virtualenv
- source /work/f_jwsb/software/miniconda-3.11/etc/profile.d/conda.sh
- conda activate
# To make things faster, re-use existing site packages.
- python -m venv virtualenv --system-site-packages
- source virtualenv/bin/activate
# Python's venv comes with an older version of pip, so update it.
- pip install --upgrade pip
# Check python version
- which python
- which pytest
# Check MPI
- which mpiexec
# Check location
- pwd
pip-installation:
# This stage only tests if the installation is possible.
# The evironment created herein will be discared and re-created in the test stage.
stage: build
tags:
- lk
script:
- *virtualenv
- pip install -e .
# Check result of installation
- python -c "import loadskernel"
- which loads-kernel
- which model-viewer
- which loads-compare
Jupyter:
stage: build
tags:
- lk
script:
- *virtualenv
# Assemble the tutorials to a jupyter book and build htlm pages
- jupyter-book build ./doc/tutorials
artifacts:
when: always
paths:
- ./doc/tutorials
Flake8:
stage: test
tags:
- lk
script:
- *virtualenv
- pip install flake8
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Lint with flake8
- flake8 . --count --statistics
Pylint:
stage: test
tags:
- lk
script:
- *virtualenv
- pip install pylint
# Install the package itself to make sure that all imports work.
- pip install .[extras]
# Analyse the code with pylint
- pylint $(git ls-files '*.py') --fail-under=7.0
Pytest:
stage: test
timeout: 3 hours
coverage: '/^TOTAL.+?(\d+\%)$/'
tags:
- lk
script:
# Set-up the environement
- *virtualenv
# Install with -e (in editable mode) to allow the tracking of the test coverage
- pip install -e .[test]
- pip list
# Get the examples repository
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.dlr.de/loads-kernel/loads-kernel-examples.git
# Run the actual testing of the code with pytest
# Using python -m pytest is necessary because pytest has the habit of not looking in the site-packages of the venv
- python -m pytest -v --basetemp=./tmp --cov=loadskernel --cov=modelviewer --cov=loadscompare --junitxml=testresult.xml
# Create some reports
- coverage report
- coverage xml -o coverage.xml
- coverage html --directory ./coverage
artifacts:
when: always
paths:
- coverage.xml
- testresult.xml
- coverage
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: testresult.xml
deploy-pages:
stage: deploy
tags:
- lk
dependencies:
- Jupyter
- Pytest
script:
- mkdir public
# Publish the coverage htlm results
- mv coverage ./public/coverage
# Publish the htlm tutorials
- mv ./doc/tutorials/_build/html ./public/tutorials
artifacts:
paths:
- public