Merge branch release-2020 into master
[alexxy/gromacs.git] / admin / ci-templates / .build-template.yml
1 .configure-build-template:
2   # Docker image uploaded to dockerhub by user eriklindahl
3   # TODO: Get DockerFile for admin/dockerfiles
4   stage: configure-build
5   image: biophysics/gcc-gromacs
6   variables:
7     KUBERNETES_CPU_LIMIT: 1
8     KUBERNETES_CPU_REQUEST: 1
9     KUBERNETES_MEMORY_LIMIT: 2Gi
10     CMAKE_COMPILER_SCRIPT: ""
11     CMAKE_EXTRA_OPTIONS: ""
12     CMAKE_SIMD_OPTIONS: "-DGMX_SIMD=AUTO"
13     CMAKE_MPI_OPTIONS: "-DGMX_THREAD_MPI=ON"
14     CMAKE_PRECISION_OPTIONS: "-DGMX_DOUBLE=OFF"
15     CMAKE_BUILD_TYPE_OPTIONS: "-DCMAKE_BUILD_TYPE=Debug"
16     CMAKE_GPU_OPTIONS: "-DGMX_GPU=OFF"
17     CMAKE_GMXAPI_OPTIONS: "-DGMX_PYTHON_PACKAGE=OFF"
18
19   script:
20     - echo $CMAKE_COMPILER_SCRIPT
21     - echo $CMAKE_EXTRA_OPTIONS
22     - echo $CMAKE_SIMD_OPTIONS
23     - echo $CMAKE_GPU_OPTIONS
24     - echo $CMAKE_MPI_OPTIONS
25     - echo $CMAKE_PRECISION_OPTIONS
26     - echo $CMAKE_BUILD_TYPE_OPTIONS
27     - echo $CMAKE_GMXAPI_OPTIONS
28     - if [[ -d $BUILD_DIR ]] ; then
29         rm -rf $BUILD_DIR && mkdir $BUILD_DIR ;
30       else
31         echo "Preparing new build directory" ;
32         mkdir $BUILD_DIR ;
33       fi
34     - cd $BUILD_DIR
35     - cmake ..
36         -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
37         $CMAKE_COMPILER_SCRIPT
38         $CMAKE_EXTRA_OPTIONS
39         $CMAKE_SIMD_OPTIONS
40         $CMAKE_MPI_OPTIONS
41         $CMAKE_PRECISION_OPTIONS
42         $CMAKE_BUILD_TYPE_OPTIONS
43         $CMAKE_GPU_OPTIONS
44         $CMAKE_GMXAPI_OPTIONS
45         -DCMAKE_INSTALL_PREFIX=../$INSTALL_DIR -DGMX_COMPILER_WARNINGS=ON
46         2>&1 | tee cmakeLog.log
47     - awk '/CMake Warning/,/^--|^$/' cmakeLog.log | tee cmakeErrors.log
48     - if [ -s cmakeErrors.log  ] ; then echo "Found CMake warning while processing build"; cat cmakeErrors.log ; exit 1; fi
49     - cd ..
50   artifacts:
51     when: always
52     paths:
53       - $BUILD_DIR
54
55 .configure-build-release-template:
56   # Dockerfiles are from dockerhub, user eriklindahl
57   # image in admin/dockerimages/ci-docs-py27
58   stage: release-configure
59   image: biophysics/gcc-gromacs
60   variables:
61     KUBERNETES_CPU_LIMIT: 1
62     KUBERNETES_CPU_REQUEST: 1
63     KUBERNETES_MEMORY_LIMIT: 2Gi
64     CMAKE_COMPILER_SCRIPT: ""
65     CMAKE_EXTRA_OPTIONS: ""
66     CMAKE_SIMD_OPTIONS: "-DGMX_SIMD=AUTO"
67     CMAKE_MPI_OPTIONS: "-DGMX_THREAD_MPI=ON"
68     CMAKE_PRECISION_OPTIONS: "-DGMX_DOUBLE=OFF"
69     CMAKE_BUILD_TYPE_OPTIONS: "-DCMAKE_BUILD_TYPE=RelWithAssert"
70     CMAKE_GPU_OPTIONS: "-DGMX_GPU=OFF"
71     CMAKE_GMXAPI_OPTIONS: "-DGMX_PYTHON_PACKAGE=OFF"
72     RELEASE_BUILD_DIR: release-builds
73     RELEASE_SOURCE: release-source-from-tarball
74     RELEASE_REGRESSIONTESTS: release-regressiontests-from-tarball
75
76   only:
77     refs:
78       - web
79       - schedules
80       - triggers
81     variables:
82       - $GROMACS_RELEASE
83   script:
84     - VERSION=`cat version.json |
85         python3 -c "import json,sys; print(json.load(sys.stdin)['version'])"`
86     - if [[ $GROMACS_RELEASE != "true" ]] ; then
87           VERSION=$VERSION-dev ;
88       fi
89     - SOURCENAME=gromacs-$VERSION
90     - SOURCETARBALL=$SOURCENAME.tar.gz
91     - REGTESTNAME=regressiontests-$VERSION
92     - REGTESTTARBALL=$REGTESTNAME.tar.gz
93     - echo "$SOURCETARBALL"
94     - echo "$REGTESTTARBALL"
95     - RELEASE_TARBALLS=release-tarballs
96     - rm -rf $RELEASE_TARBALLS $RELEASE_SOURCE $RELEASE_REGRESSIONTESTS && mkdir $RELEASE_TARBALLS
97     - mv $SOURCETARBALL $RELEASE_TARBALLS
98     - mv $REGTESTTARBALL $RELEASE_TARBALLS
99     - cd $RELEASE_TARBALLS
100 # We rename the source and regressiontest directories
101 # to have names for them that don't change for different versions.
102     - tar -xf $SOURCETARBALL
103     - mv $SOURCENAME ../$RELEASE_SOURCE
104     - tar -xf $REGTESTTARBALL
105     - mv $REGTESTNAME ../$RELEASE_REGRESSIONTESTS
106     - rm $SOURCETARBALL $REGTESTTARBALL
107     - cd ..
108     - echo $CMAKE_COMPILER_SCRIPT
109     - echo $CMAKE_EXTRA_OPTIONS
110     - echo $CMAKE_SIMD_OPTIONS
111     - echo $CMAKE_GPU_OPTIONS
112     - echo $CMAKE_MPI_OPTIONS
113     - echo $CMAKE_PRECISION_OPTIONS
114     - echo $CMAKE_BUILD_TYPE_OPTIONS
115     - echo $CMAKE_GMXAPI_OPTIONS
116     - if [[ -d $RELEASE_BUILD_DIR ]] ; then
117         echo "Cleaning up build directory" ;
118         rm -rf $RELEASE_BUILD_DIR && mkdir $RELEASE_BUILD_DIR ;
119       else
120         echo "Preparing new build directory" ;
121         mkdir $RELEASE_BUILD_DIR ;
122       fi
123     - cd $RELEASE_BUILD_DIR
124     - cmake ../$RELEASE_SOURCE/
125         -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
126         $CMAKE_COMPILER_SCRIPT
127         $CMAKE_EXTRA_OPTIONS
128         $CMAKE_SIMD_OPTIONS
129         $CMAKE_MPI_OPTIONS
130         $CMAKE_PRECISION_OPTIONS
131         $CMAKE_BUILD_TYPE_OPTIONS
132         $CMAKE_GPU_OPTIONS
133         $CMAKE_GMXAPI_OPTIONS
134         "-DREGRESSIONTEST_PATH=../$RELEASE_REGRESSIONTESTS"
135         -DCMAKE_INSTALL_PREFIX=../$INSTALL_DIR -DGMX_COMPILER_WARNINGS=ON
136         2>&1 | tee cmakeLog.log
137     - awk '/CMake Warning/,/^--|^$/' cmakeLog.log | tee cmakeErrors.log
138     - if [ -s cmakeErrors.log  ] ; then echo "Found CMake warning while processing build"; cat cmakeErrors.log ; exit 1; fi
139     - cd ..
140   artifacts:
141     when: always
142     paths:
143       - $RELEASE_BUILD_DIR
144       - $RELEASE_REGRESSIONTESTS
145       - $RELEASE_SOURCE
146
147 .binary-build-template:
148   # Dockerfiles are from dockerhub, user eriklindahl
149   # image in admin/dockerimages/ci-docs-py27
150   stage: build
151   image: biophysics/gcc-gromacs
152   variables:
153
154   script:
155     - cd $BUILD_DIR
156     - cmake --build . -- -j8 2>&1 | tee buildLogFile.log
157     - cmake --build . --target tests -- -j8 2>&1 | tee testBuildLogFile.log
158     - awk '/warning/,/warning.*generated|^$/' buildLogFile.log testBuildLogFile.log
159       | grep -v "CMake" | tee buildErrors.log || true
160     - grep "cannot be built" buildLogFile.log testBuildLogFile.log | tee -a buildErrors.log || true
161     - cmake --build . --target install 2>&1 | tee installBuildLogFile.log
162     - if [ -s buildErrors.log ] ; then echo "Found compiler warning during build"; cat buildErrors.log; exit 1; fi
163     - cd ..
164   artifacts:
165     when: always
166     paths:
167       - $BUILD_DIR
168       - $INSTALL_DIR/
169
170 # Right now we need to use an ugly hack to move the original build directory
171 # and the ccache files out of the build archive, as it is not possible to use
172 # the custom build directory due to https://gitlab.com/gitlab-org/gitlab-runner/issues/4203
173 # As soon as this is resolved we should use the separate build directories instead of
174 # manually hacking things. TODO
175 # Redmine #3361
176 .archive-build-template:
177   # Dockerfiles are from dockerhub, user eriklindahl
178   image: gromacs/continuous-integration:ci-docs
179   variables:
180   variables:
181     KUBERNETES_CPU_LIMIT: 4
182     KUBERNETES_CPU_REQUEST: 2
183     KUBERNETES_MEMORY_LIMIT: 4Gi
184   script:
185     - rm -rf gromacs*tar.gz
186     - cd $BUILD_DIR
187     - cmake --build . --target gmx -- -j4 2>&1 | tee buildLogFile.log
188     - cmake --build . --target man -- -j4 2>&1 | tee manBuildLogFile.log
189     - cmake --build . --target completion -- -j4 2>&1 | tee completionBuildLogFile.log
190     - cmake --build . --target install-guide -- -j4 2>&1 | tee installGuideBuildLogFile.log
191     - cmake --build . --target reference_checksum -- -j4 2>&1 | tee checksumBuildLogFile.log
192     - cmake --build . --target package_source -- -j4 2>&1 | tee packageBuildLogFile.log
193     - awk '/warning/,/warning.*generated|^$/' buildLogFile.log manBuildLogFile.log 
194       completionBuildLogFile.log installGuideBuildLogFile.log checksumBuildLogFile.log
195       packageBuildLogFile.log | grep -v "CMake" | tee buildErrors.log || true
196     - grep "cannot be built" buildLogFile.log manBuildLogFile.log 
197       completionBuildLogFile.log installGuideBuildLogFile.log checksumBuildLogFile.log
198       packageBuildLogFile.log | tee -a buildErrors.log || true 
199     - if [ -s buildErrors.log ] ; then echo "Found warnings during build"; cat buildErrors.log; exit 1; fi
200     - mv gromacs*tar.gz ..
201     - cd ..
202     # ugly hack begins here
203     - mkdir tempdir
204     - SOURCETARBALL=`ls gromacs*tar.gz`
205     - mv $SOURCETARBALL tempdir
206     - cd tempdir
207     - tar -xf $SOURCETARBALL
208     - rm -rf gromacs-*/$BUILD_DIR
209     - tar -c --gzip -f $SOURCETARBALL gromacs-*/
210     - mv $SOURCETARBALL ..
211     - cd ..
212     - rm -rf tempdir
213     # Hack ends here
214   artifacts:
215     when: always
216     expire_in: 1 week
217     paths:
218       - $BUILD_DIR/*log
219       - gromacs*tar.gz
220
221
222 .simple-build-template:
223   # Docker images are from dockerhub, user eriklindahl
224   stage: pre-build
225   image: biophysics/gcc-gromacs
226   variables:
227     KUBERNETES_CPU_LIMIT: 8
228     KUBERNETES_CPU_REQUEST: 4
229     KUBERNETES_MEMORY_LIMIT: 8Gi
230     CMAKE_COMPILER_SCRIPT: ""
231     CMAKE_EXTRA_OPTIONS: ""
232     CMAKE_SIMD_OPTIONS: "-DGMX_SIMD=None"
233     CMAKE_MPI_OPTIONS: "-DGMX_THREAD_MPI=ON"
234     CMAKE_PRECISION_OPTIONS: "-DGMX_DOUBLE=OFF"
235     CMAKE_BUILD_TYPE_OPTIONS: "-DCMAKE_BUILD_TYPE=Debug"
236     CMAKE_GPU_OPTIONS: "-DGMX_GPU=OFF"
237     CMAKE_GMXAPI_OPTIONS: "-DGMX_PYTHON_PACKAGE=OFF"
238
239   script:
240     - echo $CMAKE_COMPILER_SCRIPT
241     - echo $CMAKE_EXTRA_OPTIONS
242     - echo $CMAKE_SIMD_OPTIONS
243     - echo $CMAKE_GPU_OPTIONS
244     - echo $CMAKE_MPI_OPTIONS
245     - echo $CMAKE_PRECISION_OPTIONS
246     - echo $CMAKE_BUILD_TYPE_OPTIONS
247     - echo $CMAKE_GMXAPI_OPTIONS
248     - if [[ -d $BUILD_DIR ]] ; then
249         echo "Cleaning up build directory" ;
250         rm -rf $BUILD_DIR && mkdir $BUILD_DIR ;
251       else
252         echo "Preparing new build directory" ;
253         mkdir $BUILD_DIR ;
254       fi
255     - cd $BUILD_DIR
256     - cmake ..
257         -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
258         $CMAKE_COMPILER_SCRIPT
259         $CMAKE_EXTRA_OPTIONS
260         $CMAKE_SIMD_OPTIONS
261         $CMAKE_MPI_OPTIONS
262         $CMAKE_PRECISION_OPTIONS
263         $CMAKE_BUILD_TYPE_OPTIONS
264         $CMAKE_GPU_OPTIONS
265         $CMAKE_GMXAPI_OPTIONS
266         -DCMAKE_INSTALL_PREFIX=../$INSTALL_DIR -DGMX_COMPILER_WARNINGS=ON
267         2>&1 | tee cmakeLog.log
268     - awk '/CMake Warning/,/^--|^$/' cmakeLog.log | tee cmakeErrors.log
269     - if [ -s cmakeErrors.log  ] ; then echo "Found CMake warning while processing build"; cat cmakeErrors.log ; exit 1; fi
270     - cmake --build . -- -j8 2>&1 | tee buildLogFile.log
271     - cmake --build . --target tests -- -j8 2>&1 | tee testBuildLogFile.log
272     - awk '/warning/,/warning.*generated|^$/' buildLogFile.log testBuildLogFile.log
273       | grep -v "CMake" | tee buildErrors.log || true
274     - grep "cannot be built" buildLogFile.log testBuildLogFile.log | tee -a buildErrors.log || true
275     - cmake --build . --target install 2>&1 | tee installBuildLogFile.log
276     - if [ -s buildErrors.log ] ; then echo "Found compiler warning during build"; cat buildErrors.log; exit 1; fi
277     - ctest -D ExperimentalTest --output-on-failure | tee ctestLog.log || true
278     - awk '/The following tests FAILED/,/^Errors while running CTest|^$/'
279          ctestLog.log | tee ctestErrors.log
280     - xsltproc scripts/CTest2JUnit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > JUnitTestResults.xml
281     - if [ -s ctestErrors.log ] ; then
282         echo "Error during running ctest";
283         exit 1;
284       fi
285     - cd ..
286   artifacts:
287     reports:
288       junit: $BUILD_DIR/JUnitTestResults.xml
289     paths:
290         - $BUILD_DIR/*log
291     when: always
292     expire_in: 1 week