forked from hainm/ase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
200 lines (181 loc) · 6.02 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
--- # ASE Gitlab CI configuration
variables:
OMP_NUM_THREADS: "1"
stages:
- test
- paperwork
- deploy
.database-configuration:
variables:
POSTGRES_DB: testase
POSTGRES_USER: ase
POSTGRES_PASSWORD: "ase"
MYSQL_DATABASE: testase_mysql
MYSQL_ROOT_PASSWORD: ase
services:
- postgres:latest
- mysql:latest
- mariadb:latest
# Check oldest supported Python with oldest supported libraries.
# Does not install any optional libraries except matplotlib.
#
# With older python, pytest-xdist jumbles the tests differently
# on different codes, then complains. So we use -j 0.
oldlibs:
image: registry.gitlab.com/ase/ase:ase-oldlibs
extends: .database-configuration
script:
- pip install --no-deps .
- ase test --pytest --color=yes -W "ignore:can't resolve package"
# For testing newest versions of libraries against standard images
# on dockerhub.
#
# psycopg2-binary is for testing the postgres backend for ase.db
# Currently we have trouble with pyhon3.8 where we need to compile some
# libraries that don't have binary wheels; we don't want to install gcc
# in this test job.
pipinstall:
image: python:3.8
extends: .database-configuration
script:
- python --version
- pip install psycopg2-binary pymysql cryptography
- pip install pytest pytest-xdist mypy
- pip install .
- ase test --pytest --color=yes
- cd $CI_PROJECT_DIR
- python -We:invalid -m compileall -f -q ase/
when: manual
# This is the main test job using new versions of libraries.
# The intention is to enable as many features and libraries as possible.
#
# We execute it inside the project dir with --editable in order for
# the coverage script to correctly resolve the OMIT paths (a bit hacky).
# It would be better to install it for real, and for things to just work.
main:
image: registry.gitlab.com/ase/ase:ase-main
extends: .database-configuration
# Inheriting variables from the database-configuration job
# seems to be broken all of a sudden (gitlab-runner 13.0.1 and 13.3.1)
# We need to redefine them here then, otherwise gitlab-runner will fail
# those tests when run locally. Meanwhile everything works on gitlab.com.
# Strange!
variables:
POSTGRES_DB: testase
POSTGRES_USER: ase
POSTGRES_PASSWORD: "ase"
MYSQL_DATABASE: testase_mysql
MYSQL_ROOT_PASSWORD: ase
services:
- postgres:latest
- mysql:latest
- mariadb:latest
script:
- python --version
- pip install --no-deps --editable .
- ase info --calculators
- cd $CI_PROJECT_DIR
- ase test --calculators asap,eam,ff,lj,morse,tip3p,tip4p --coverage --pytest --color=yes --durations 20
- mypy --color-output -p ase
- python -We:invalid -m compileall -f -q ase/
- mv ase/test/coverage-html coverage-main
- mv ase/test/.coverage coverage-main/coverage.dat
artifacts:
paths:
- coverage-main/
expire_in: 1 week
# Calculator integration tests which always run.
# Encompasses those tests marked as @pytest.mark.calculator_lite.
# Please make sure these tests are cheap.
calculators-lite:
image: registry.gitlab.com/ase/ase:ase-full-monty
script:
- pip install --no-deps --editable .
- ase test calculator --calculators=auto --coverage --pytest -m calculator_lite --color=yes --durations=20
- mv ase/test/coverage-html coverage-calculators-lite
- mv ase/test/.coverage coverage-calculators-lite/coverage.dat
artifacts:
paths:
- coverage-calculators-lite/
expire_in: 1 week
# Plan: Test as many calculators as possible as well as possible.
# Obviously this is kind of expensive so the job is manually activated.
# Also, the docker serves as a knowledgebase for how to set up those
# calculators with ASE.
#
# It would be great if someone could enable more calculators with this.
calculators:
image: registry.gitlab.com/ase/ase:ase-full-monty
script:
- pip install --no-deps --editable .
- ase info --calculators
- ase test calculator --calculators abinit,asap,cp2k,dftb,espresso,gpaw,lammpsrun,nwchem,octopus,siesta --coverage --pytest --color=yes --durations 20
- mv ase/test/coverage-html coverage-calculators
- mv ase/test/.coverage coverage-calculators/coverage.dat
when: manual
artifacts:
paths:
- coverage-calculators/
expire_in: 1 week
doc:
image: registry.gitlab.com/ase/ase:ase-main
script:
- pip install --no-deps .[docs]
- ase info
- which sphinx-build
- cd $CI_PROJECT_DIR/doc
- python -m ase.utils.sphinx run # test scripts
- sphinx-build -W . build
distribution-package:
image: registry.gitlab.com/ase/ase:ase-main
extends: .database-configuration
script:
- apt-get install -y gettext # For compiling ase gui translations
- mkdir dist
- python setup.py sdist | tee dist/setup_sdist.log
- python setup.py bdist_wheel | tee dist/setup_bdist_wheel.log
- pip install dist/ase-*.tar.gz
- ase test --pytest --color=yes
- pip uninstall --yes ase
- pip install dist/ase-*-py3-none-any.whl
- ase test --pytest --color=yes
artifacts:
paths:
- dist
expire_in: 1 week
when: manual
# Publish code coverage data on web.
# * The deploy stage is specially recognized by gitlab
# * The jobname pages is specially recognized by gitlab
# * The public/ directory is specially recognized by gitlab
# https://about.gitlab.com/blog/2016/11/03/publish-code-coverage-report-with-gitlab-pages/
pages:
stage: deploy
dependencies:
- coverage-combine
script:
- mv coverage-html public
artifacts:
paths:
- public
expire_in: 2 weeks
only:
- master
coverage-combine:
image: registry.gitlab.com/ase/ase:ase-main
stage: paperwork
dependencies:
- main
- calculators-lite
script:
- cd ase/test # Next to .coveragerc and friends
- coverage combine ../../coverage-main/coverage.dat ../../coverage-calculators-lite/coverage.dat
- coverage report
- coverage html
- cd ../..
- mv ase/test/coverage-html .
coverage: '/TOTAL.+ ([0-9]+\.[0-9]+%)/'
artifacts:
paths:
- coverage-html
expire_in: 1 week