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