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