forked from Molcas/OpenMolcas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
460 lines (430 loc) · 12.4 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
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
# Prevent duplicate branch & MR pipelines
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_OPEN_MERGE_REQUESTS =~ /(^|,)Molcas\/OpenMolcas!\d+($|,)/'
when: never
- when: always
# Some useful templates:
# sources: list of files that require a rebuild
# compile-jobs: rules for when to run compile jobs
# test-jobs: rules for when to run test jobs
.template: &sources
changes:
- .gitlab-ci.yml
- .gitlab-ci_configs.yml
- .gitmodules
- basis_library/**/*
- CMakeLists.txt
- cmake/**/*
- data/**/*
- sbin/**/*
- src/**/*
- test/**/*
- Tools/**/*
.template: &compile-jobs
rules:
# merge requests
- if: '$CI_MERGE_REQUEST_IID'
when: on_success
# not on tags
- if: '$CI_COMMIT_TAG'
when: never
# not on master
- if: '$CI_PROJECT_PATH == "Molcas/OpenMolcas" && $CI_COMMIT_REF_NAME == "master"'
when: never
# api, trigger, web
- if: '$CI_PIPELINE_SOURCE == "api" || $CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "web"'
when: on_success
# manual request on push
- if: '$CI_PIPELINE_SOURCE == "push" && $TEST_JOBS == "true"'
when: on_success
# branches, if changes in the source
- if: '$CI_PIPELINE_SOURCE == "push"'
<<: *sources
when: on_success
.template: &test-jobs
rules:
# merge requests
- if: '$CI_MERGE_REQUEST_IID'
when: on_success
# not on master
- if: '$CI_PROJECT_PATH == "Molcas/OpenMolcas" && $CI_COMMIT_REF_NAME == "master"'
when: never
# api, trigger, web
- if: '$CI_PIPELINE_SOURCE == "api" || $CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "web"'
when: on_success
# manual request on push
- if: '$CI_PIPELINE_SOURCE == "push" && $TEST_JOBS == "true"'
when: on_success
# dev/external branch, if changes in the source
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == "dev/external"'
<<: *sources
when: on_success
# There can only be a single "include" per file
include:
# Configurations defined in an external file
- "/.gitlab-ci_configs.yml"
# Jobs for building the documentation
- "/doc/.gitlab-ci.yml"
# Define templates for "sub-jobs"
# - install-key: install the SSH key to access private repositories
# - compile: compile OpenMolcas with CMake
# - run-tests: run the verification suite
.template: &install-key
before_script:
# Install ssh-agent if not already installed
- >
which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in the ssh_key file (created by the runner)
- >
ssh-add /ssh_key || true
# Disable host key checking
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- >
[ -f /.dockerenv ] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config && chmod 644 ~/.ssh/config
.template: &compile
stage: build
interruptible: true
#<<: *install-key
script:
# special pre-script that may be needed in some installations
# (not using before_script because it would be overwritten)
- |
if [ -n "${pre_compile_script}" ] ; then
eval "${pre_compile_script}"
fi
# clone molcas-extra if specified and copy some files
# so they can be included in the artifacts
# (artifacts must be relative to the default directory)
- |
if [ -n "${extra}" ] ; then
git clone --depth 1 [email protected]:molcas-extra ${extra}
mkdir molcas-extra
cp -a ${extra}/sbin/molcas.driver ${extra}/test molcas-extra/
fi
# get submodules
- |
if [ -z "${submodules}" ] ; then export submodules="External/lapack" ; fi
for s in ${submodules} ; do
git submodule update --init ${s}
done
- mkdir build
- cd build
- >
cp /license.dat . || true
- |
if [ -z "${make}" ] ; then export make="make"; fi
# save the CMake configuration from a variable and add extra path
- |
echo "${cache_file}" > flags.cmake
if [ -n "${extra}" ] ; then
echo 'set (EXTRA "$ENV{extra}" CACHE PATH "location of molcas-extra")' >> flags.cmake
fi
if [ -n "${install_path}" ] ; then
echo 'set (CMAKE_INSTALL_PREFIX "$ENV{install_path}" CACHE PATH "Location where OpenMolcas will be installed")' >> flags.cmake
else
export install_path="/opt/OpenMolcas"
fi
echo 'set (INSTALL_TESTS "ON" CACHE PATH "Install the test files and verify script.")' >> flags.cmake
- cmake -C flags.cmake ..
- |
if [ -n "${pre_make_script}" ] ; then
eval "${pre_make_script}"
fi
- ${make} all
- ${make} test
- ${make} install
- cd ${install_path}
- ./pymolcas verify --keep 000
after_script:
- |
if [ -z "${install_path}" ] ; then export install_path="/opt/OpenMolcas"; fi
- mv ${install_path} install_dir
artifacts:
paths:
- install_dir
expire_in: 1 day
when: always
<<: *compile-jobs
.template: &run-tests
stage: test
interruptible: true
script:
# special pre-script that may be needed in some installations
# (not using before_script because it would be overwritten)
- |
if [ -n "${pre_run_script}" ] ; then
eval "${pre_run_script}"
fi
- |
if [ -z "${install_path}" ] ; then export install_path="/opt/OpenMolcas"; fi
- mv install_dir ${install_path}
- cd ${install_path}
- export TINKER=${CI_PROJECT_DIR}/build/tinker/bin
# default if no tests specified is .all
- |
if [ -z "${tests}" ] ; then export tests=".all" ; fi
# run only a subset of the tests if specified
- |
if [ -n "${CI_NODE_INDEX}" ] ; then
./pymolcas verify --flatlist ${tests} > filelist
if ( ! which python && which python3 ) ; then
sed -i -e 's/env python/env python3/' ${CI_PROJECT_DIR}/Tools/verify/split_tests.py
sed -i -e 's/env python/env python3/' ${CI_PROJECT_DIR}/Tools/verify/get_keywords.py
fi
${CI_PROJECT_DIR}/Tools/verify/split_tests.py filelist ${CI_NODE_TOTAL} ${CI_NODE_INDEX} > fl
./pymolcas verify --status --postproc "${CI_PROJECT_DIR}/Tools/verify/get_keywords.py \$project.out keylist" --fromfile fl
else
./pymolcas verify --status --postproc "${CI_PROJECT_DIR}/Tools/verify/get_keywords.py \$project.out keylist" ${tests}
fi
after_script:
- |
if [ -z "${install_path}" ] ; then export install_path="/opt/OpenMolcas"; fi
- |
cp -L ${install_path}/test/result result
cp -Lr ${install_path}/test/failed failed
cp -L ${install_path}/test/tmp/keylist keylist
artifacts:
paths:
- result
- failed/
- keylist
expire_in: 1 month
when: always
<<: *test-jobs
# A release job to be scheduled
create_release:
stage: deploy
image: registry.gitlab.com/gitlab-org/release-cli
needs:
# Note: the doc job defines and exports TAG
- job: doc
artifacts: true
script: |
echo "Creating release $TAG"
release:
tag_name: ${TAG}
description: "Automatic release from latest master"
ref: $CI_COMMIT_SHA
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule" && $CREATE_RELEASE'
when: on_success
# A special job for running checks on the code
checks:
stage: build
interruptible: true
script:
- |
if [ -n "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" ] ; then
git remote add upstream "${CI_MERGE_REQUEST_PROJECT_URL}"
git fetch upstream
TARGET_BRANCH="upstream/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}"
else
TARGET_BRANCH="origin/master"
fi
TARGET_SHA=$(git show-ref -s ${TARGET_BRANCH})
TMPDIR=$(mktemp -d)
for FILE in $(git diff-index --cached --name-only ${TARGET_SHA})
do
git checkout-index --prefix=${TMPDIR}/ ${FILE} 2> /dev/null
done
echo "diff between ${CI_COMMIT_SHA} and ${TARGET_SHA}"
- |
echo
echo "POSSIBLE HEADER ISSUES"
echo "----------------------"
sbin/copyright -r ${TMPDIR} || FAILED=1
- |
echo
echo "POSSIBLE STYLE ISSUES"
echo "---------------------"
export MOLCAS=${TMPDIR}
sbin/check_style || FAILED=1
- |
echo
echo "POSSIBLE TEST ISSUES"
echo "--------------------"
export MOLCAS=${TMPDIR}
sbin/check_tests || FAILED=1
- |
if [ "$FAILED" == "1" ] ; then
false
fi
<<: *compile-jobs
# A special job for compiling the tinker interface
# By adding "tinker" as a dependency, other jobs can use it
tinker:
stage: build
image: ${CI_REGISTRY}/molcas/dockerfiles/gcc-9:latest
interruptible: true
variables:
# A patch to the tinker patch to make it work in low memory conditions
patch_to_patch: |
diff -Nu -x '*~' -x '*.o' 6.3.3/source_orig/sizes.i 6.3.3/source/sizes.i
--- 6.3.3/source_orig/sizes.i 2015-04-14 13:58:10.122343730 +0200
+++ 6.3.3/source/sizes.i 2015-04-15 13:48:53.796041225 +0200
@@ -64,7 +64,7 @@
integer maxele,maxamino,maxnuc
integer maxbnd,maxang,maxtors
integer maxbitor
- parameter (maxatm=100000)
+ parameter (maxatm=1000)
parameter (maxval=8)
parameter (maxgrp=1000)
parameter (maxref=10)
before_script:
- >
if ( ! which patch ) ; then apt-get install -y --no-install-recommends patch ; fi
script:
# Use backup if the tinker website is down
- >
sed -i -e 's/wget.*/& || \\/' -e '/wget/a git clone --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/Molcas/Mirrors/Tinker.git ; mv Tinker/${TINKERVERSION}.tar.gz .' Tools/patch2tinker/get_tinker
# Try to work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92318
- >
sed -i -e 's/make all/make all || make all || make all || make all || make all || make all || make all || make all || make all || make all/' Tools/patch2tinker/get_tinker
# Apply the low-memory patch
- |
eval `grep TINKERVERSION= Tools/patch2tinker/get_tinker`
eval `grep PATCH= Tools/patch2tinker/get_tinker`
echo "${patch_to_patch}" >> Tools/patch2tinker/${PATCH}
- >
echo "y" | Tools/patch2tinker/get_tinker
after_script:
- |
mkdir build
cp -Lr tinker build
artifacts:
paths:
- build/
expire_in: 1 day
<<: *compile-jobs
# Define the actual jobs, each job has a "build" and a "test" stage,
# the latter depends on the former.
build:plain:
extends: .plain
<<: *compile
test:plain:
extends: .plain
<<: *run-tests
needs:
- build:plain
parallel: 2
build:options:
extends: .options
<<: *compile
test:options:
extends: .options
<<: *run-tests
needs:
- build:options
- tinker
parallel: 2
build:linalg:
extends: .linalg
<<: *compile
test:linalg:
extends: .linalg
<<: *run-tests
needs:
- build:linalg
- tinker
parallel: 2
build:pgi:
extends: .pgi
<<: *compile
test:pgi:
extends: .pgi
<<: *run-tests
needs:
- build:pgi
parallel: 2
#build:sun:
# extends: .sun
# <<: *compile
#test:sun:
# extends: .sun
# <<: *run-tests
# needs:
# - build:sun
# - tinker
# parallel: 2
build:intel:
extends: .intel
<<: *compile
test:intel:
extends: .intel
<<: *run-tests
needs:
- build:intel
parallel: 2
tags:
- docker
build:intel13:
extends: .intel13
<<: *compile
test:intel13:
extends: .intel13
<<: *run-tests
needs:
- build:intel13
parallel: 2
tags:
- docker
build:nag:
extends: .nag
<<: *compile
test:nag:
extends: .nag
<<: *run-tests
needs:
- build:nag
parallel: 6
tags:
- docker
build:garble:
extends: .garble
<<: *compile
test:garble:
extends: .garble
<<: *run-tests
needs:
- build:garble
- tinker
parallel: 6
build:bounds:
extends: .bounds
<<: *compile
test:bounds:
extends: .bounds
<<: *run-tests
needs:
- build:bounds
parallel: 4
build:debug:
extends: .debug
<<: *compile
#test:debug:
# extends: .debug
# <<: *run-tests
# needs:
# - build:debug
build:qcmaquis:
extends: .qcmaquis
<<: *compile
test:qcmaquis:
extends: .qcmaquis
<<: *run-tests
needs:
- build:qcmaquis
parallel: 2
build:mpi:
extends: .mpi
<<: *compile
test:mpi:
extends: .mpi
<<: *run-tests
needs:
- build:mpi
parallel: 8