71dee72decd343eb5f6b7ace034baed9e657fc30
[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     - which $CMAKE
58     - $CMAKE --version
59     - $CMAKE ..
60       -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
61       $CMAKE_COMPILER_SCRIPT
62       $CMAKE_EXTRA_OPTIONS
63       $CMAKE_SIMD_OPTIONS
64       $CMAKE_MPI_OPTIONS
65       $CMAKE_PRECISION_OPTIONS
66       $CMAKE_BUILD_TYPE_OPTIONS
67       $CMAKE_GPU_OPTIONS
68       $CMAKE_GMXAPI_OPTIONS
69       -DCMAKE_INSTALL_PREFIX=../$INSTALL_DIR -DGMX_COMPILER_WARNINGS=ON
70       2>&1 | tee cmakeLog.log
71     - awk '/CMake Warning/,/^--|^$/' cmakeLog.log | tee cmakeErrors.log
72     - if [ -s cmakeErrors.log  ] ; then echo "Found CMake warning while processing build"; cat cmakeErrors.log ; exit 1; fi
73     - $CMAKE --build . -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee buildLogFile.log
74     - $CMAKE --build . --target tests -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee testBuildLogFile.log
75     - awk '/warning/,/warning.*generated|^$/' buildLogFile.log testBuildLogFile.log
76       | grep -v "CMake" | tee buildErrors.log || true
77     - grep "cannot be built" buildLogFile.log testBuildLogFile.log | tee -a buildErrors.log || true
78     - $CMAKE --build . --target install 2>&1 | tee installBuildLogFile.log
79     - if [ -s buildErrors.log ] ; then echo "Found compiler warning during build"; cat buildErrors.log; exit 1; fi
80     - ctest -D ExperimentalTest --output-on-failure | tee ctestLog.log || true
81     - awk '/The following tests FAILED/,/^Errors while running CTest|^$/'
82       ctestLog.log | tee ctestErrors.log
83     - xsltproc $CI_PROJECT_DIR/scripts/CTest2JUnit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > JUnitTestResults.xml
84     - if [ -s ctestErrors.log ] ; then
85       echo "Error during running ctest";
86       exit 1;
87       fi
88     - cd ..
89   artifacts:
90     reports:
91       junit: $BUILD_DIR/JUnitTestResults.xml
92     paths:
93       - $BUILD_DIR/*log
94     when: always
95     expire_in: 1 week