-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
303 lines (286 loc) · 8.28 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
303 lines (286 loc) · 8.28 KB
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
--- # ASE Gitlab CI configuration
variables:
OMP_NUM_THREADS: "1"
PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"
PYTEST_ADDOPTS: "--color=yes --durations=20 -r s"
stages:
- test
- paperwork
- deploy
# This will ensure that only pipelines in master get to update the cache,
# see https://docs.gitlab.com/ci/caching/
# conditional-policy:
# rules:
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# variables:
# POLICY: pull-push
# - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
# variables:
# POLICY: pull
# Check oldest supported Python with oldest supported libraries.
# Does not install any optional libraries except matplotlib.
oldlibs:
image: registry.gitlab.com/ase/ase:ase-oldlibs
before_script:
- pwd
- whoami
- >
pip install
numpy==1.19.5 scipy==1.6.0 matplotlib==3.3.4
pytest==7.0.0 attrs==20.3.0 pluggy==1.0.0 py==1.11.0 six==1.15.0
pytest-xdist==2.1.0 execnet==1.8.1 pytest-forked==1.4.0
- pip install --no-deps .
script:
- ase test
cache:
key: oldlibs
paths:
- $PIP_CACHE_DIR
# For testing newest versions of libraries against standard images
# on dockerhub.
pipinstall:
image: python:3.11
before_script:
- python --version
- pip install .[test]
script:
- ase test
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
before_script:
- python --version
- pip install --no-deps --editable .
- ase info --calculators
- cd $CI_PROJECT_DIR
script:
- >
ase test
--calculators asap,ff,lj,morse,tip3p,tip4p
--coverage --pytest
--junit-xml=report.xml
after_script:
- coverage xml --data-file ase/test/.coverage
- mv ase/test/coverage-html coverage-main
- mv ase/test/.coverage coverage-main/coverage.dat
artifacts:
paths:
- coverage-main/
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: ase/test/report.xml
expire_in: 1 week
cache:
key: main
paths:
- $PIP_CACHE_DIR
# 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
before_script:
- pip install --no-deps --editable .
- export ASE_CONFIG_PATH=/home/ase/aseconfig.ini
- sed 's/binary = /command = /' -i /home/ase/aseconfig.ini
script:
- >
ase test calculator --calculators=auto --coverage
--pytest -m calculator_lite
--junit-xml=report.xml
after_script:
- coverage xml --data-file ase/test/.coverage
- mv ase/test/coverage-html coverage-calculators-lite
- mv ase/test/.coverage coverage-calculators-lite/coverage.dat
artifacts:
paths:
- coverage-calculators-lite/
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: ase/test/report.xml
expire_in: 1 week
cache:
key: calculators
paths:
- $PIP_CACHE_DIR
# 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
before_script:
- pip install --no-deps --editable .
- export ASE_CONFIG_PATH=/home/ase/aseconfig.ini
- sed 's/binary = /command = /' -i /home/ase/aseconfig.ini
- ase info --calculators
script:
- >
ase test calculator --calculators abinit,asap,cp2k,dftb,espresso,gpaw,kim,lammpslib,lammpsrun,mopac,nwchem,octopus,siesta
--coverage --pytest --junit-xml=report.xml
after_script:
- coverage xml --data-file ase/test/.coverage
- mv ase/test/coverage-html coverage-calculators
- mv ase/test/.coverage coverage-calculators/coverage.dat
rules:
- if: $CI_PIPELINE_SOURCE == "push"
when: manual
allow_failure: true
- if: $CI_PIPELINE_SOURCE == "schedule"
artifacts:
paths:
- coverage-calculators/
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: ase/test/report.xml
expire_in: 1 week
cache:
key: calculators
policy: pull
paths:
- $PIP_CACHE_DIR
bleeding-edge:
image: python:3-alpine
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"
before_script:
- pip install --upgrade numpy scipy matplotlib
- pip install --editable .[test]
- pip freeze
script:
- ase test --pytest --ignore gui/ --ignore test_imports.py
cache:
paths:
- $PIP_CACHE_DIR
key: bleeding-edge
doc:
image: registry.gitlab.com/ase/ase:ase-main
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache-doc"
before_script:
- pip install scriv
- pip install --no-deps .[docs]
- ase info
- which sphinx-build
script:
- scriv collect --keep || echo Not compiling changelog then # Avoid error
- python -m ase.utils.sphinx run # test scripts
- sphinx-build -W doc doc/build
cache:
paths:
- $PIP_CACHE_DIR
key: doc
artifacts:
paths:
- $CI_PROJECT_DIR/doc/build/
expire_in: 1 week
distribution-package:
image: registry.gitlab.com/ase/ase:ase-main
before_script:
- mkdir dist
- pip install setuptools
script:
- 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
- pip uninstall --yes ase
- pip install dist/ase-*-py3-none-any.whl
- ase test
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
lint:
image: python:3.12.4-alpine
before_script:
- pip install .[lint]
- pip freeze
script:
- mypy --version
- mypy --color-output -p ase
- python -We:invalid -m compileall -f -q ase/
- ruff check
- ruff format --check
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"
cache:
paths:
- $PIP_CACHE_DIR
key: lint
coverage-combine:
image: registry.gitlab.com/ase/ase:ase-paperwork
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
.windows_test:
tags:
- saas-windows-medium-amd64
stage: test
before_script:
# https://stackoverflow.com/questions/61791108/gitlab-ci-shared-windows-runner-for-python
# https://gitlab.com/gitlab-org/ci-cd/shared-runners/images/gcp/windows-containers/-/issues/13
- Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
- choco install python --version=3.9 -y -f
- refreshenv
- python --version
- python -m pip install --upgrade pip
- python -m pip install pytest
- python -m pip install .
script:
- >
ase test
--calculators eam,ff,lj,morse,tip3p,tip4p
--pytest
-W "ignore:The --rsyncdir command line argument"
-W "ignore:NumPy will stop allowing conversion of out-of-bound Python integers"
rules:
- if: $CI_PIPELINE_SOURCE == "push"
when: manual
allow_failure: true
- if: $CI_PIPELINE_SOURCE == "schedule"