Require pybind 2.6 from environment for gmxapi Python package extension module.
[alexxy/gromacs.git] / admin / gitlab-ci / documentation.gitlab-ci.yml
index d620ea5673c1d37af7fedc813d911c5d6a0e3319..cb717d2c0d97b5331a3d4eb6a3e8ff4ec28f6b91 100644 (file)
@@ -1,31 +1,25 @@
 # Build documentation and web page.
 
 .docs:configure:
-  # Built by admin/dockerfiles/ci-docs-clang
-  # TODO this should be organized more like the current documentation.py script
-  image: gromacs/ci-docs-clang:master
-  stage: configure-build
   extends:
-    - .gromacs:base:configure
     - .variables:default
+    - .gromacs:base:configure
     - .before_script:default
-  only:
-    refs:
-      - web
-      - pushes
-      - schedules
-      - merge_requests
+  # TODO (#3480) this should be organized more like the current documentation.py script
+  image: ${CI_REGISTRY}/gromacs/gromacs/ci-ubuntu-20.04-llvm-7-docs
+  stage: configure-build
+  cache: {}
   variables:
     KUBERNETES_CPU_LIMIT: 1
     KUBERNETES_CPU_REQUEST: 1
-    KUBERNETES_MEMORY_LIMIT: 2Gi
+    KUBERNETES_MEMORY_REQUEST: 2Gi
     CMAKE_COMPILER_SCRIPT: "-DCMAKE_C_COMPILER=clang-7 -DCMAKE_CXX_COMPILER=clang++-7"
-    CMAKE_EXTRA_OPTIONS: ""
     CMAKE_SIMD_OPTIONS: "-DGMX_SIMD=None"
     CMAKE_MPI_OPTIONS: "-DGMX_THREAD_MPI=OFF"
     CMAKE_PRECISION_OPTIONS: "-DGMX_DOUBLE=OFF"
     CMAKE_BUILD_TYPE_OPTIONS: "-DCMAKE_BUILD_TYPE=Debug"
     CMAKE_GPU_OPTIONS: "-DGMX_GPU=OFF"
+    CMAKE_GMXAPI_OPTIONS: "-DGMX_PYTHON_PACKAGE=ON"
   script:
     - if [[ ! -z $GROMACS_RELEASE && $GROMACS_RELEASE == "true" ]] ; then
       REL_OPTION="-DGMX_BUILD_TARBALL=ON" ;
       mkdir $BUILD_DIR ;
       fi
     - cd $BUILD_DIR
+    # Running CMake with the venv activated should not be strictly necessary,
+    # but helps to find and cache self-consistent Python and Sphinx details
+    # without additional hinting. Once CMakeCache.txt exists, the later stages
+    # should work fine without reactivating the venv.
+    - source /root/venv/py3.7/bin/activate
+    # TODO(#4092) Remove `pip install pybind11` once CI images are updated.
+    - /root/venv/py3.7/bin/pip install pybind11
     - cmake ..
       -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
       $CMAKE_COMPILER_SCRIPT
       - $BUILD_DIR
 
 .docs:configure:release:
-  # Built by admin/dockerfiles/ci-docs-clang
-  # TODO this should be organized more like the current documentation.py script
-  image: gromacs/ci-docs-clang:master
-  stage: release-configure
   extends:
-    - .gromacs:base:configure
     - .variables:default
+    - .gromacs:base:configure
     - .before_script:default
+    - .rules:nightly-only-for-release
+  # TODO (#3480) this should be organized more like the current documentation.py script
+  image: ${CI_REGISTRY}/gromacs/gromacs/ci-ubuntu-20.04-llvm-7-docs
+  stage: release-configure
   cache: {}
   variables:
     KUBERNETES_CPU_LIMIT: 1
     KUBERNETES_CPU_REQUEST: 1
-    KUBERNETES_MEMORY_LIMIT: 2Gi
+    KUBERNETES_MEMORY_REQUEST: 2Gi
     CMAKE_COMPILER_SCRIPT: "-DCMAKE_C_COMPILER=clang-7 -DCMAKE_CXX_COMPILER=clang++-7"
-    CMAKE_EXTRA_OPTIONS: ""
     CMAKE_SIMD_OPTIONS: "-DGMX_SIMD=None"
     CMAKE_MPI_OPTIONS: "-DGMX_THREAD_MPI=ON"
     CMAKE_PRECISION_OPTIONS: "-DGMX_DOUBLE=OFF"
     CMAKE_BUILD_TYPE_OPTIONS: "-DCMAKE_BUILD_TYPE=Debug"
     CMAKE_GPU_OPTIONS: "-DGMX_GPU=OFF"
+    CMAKE_GMXAPI_OPTIONS: "-DGMX_PYTHON_PACKAGE=ON"
     RELEASE_BUILD_DIR: release-doc-builds
     RELEASE_SOURCE: release-source-from-tarball
     RELEASE_REGRESSIONTESTS: release-regressiontests-from-tarball
-
-  only:
-    refs:
-      - web
-      - schedules
-      - triggers
-    variables:
-      - $GROMACS_RELEASE
   script:
     - if [[ $GROMACS_RELEASE == "true" ]] ; then
       REL_OPTION="-DGMX_BUILD_TARBALL=ON" ;
       mkdir $RELEASE_BUILD_DIR ;
       fi
     - cd $RELEASE_BUILD_DIR
