Use CMake to propagate versions and hashes to gitlab jobs
[alexxy/gromacs.git] / admin / gitlab-ci / gromacs.matrix.gitlab-ci.yml
index a7d92f10d7b985c7892e95c331711c8a444cd33a..b0f4affa31a23c3086f91777a5223f95dc0b1d1f 100644 (file)
     CMAKE_BUILD_TYPE_OPTIONS: "-DCMAKE_BUILD_TYPE=Debug"
     CMAKE_GPU_OPTIONS: "-DGMX_GPU=OFF"
   script:
-    - CMAKE=${CMAKE:-$(which cmake)}
-    - echo $CMAKE_COMPILER_SCRIPT
-    - echo $CMAKE_EXTRA_OPTIONS
-    - echo $CMAKE_SIMD_OPTIONS
-    - echo $CMAKE_GPU_OPTIONS
-    - echo $CMAKE_MPI_OPTIONS
-    - echo $CMAKE_PRECISION_OPTIONS
-    - echo $CMAKE_BUILD_TYPE_OPTIONS
-    - echo $CMAKE_GMXAPI_OPTIONS
-    - if [[ -d $BUILD_DIR ]] ; then
-      rm -rf $BUILD_DIR && mkdir $BUILD_DIR ;
-      else
-      echo "Preparing new build directory" ;
-      mkdir $BUILD_DIR ;
-      fi
-    - cd $BUILD_DIR
-    - $CMAKE ..
-      -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-      $CMAKE_COMPILER_SCRIPT
-      $CMAKE_EXTRA_OPTIONS
-      $CMAKE_SIMD_OPTIONS
-      $CMAKE_MPI_OPTIONS
-      $CMAKE_PRECISION_OPTIONS
-      $CMAKE_BUILD_TYPE_OPTIONS
-      $CMAKE_GPU_OPTIONS
-      $CMAKE_GMXAPI_OPTIONS
-      -DCMAKE_INSTALL_PREFIX=../$INSTALL_DIR -DGMX_COMPILER_WARNINGS=ON
-      2>&1 | tee cmakeLog.log
-    - awk '/CMake Warning/,/^--|^$/' cmakeLog.log | tee cmakeErrors.log
-    - if [ -s cmakeErrors.log  ] ; then echo "Found CMake warning while processing build"; cat cmakeErrors.log ; exit 1; fi
-    - cd ..
+    - bash -x admin/ci-scripts/gromacs-base-configure.sh
   artifacts:
     when: always
     paths:
@@ -77,8 +47,7 @@
     RELEASE_REGRESSIONTESTS: release-regressiontests-from-tarball
   script:
     - CMAKE=${CMAKE:-$(which cmake)}
-    - VERSION=`cat version.json |
-      python3 -c "import json,sys; print(json.load(sys.stdin)['version'])"`
+    - VERSION=`sed -n -e '/GMX_VERSION_STRING\b/ s/.*"\(.*\)")/\1/p' VersionInfo-partial.cmake.cmakein`
     - if [[ $GROMACS_RELEASE != "true" ]] ; then
       VERSION=$VERSION-dev ;
       fi
       mkdir $RELEASE_BUILD_DIR ;
       fi
     - cd $RELEASE_BUILD_DIR
-    - cmake ../$RELEASE_SOURCE/
+    - which $CMAKE
+    - $CMAKE --version
+    - $CMAKE ../$RELEASE_SOURCE/
       -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
       $CMAKE_COMPILER_SCRIPT
       $CMAKE_EXTRA_OPTIONS
 .gromacs:base:build:
   stage: build
   script:
-    - CMAKE=${CMAKE:-$(which cmake)}
-    - cd $BUILD_DIR
-    - $CMAKE --build . -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee buildLogFile.log
-    - $CMAKE --build . --target tests -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee testBuildLogFile.log
-    - awk '/warning/,/warning.*generated|^$/' buildLogFile.log testBuildLogFile.log
-      | grep -v "CMake" | tee buildErrors.log || true
-    - grep "cannot be built" buildLogFile.log testBuildLogFile.log | tee -a buildErrors.log || true
-    - $CMAKE --build . --target install 2>&1 | tee installBuildLogFile.log
-    - if [ -s buildErrors.log ] ; then echo "Found compiler warning during build"; cat buildErrors.log; exit 1; fi
-    - for file in `find . -mindepth 1 -name "*.o" ! -type l` ; do echo $file ; rm $file ; done 2>&1 > remove-build-objects.log
-    - cd ..
+    - bash -x admin/ci-scripts/gromacs-base-build.sh
   artifacts:
     when: always
     paths:
   script:
     - CMAKE=${CMAKE:-$(which cmake)}
     - cd $BUILD_DIR
