7d2af7a1e644b2bf4e4eca717a7ad144fc9fb664
[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 12
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-12
25
26   variables:
27     CMAKE: /usr/local/cmake-3.16.3/bin/cmake
28     KUBERNETES_CPU_LIMIT: 8
29     KUBERNETES_CPU_REQUEST: 4
30     KUBERNETES_MEMORY_REQUEST: 8Gi
31     CMAKE_SIMD_OPTIONS: "-DGMX_SIMD=None"
32     CMAKE_MPI_OPTIONS: "-DGMX_THREAD_MPI=ON"
33     CMAKE_PRECISION_OPTIONS: "-DGMX_DOUBLE=OFF"
34     CMAKE_BUILD_TYPE_OPTIONS: "-DCMAKE_BUILD_TYPE=Debug"
35     CMAKE_GPU_OPTIONS: "-DGMX_GPU=OFF"
36     CMAKE_GMXAPI_OPTIONS: "-DGMX_PYTHON_PACKAGE=OFF"
37     COMPILER_MAJOR_VERSION: 12
38     BUILD_DIR: simple-build
39   script:
40     - CMAKE=${CMAKE:-$(which cmake)}
41     - echo $CMAKE_COMPILER_SCRIPT
42     - echo $CMAKE_EXTRA_OPTIONS
43     - echo $CMAKE_SIMD_OPTIONS
44     - echo $CMAKE_GPU_OPTIONS
45     - echo $CMAKE_MPI_OPTIONS
46     - echo $CMAKE_PRECISION_OPTIONS
47     - echo $CMAKE_BUILD_TYPE_OPTIONS
48     - echo $CMAKE_GMXAPI_OPTIONS
49     - if [[ -d $BUILD_DIR ]] ; then
50       echo "Cleaning up build directory" ;
51       rm -rf $BUILD_DIR && mkdir $BUILD_DIR ;
52       else
53       echo "Preparing new build directory" ;
54       mkdir $BUILD_DIR ;
55       fi
56     - cd $BUILD_DIR
57     - $CMAKE ..
58       -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
59       $CMAKE_COMPILER_SCRIPT
60       $CMAKE_EXTRA_OPTIONS
61       $CMAKE_SIMD_OPTIONS
62       $CMAKE_MPI_OPTIONS
63       $CMAKE_PRECISION_OPTIONS
64       $CMAKE_BUILD_TYPE_OPTIONS
65       $CMAKE_GPU_OPTIONS
66       $CMAKE_GMXAPI_OPTIONS
67       -DCMAKE_INSTALL_PREFIX=../$INSTALL_DIR -DGMX_COMPILER_WARNINGS=ON
68       2>&1 | tee cmakeLog.log
69     - awk '/CMake Warning/,/^--|^$/' cmakeLog.log | tee cmakeErrors.log
70     - if [ -s cmakeErrors.log  ] ; then echo "Found CMake warning while processing build"; cat cmakeErrors.log ; exit 1; fi
71     - $CMAKE --build . -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee buildLogFile.log
72     - $CMAKE --build . --target tests -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee testBuildLogFile.log
73     - awk '/warning/,/warning.*generated|^$/' buildLogFile.log testBuildLogFile.log
74       | grep -v "CMake" | tee buildErrors.log || true
75     - grep "cannot be built" buildLogFile.log testBuildLogFile.log | tee -a buildErrors.log || true
76     - $CMAKE --build . --target install 2>&1 | tee installBuildLogFile.log
77     - if [ -s buildErrors.log ] ; then echo "Found compiler warning during build"; cat buildErrors.log; exit 1; fi
78     - ctest -D ExperimentalTest --output-on-failure | tee ctestLog.log || true
79     - awk '/The following tests FAILED/,/^Errors while running CTest|^$/'
80       ctestLog.log | tee ctestErrors.log
81     - xsltproc $CI_PROJECT_DIR/scripts/CTest2JUnit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > JUnitTestResults.xml
82     - if [ -s ctestErrors.log ] ; then
83       echo "Error during running ctest";
84       exit 1;
85       fi
86     - cd ..
87   artifacts:
88     reports:
89       junit: $BUILD_DIR/JUnitTestResults.xml
90     paths:
91       - $BUILD_DIR/*log
92     when: always
93     expire_in: 1 week