+    - source /root/venv/py3.7/bin/activate
+    # TODO(#4092) Remove `pip install pybind11` once CI images are updated.
+    - /root/venv/py3.7/bin/pip install pybind11
     - cmake ../$RELEASE_SOURCE/
       -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
       $CMAKE_COMPILER_SCRIPT
 docs:configure:
   extends:
     - .docs:configure
-  needs:
-    - job: simple-build
-      artifacts: false
+    - .rules:basic-push
   variables:
     BUILD_DIR: build-docs
-    CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_BUILD_MANUAL=on
-  except:
-    variables:
-      - $GROMACS_RELEASE
+    CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_BUILD_MANUAL=on -DGMX_USE_SIMD_KERNELS=off
 
 .docs:build:
-  # Built by admin/dockerfiles/ci-docs-clang
-  # TODO this should be organized more like the current documentation.py script
-  image: gromacs/ci-docs-clang:master
-  only:
-    refs:
-      - web
-      - pushes
-      - schedules
-      - merge_requests
+  # TODO (#3480) this should be organized more like the current documentation.py script
+  image: ${CI_REGISTRY}/gromacs/gromacs/ci-ubuntu-20.04-llvm-7-docs
   script:
     - cd $BUILD_DIR
+    # TODO(#4092) Remove `pip install pybind11` once CI images are updated.
+    - /root/venv/py3.7/bin/pip install pybind11
     - cmake --build . --target gmx -- -j8
     - cd ..
   artifacts:
@@ -222,22 +208,17 @@ docs:configure:
 
 docs:build:
   extends:
-    - .gromacs:base:build
     - .variables:default
+    - .gromacs:base:build
     - .use-ccache
     - .docs:build
     - .before_script:default
+    - .rules:basic-push
   stage: documentation
   needs:
-    - job: simple-build
-      artifacts: false
     - job: docs:configure
-      artifacts: true
   variables:
     BUILD_DIR: build-docs
-  except:
-    variables:
-      - $GROMACS_RELEASE
 
 # The manual build is built separately so that errors in converting
 # Sphinx to LaTeX and compiling can always be found in the
@@ -249,26 +230,22 @@ docs:build:
 # TODO use a feature from gitlab runner instead of using pipefail to get timings for the job
 .webpage:build:
   extends:
-    - .gromacs:base:build
     - .variables:default
+    - .gromacs:base:build
     - .before_script:default
-  # Built by admin/dockerfiles/ci-docs-clang
-  # TODO this should be organized more like the current documentation.py script
-  image: gromacs/ci-docs-clang:master
-  only:
-    refs:
-      - web
-      - pushes
-      - schedules
-      - merge_requests
+  # TODO (#3480) this should be organized more like the current documentation.py script
+  image: ${CI_REGISTRY}/gromacs/gromacs/ci-ubuntu-20.04-llvm-7-docs
+  cache: {}
   variables:
     KUBERNETES_CPU_LIMIT: 4
     KUBERNETES_CPU_REQUEST: 2
-    KUBERNETES_MEMORY_LIMIT: 4Gi
+    KUBERNETES_MEMORY_REQUEST: 4Gi
   script:
     - cd $BUILD_DIR
     - cmake --build . --target manual -- -j4 | tee docs/manual/all-output.log
       | grep -i "warning" | grep -v "TeX" | grep -v "Package" || true
+    # TODO(#4092) Remove `pip install pybind11` once CI images are updated.
+    - /root/venv/py3.7/bin/pip install pybind11
     - cmake --build . --target webpage -- -j4
     - grep "WARNING:" docs/manual/all-output.log | tee pythonErrors.log || true
     - grep -i "error" docs/sphinx-*.log | tee sphinxDiagnostics.log || true
@@ -294,35 +271,28 @@ docs:build:
 webpage:build:
   extends:
     - .webpage:build
+    - .rules:basic-push
   stage: post-test
   needs:
     - job: docs:build
-      artifacts: true
     - job: check-source
       artifacts: false
   variables:
     BUILD_DIR: build-docs
-  except:
-    variables:
-      - $GROMACS_RELEASE
 
 webpage:configure:
   extends:
     - .docs:configure:release
+    - .rules:nightly-only-for-release
   cache: {}
-  only:
-    refs:
-      - web
-      - schedules
-      - triggers
-    variables:
-      - $GROMACS_RELEASE
+  tags:
+    - k8s-scilifelab
   dependencies:
     - archive:package
     - regressiontests:package
     - prepare-release-version
   variables:
-    CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_BUILD_MANUAL=on
+    CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_BUILD_MANUAL=on -DGMX_USE_SIMD_KERNELS=off
 
 
 webpage:dependencies:
@@ -332,33 +302,24 @@ webpage:dependencies:
     - .use-ccache
     - .docs:build
     - .before_script:default
+    - .rules:nightly-only-for-release
   stage: release-build
+  tags:
+    - k8s-scilifelab
   needs:
     - job: webpage:configure
-      artifacts: true
   variables:
     BUILD_DIR: release-doc-builds
-  only:
-    refs:
-      - triggers
-      - web
-      - schedules
-    variables:
-      - $GROMACS_RELEASE
 
 webpage:build:release:
   extends:
     - .webpage:build
+    - .rules:nightly-only-for-release
+  stage: release-prepare-deploy
+  tags:
+    - k8s-scilifelab
   dependencies:
     - webpage:dependencies
     - webpage:configure
-  stage: release-prepare-deploy
-  only:
-    refs:
-      - web
-      - schedules
-      - triggers
-    variables:
-      - $GROMACS_RELEASE
   variables:
     BUILD_DIR: release-doc-builds