Merge branch 'origin/release-2020' into master
[alexxy/gromacs.git] / admin / gitlab-ci / documentation.gitlab-ci.yml
1 # Build documentation and web page.
2
3 .docs:configure:
4   extends:
5     - .variables:default
6     - .gromacs:base:configure
7     - .before_script:default
8   # TODO (#3480) this should be organized more like the current documentation.py script
9   image: gromacs/ci-docs-llvm:master
10   stage: configure-build
11   cache: {}
12   variables:
13     KUBERNETES_CPU_LIMIT: 1
14     KUBERNETES_CPU_REQUEST: 1
15     KUBERNETES_MEMORY_LIMIT: 2Gi
16     CMAKE_COMPILER_SCRIPT: "-DCMAKE_C_COMPILER=clang-7 -DCMAKE_CXX_COMPILER=clang++-7"
17     CMAKE_EXTRA_OPTIONS: ""
18     CMAKE_SIMD_OPTIONS: "-DGMX_SIMD=None"
19     CMAKE_MPI_OPTIONS: "-DGMX_THREAD_MPI=OFF"
20     CMAKE_PRECISION_OPTIONS: "-DGMX_DOUBLE=OFF"
21     CMAKE_BUILD_TYPE_OPTIONS: "-DCMAKE_BUILD_TYPE=Debug"
22     CMAKE_GPU_OPTIONS: "-DGMX_GPU=OFF"
23     CMAKE_GMXAPI_OPTIONS: "-DGMX_PYTHON_PACKAGE=ON"
24   script:
25     - if [[ ! -z $GROMACS_RELEASE && $GROMACS_RELEASE == "true" ]] ; then
26       REL_OPTION="-DGMX_BUILD_TARBALL=ON" ;
27       else
28       REL_OPTION="-DGMX_BUILD_TARBALL=OFF" ;
29       fi
30     - echo $CMAKE_COMPILER_SCRIPT
31     - echo $CMAKE_EXTRA_OPTIONS
32     - echo $CMAKE_SIMD_OPTIONS
33     - echo $CMAKE_GPU_OPTIONS
34     - echo $CMAKE_MPI_OPTIONS
35     - echo $CMAKE_PRECISION_OPTIONS
36     - echo $CMAKE_BUILD_TYPE_OPTIONS
37     - echo $CMAKE_GMXAPI_OPTIONS
38     - echo $REL_OPTION
39     - if [[ -d $BUILD_DIR ]] ; then
40       rm -rf $BUILD_DIR && mkdir $BUILD_DIR ;
41       else
42       echo "Preparing new build directory" ;
43       mkdir $BUILD_DIR ;
44       fi
45     - cd $BUILD_DIR
46     - cmake ..
47       -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
48       $CMAKE_COMPILER_SCRIPT
49       $CMAKE_EXTRA_OPTIONS
50       $CMAKE_SIMD_OPTIONS
51       $CMAKE_MPI_OPTIONS
52       $CMAKE_PRECISION_OPTIONS
53       $CMAKE_BUILD_TYPE_OPTIONS
54       $CMAKE_GPU_OPTIONS
55       $CMAKE_GMXAPI_OPTIONS
56       $REL_OPTION
57       -DCMAKE_INSTALL_PREFIX=../$INSTALL_DIR -DGMX_COMPILER_WARNINGS=ON
58       2>&1 | tee cmakeLog.log
59     - awk '/CMake Warning/,/^--|^$/' cmakeLog.log | tee cmakeErrors.log
60     - if [ -s cmakeErrors.log  ] ; then echo "Found CMake warning while processing build"; cat cmakeErrors.log ; exit 1; fi
61     - cd ..
62   artifacts:
63     name: docs-artifacts-$CI_COMMIT_REF_SLUG
64     when: always
65     expire_in: 1 week
66     paths:
67       - $BUILD_DIR
68
69 .docs:configure:release:
70   extends:
71     - .variables:default
72     - .gromacs:base:configure
73     - .before_script:default
74     - .rules:nightly-only-for-release
75   # TODO (#3480) this should be organized more like the current documentation.py script
76   image: gromacs/ci-docs-llvm:master
77   stage: release-configure
78   cache: {}
79   variables:
80     KUBERNETES_CPU_LIMIT: 1
81     KUBERNETES_CPU_REQUEST: 1
82     KUBERNETES_MEMORY_LIMIT: 2Gi
83     CMAKE_COMPILER_SCRIPT: "-DCMAKE_C_COMPILER=clang-7 -DCMAKE_CXX_COMPILER=clang++-7"
84     CMAKE_EXTRA_OPTIONS: ""
85     CMAKE_SIMD_OPTIONS: "-DGMX_SIMD=None"
86     CMAKE_MPI_OPTIONS: "-DGMX_THREAD_MPI=ON"
87     CMAKE_PRECISION_OPTIONS: "-DGMX_DOUBLE=OFF"
88     CMAKE_BUILD_TYPE_OPTIONS: "-DCMAKE_BUILD_TYPE=Debug"
89     CMAKE_GPU_OPTIONS: "-DGMX_GPU=OFF"
90     CMAKE_GMXAPI_OPTIONS: "-DGMX_PYTHON_PACKAGE=ON"
91     RELEASE_BUILD_DIR: release-doc-builds
92     RELEASE_SOURCE: release-source-from-tarball
93     RELEASE_REGRESSIONTESTS: release-regressiontests-from-tarball
94   script:
95     - if [[ $GROMACS_RELEASE == "true" ]] ; then
96       REL_OPTION="-DGMX_BUILD_TARBALL=ON" ;
97       else
98       REL_OPTION="-DGMX_BUILD_TARBALL=OFF" ;
99       fi
100     - echo $CMAKE_COMPILER_SCRIPT
101     - echo $CMAKE_EXTRA_OPTIONS
102     - echo $CMAKE_SIMD_OPTIONS
103     - echo $CMAKE_GPU_OPTIONS
104     - echo $CMAKE_MPI_OPTIONS
105     - echo $CMAKE_PRECISION_OPTIONS
106     - echo $CMAKE_BUILD_TYPE_OPTIONS
107     - echo $CMAKE_GMXAPI_OPTIONS
108     - echo $REL_OPTION
109     - VERSION=`cat version.json |
110       python3 -c "import json,sys; print(json.load(sys.stdin)['version'])"`
111     - if [[ $GROMACS_RELEASE != "true" ]] ; then
112       VERSION=$VERSION-dev ;
113       fi
114     - REGTEST_COMPARE=`cat version.json |
115       python3 -c "import json,sys; print(json.load(sys.stdin)['regressiontest-md5sum'])"`
116     - SOURCENAME=gromacs-$VERSION
117     - SOURCETARBALL=$SOURCENAME.tar.gz
118     - REGTESTNAME=regressiontests-$VERSION
119     - REGTESTTARBALL=$REGTESTNAME.tar.gz
120     - SOURCE_MD5SUM=`md5sum $SOURCETARBALL | awk '{print $1}'`
121     - RELEASE_TARBALLS=release-tarballs
122     - rm -rf $RELEASE_TARBALLS $RELEASE_SOURCE $RELEASE_REGRESSIONTESTS && mkdir $RELEASE_TARBALLS
123     - mv $SOURCETARBALL $RELEASE_TARBALLS
124     - mv $REGTESTTARBALL $RELEASE_TARBALLS
125     - cd $RELEASE_TARBALLS
126     # We rename the source and regressiontest directories
127     # to have names for them that don't change for different versions.
128     - tar -xf $SOURCETARBALL
129     - mv $SOURCENAME ../$RELEASE_SOURCE
130     - tar -xf $REGTESTTARBALL
131     - mv $REGTESTNAME ../$RELEASE_REGRESSIONTESTS
132     - rm $SOURCETARBALL $REGTESTTARBALL
133     - cd ..
134     - echo $CMAKE_COMPILER_SCRIPT
135     - echo $CMAKE_EXTRA_OPTIONS
136     - echo $CMAKE_SIMD_OPTIONS
137     - echo $CMAKE_GPU_OPTIONS
138     - echo $CMAKE_MPI_OPTIONS
139     - echo $CMAKE_PRECISION_OPTIONS
140     - echo $CMAKE_BUILD_TYPE_OPTIONS
141     - echo $CMAKE_GMXAPI_OPTIONS
142     - if [[ -d $RELEASE_BUILD_DIR ]] ; then
143       echo "Cleaning up build directory" ;
144       rm -rf $RELEASE_BUILD_DIR && mkdir $RELEASE_BUILD_DIR ;
145       else
146       echo "Preparing new build directory" ;
147       mkdir $RELEASE_BUILD_DIR ;
148       fi
149     - cd $RELEASE_BUILD_DIR
150     - cmake ../$RELEASE_SOURCE/
151       -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
152       $CMAKE_COMPILER_SCRIPT
153       $CMAKE_EXTRA_OPTIONS
154       $CMAKE_SIMD_OPTIONS
155       $CMAKE_MPI_OPTIONS
156       $CMAKE_PRECISION_OPTIONS
157       $CMAKE_BUILD_TYPE_OPTIONS
158       $CMAKE_GPU_OPTIONS
159       $CMAKE_GMXAPI_OPTIONS
160       $REL_OPTION
161       "-DSOURCE_MD5SUM=$SOURCE_MD5SUM"
162       "-DREGRESSIONTEST_PATH=../$RELEASE_REGRESSIONTESTS"
163       -DCMAKE_INSTALL_PREFIX=../$INSTALL_DIR -DGMX_COMPILER_WARNINGS=ON
164       2>&1 | tee cmakeLog.log
165     - awk '/CMake Warning/,/^--|^$/' cmakeLog.log | tee cmakeErrors.log
166     - if [ -s cmakeErrors.log  ] ; then echo "Found CMake warning while processing build"; cat cmakeErrors.log ; exit 1; fi
167     - cd ..
168   artifacts:
169     name: docs-artifacts-$CI_COMMIT_REF_SLUG
170     when: always
171     expire_in: 1 week
172     paths:
173       - $RELEASE_BUILD_DIR
174       - $RELEASE_REGRESSIONTESTS
175       - $RELEASE_SOURCE
176
177 docs:configure:
178   extends:
179     - .docs:configure
180     - .rules:basic-push
181   tags: []
182   variables:
183     BUILD_DIR: build-docs
184     CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_BUILD_MANUAL=on
185
186 .docs:build:
187   # TODO (#3480) this should be organized more like the current documentation.py script
188   image: gromacs/ci-docs-llvm:master
189   script:
190     - cd $BUILD_DIR
191     - cmake --build . --target gmx -- -j8
192     - cd ..
193   artifacts:
194     name: docs-artifacts-$CI_COMMIT_REF_SLUG
195     when: always
196     expire_in: 1 week
197     paths:
198       - $BUILD_DIR
199
200 docs:build:
201   extends:
202     - .variables:default
203     - .gromacs:base:build
204     - .use-ccache
205     - .docs:build
206     - .before_script:default
207     - .rules:basic-push
208   stage: documentation
209   tags: []
210   needs:
211     - job: docs:configure
212   variables:
213     BUILD_DIR: build-docs
214
215 # The manual build is built separately so that errors in converting
216 # Sphinx to LaTeX and compiling can always be found in the
217 # all-output.txt file, while avoiding many thousands of lines of spam
218 # from pdflatex for normal builds. This does reduce the available
219 # parallel utilization, and so increases the build time.
220 #
221 # TODO why are the doxygen and sphinx log files disappearing
222 # TODO use a feature from gitlab runner instead of using pipefail to get timings for the job
223 .webpage:build:
224   extends:
225     - .variables:default
226     - .gromacs:base:build
227     - .before_script:default
228   # TODO (#3480) this should be organized more like the current documentation.py script
229   image: gromacs/ci-docs-llvm:master
230   cache: {}
231   variables:
232     KUBERNETES_CPU_LIMIT: 4
233     KUBERNETES_CPU_REQUEST: 2
234     KUBERNETES_MEMORY_LIMIT: 4Gi
235   script:
236     - cd $BUILD_DIR
237     - cmake --build . --target manual -- -j4 | tee docs/manual/all-output.log
238       | grep -i "warning" | grep -v "TeX" | grep -v "Package" || true
239     - cmake --build . --target webpage -- -j4
240     - grep "WARNING:" docs/manual/all-output.log | tee pythonErrors.log || true
241     - grep -i "error" docs/sphinx-*.log | tee sphinxDiagnostics.log || true
242     - grep -i "warning" docs/sphinx-*.log | tee -a sphinxDiagnostics.log || true
243     - if [ -s pythonErrors.log ] ; then echo "Found Python Errors during build"; exit 1; fi
244     - if [ -s sphinxErrors.log ] ; then echo "Found errors during Sphinx documentation build"; cat sphinxErrors.log; exit 1; fi
245     - if [ -s sphinxDiagnostics.log ] ; then echo "Found diagnostic warnings during Sphinx documentation build"; cat sphinxDiagnostics.log; exit 1; fi
246     - cd ..
247   artifacts:
248     name: docs-artifacts-$CI_COMMIT_REF_SLUG
249     when: always
250     expire_in: 1 week
251     paths:
252       - $BUILD_DIR/*.log
253       - $BUILD_DIR/docs/html
254       - $BUILD_DIR/docs/manual/gromacs.log
255       - $BUILD_DIR/docs/manual/all-output.log
256       - $BUILD_DIR/docs/doxygen/doxygen-user.log
257       - $BUILD_DIR/docs/doxygen/doxygen-lib.log
258       - $BUILD_DIR/docs/doxygen/doxygen-full.log
259       - $BUILD_DIR/docs/sphinx-html.log
260
261 webpage:build:
262   extends:
263     - .webpage:build
264     - .rules:basic-push
265   stage: post-test
266   tags: []
267   needs:
268     - job: docs:build
269     - job: check-source
270       artifacts: false
271   variables:
272     BUILD_DIR: build-docs
273
274 webpage:configure:
275   extends:
276     - .docs:configure:release
277     - .rules:nightly-only-for-release
278   cache: {}
279   dependencies:
280     - archive:package
281     - regressiontests:package
282     - prepare-release-version
283   variables:
284     CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_BUILD_MANUAL=on
285
286
287 webpage:dependencies:
288   extends:
289     - .gromacs:base:build
290     - .variables:default
291     - .use-ccache
292     - .docs:build
293     - .before_script:default
294     - .rules:nightly-only-for-release
295   stage: release-build
296   needs:
297     - job: webpage:configure
298   variables:
299     BUILD_DIR: release-doc-builds
300
301 webpage:build:release:
302   extends:
303     - .webpage:build
304     - .rules:nightly-only-for-release
305   dependencies:
306     - webpage:dependencies
307     - webpage:configure
308   stage: release-prepare-deploy
309   variables:
310     BUILD_DIR: release-doc-builds