+    - which $CMAKE
+    - $CMAKE --version
     - scan-build -o scan_html $CMAKE --build . -- -j8 2>&1 | tee buildLogFile.log
     - awk '/warning/,/warning.*generated|^$/' buildLogFile.log
       | grep -v "CMake" | tee buildErrors.log || true
   variables:
     CTEST_RUN_MODE: "ExperimentalTest"
   script:
-    - CMAKE=${CMAKE:-$(which cmake)}
-    - cd $BUILD_DIR
-    - export UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1:suppressions=$CI_PROJECT_DIR/admin/ubsan-suppressions.txt
-    # Needed to run MPI enabled code in the docker images, until we set up different users
-    - export OMPI_ALLOW_RUN_AS_ROOT=1
-    - export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
-    - export ASAN_OPTIONS="check_initialization_order=1:detect_invalid_pointer_pairs=1:strict_init_order=true:strict_string_checks=true:detect_stack_use_after_return=true"
-    # If $GMX_TEST_REQUIRED_NUMBER_OF_DEVICES is not set and we have GPUs, set it
-    - if [ -z $GMX_TEST_REQUIRED_NUMBER_OF_DEVICES ] && [ -n $KUBERNETES_EXTENDED_RESOURCE_NAME ] ; then
-      if grep -q '/gpu$' <<< "$KUBERNETES_EXTENDED_RESOURCE_NAME"; then
-      echo "export GMX_TEST_REQUIRED_NUMBER_OF_DEVICES=\"0\"";
-      export GMX_TEST_REQUIRED_NUMBER_OF_DEVICES=0;
-      fi
-      fi
-    - if grep -qF 'nvidia.com/gpu' <<< "$KUBERNETES_EXTENDED_RESOURCE_NAME"; then
-      nvidia-smi || true;
-      fi
-    - if grep -qF 'intel.com/gpu' <<< "$KUBERNETES_EXTENDED_RESOURCE_NAME"; then
-      sycl-ls || true;
-      fi
-    - ctest -D $CTEST_RUN_MODE --output-on-failure | tee ctestLog.log || true
-    - awk '/The following tests FAILED/,/^Errors while running CTest|^$/'
-      ctestLog.log | tee ctestErrors.log
-    - xsltproc $CI_PROJECT_DIR/scripts/CTest2JUnit.xsl Testing/`head -n 1 < Testing/TAG`/*.xml > JUnitTestResults.xml
-    - if [ -s ctestErrors.log ] ; then
-      echo "Error during running ctest";
-      exit 1;
-      fi
-    - cd ..
+    - bash -x admin/ci-scripts/gromacs-base-test.sh
   artifacts:
     reports:
       junit: $BUILD_DIR/JUnitTestResults.xml
     expire_in: 1 week
 
 include:
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.clang-8-cuda-10.1-release.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.clang-8-cuda-11.0-release.gitlab-ci.yml'
   - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.clang-8.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.clang-9-mpi.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.clang-9-release.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.clang-11-cuda-11.2.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.clang-13-mpi.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.clang-13-release.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.clang-12-cuda-11.4.1.gitlab-ci.yml'
   - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.clang-ASAN.gitlab-ci.yml'
   - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.clang-static-analyzer.gitlab-ci.yml'
   - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.clang-TSAN.gitlab-ci.yml'
   - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.clang-UBSAN.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.gcc-10.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.gcc-10-coverage.gitlab-ci.yml'  
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.gcc-7-cuda-10.2.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.gcc-8-cuda-11.0.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.gcc-8-cuda-11.0-release.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.gcc-9-release.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.gcc-11.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.gcc-11-coverage.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.gcc-7-cuda-11.0.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.gcc-7-cuda-11.0-mpi.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.gcc-11-cuda-11.4.1.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.gcc-11-cuda-11.4.1-release.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.gcc-11-release.gitlab-ci.yml'
   - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.hipsycl-dev.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.oneapi-2021.1.1-opencl.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.oneapi-2021.1.1-opencl-release.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.oneapi-2021.1.1-sycl.gitlab-ci.yml'
-  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.oneapi-2021.2.0-sycl-nightly.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.oneapi-2021.4.0-opencl.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.oneapi-2021.4.0-opencl-release.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.oneapi-2021.4.0-sycl.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/gromacs.matrix/gromacs.oneapi-2021.4.0-sycl-nightly.gitlab-ci.yml'