Activate the existing 20.04 CI containers
[alexxy/gromacs.git] / admin / gitlab-ci / gromacs.gitlab-ci.yml
1 # Test goal: Initial build with close-to-default settings that always needs to pass before follow-up CI stages run
2 # Test intents (should change rarely and conservatively):
3 #   OS: Ubuntu oldest supported
4 #   Compiler: Clang
5 #   Build type: Debug
6 #   CMake: oldest supported
7 #   GPU: no
8 #   SIMD: no
9 #   Scope: configure, build, unit tests
10 # Test implementation choices (free to change as needed):
11 #   OS: Ubuntu 20.04
12 #   Compiler: Clang 9
13 #   FFT: FFTW3
14 #   Parallelism nt/ntomp: 4/2
15
16 simple-build:
17   # Test scope: configure, build, unit tests
18   extends:
19     - .variables:default
20     - .use-ccache
21     - .use-clang:base
22     - .rules:basic-push
23   stage: pre-build
24   image: ${CI_REGISTRY}/gromacs/gromacs/ci-ubuntu-20.04-llvm-9
25   variables:
26     CMAKE: /usr/local/cmake-3.16.3/bin/cmake
27     KUBERNETES_CPU_LIMIT: 8
28     KUBERNETES_CPU_REQUEST: 4
29     KUBERNETES_MEMORY_REQUEST: 8Gi
30     CMAKE_SIMD_OPTIONS: "-DGMX_SIMD=None"
31     CMAKE_MPI_OPTIONS: "-DGMX_THREAD_MPI=ON"
32     CMAKE_PRECISION_OPTIONS: "-DGMX_DOUBLE=OFF"
33     CMAKE_BUILD_TYPE_OPTIONS: "-DCMAKE_BUILD_TYPE=Debug"
34     CMAKE_GPU_OPTIONS: "-DGMX_GPU=OFF"
35     CMAKE_GMXAPI_OPTIONS: "-DGMX_PYTHON_PACKAGE=OFF"
36     COMPILER_MAJOR_VERSION: 9
37     BUILD_DIR: simple-build
38   script:
39     - CMAKE=${CMAKE:-$(which cmake)}
40     - echo $CMAKE_COMPILER_SCRIPT
41     - echo $CMAKE_EXTRA_OPTIONS
42     - echo $CMAKE_SIMD_OPTIONS
43     - echo $CMAKE_GPU_OPTIONS
44     - echo $CMAKE_MPI_OPTIONS
45     - echo $CMAKE_PRECISION_OPTIONS
46     - echo $CMAKE_BUILD_TYPE_OPTIONS
47     - echo $CMAKE_GMXAPI_OPTIONS
48     - if [[ -d $BUILD_DIR ]] ; then
49       echo "Cleaning up build directory" ;
50       rm -rf $BUILD_DIR && mkdir $BUILD_DIR ;
51       else
52       echo "Preparing new build directory" ;
53       mkdir $BUILD_DIR ;
54       fi
55     - cd $BUILD_DIR
56     - $CMAKE ..
57       -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
58       $CMAKE_COMPILER_SCRIPT
59       $CMAKE_EXTRA_OPTIONS
60       $CMAKE_SIMD_OPTIONS
61       $CMAKE_MPI_OPTIONS
62       $CMAKE_PRECISION_OPTIONS
63       $CMAKE_BUILD_TYPE_OPTIONS
64       $CMAKE_GPU_OPTIONS
65       $CMAKE_GMXAPI_OPTIONS
66       -DCMAKE_INSTALL_PREFIX=../$INSTALL_DIR -DGMX_COMPILER_WARNINGS=ON
67       2>&1 | tee cmakeLog.log
68     - awk '/CMake Warning/,/^--|^$/' cmakeLog.log | tee cmakeErrors.log
69     - if [ -s cmakeErrors.log  ] ; then echo "Found CMake warning while processing build"; cat cmakeErrors.log ; exit 1; fi
70     - $CMAKE --build . -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee buildLogFile.log
71     - $CMAKE --build . --target tests -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee testBuildLogFile.log
72     - awk '/warning/,/warning.*generated|^$/' buildLogFile.log testBuildLogFile.log
73       | grep -v "CMake" | tee buildErrors.log || true
74     - grep "cannot be built" buildLogFile.log testBuildLogFile.log | tee -a buildErrors.log || true
75     - $CMAKE --build . --target install 2>&1 | tee installBuildLogFile.log
76     - if [ -s buildErrors.log ] ; then echo "Found compiler warning during build"; cat buildErrors.log; exit 1; fi
77     - ctest -D ExperimentalTest --output-on-failure | tee ctestLog.log || true
78     - awk '/The following tests FAILED/,/^Errors while running CTest|^$/'
79       ctestLog.log | tee ctestErrors.log
80     - xsltproc $CI_PROJECT_DIR/scripts/CTest2JUnit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > JUnitTestResults.xml
81     - if [ -s ctestErrors.log ] ; then
82       echo "Error during running ctest";
83       exit 1;
84       fi
85     - cd ..
86   artifacts:
87     reports:
88       junit: $BUILD_DIR/JUnitTestResults.xml
89     paths:
90       - $BUILD_DIR/*log
91     when: always
92     expire_in: 1 week