e86f75bd5713135d81161193914026a64049b9f1
[alexxy/gromacs.git] / admin / gitlab-ci / global.gitlab-ci.yml
1 # Mix-in job definitions.
2
3 # Centralized definitions of common job parameter values.
4
5 .variables:default:
6   variables:
7     KUBERNETES_CPU_LIMIT: 8
8     KUBERNETES_CPU_REQUEST: 4
9     KUBERNETES_MEMORY_LIMIT: 8Gi
10     KUBERNETES_EXTENDED_RESOURCE_NAME: ""
11     KUBERNETES_EXTENDED_RESOURCE_LIMIT: 0
12     CACHE_FALLBACK_KEY: "$CI_JOB_NAME-$CI_JOB_STAGE-master"
13     BUILD_DIR: build
14     INSTALL_DIR: install
15     CMAKE_GMXAPI_OPTIONS: "-DGMX_PYTHON_PACKAGE=ON"
16 # TODO: Get these from updated Docker images.
17
18 # Our generic before_script to install dependencies and prepare the ccache directory.
19 .before_script:default:
20   before_script:
21     - mkdir -p ccache
22     - export CCACHE_BASEDIR=${PWD}
23     - export CCACHE_DIR=${PWD}/ccache
24
25 # Jobs that run for new commits and pipelines triggered by schedules or
26 # through the web interface, unless GROMACS_RELEASE is set. Excluded from
27 # extra pipelines generated by merge request events.
28 # Includes non-gromacs projects. Note that jobs using this rule are
29 # eligible to run on non-gromacs project infrastructure, and should therefore
30 # override the default *tag* parameter to exclude tags specific to the GROMACS
31 # GitLab Runner infrastructure. I.e. in the job definition, set `tags: []`
32 .rules:basic-push:
33   rules:
34     - if: '$GROMACS_RELEASE'
35       when: never
36     - if: '$CI_PIPELINE_SOURCE == "web"'
37       when: always
38     - if: '$CI_PIPELINE_SOURCE == "push"'
39       when: always
40     - if: '$CI_PIPELINE_SOURCE == "schedule"'
41       when: always
42     - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
43       when: never
44
45 # Jobs that run for merge requests and schedules, but not when GROMACS_RELEASE
46 # is set. Excludes non-gromacs projects.
47 .rules:merge-requests:
48   rules:
49     - if: '$CI_PROJECT_NAMESPACE != "gromacs"'
50       when: never
51     - if: '$GROMACS_RELEASE'
52       when: never
53     - if: '$CI_PIPELINE_SOURCE == "web"'
54       when: always
55     - if: '$CI_PIPELINE_SOURCE == "push"'
56       when: never
57     - if: '$CI_PIPELINE_SOURCE == "schedule"'
58       when: always
59     - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
60       when: always
61
62 # Rule to run a job only in nightly release-preparation pipelines.
63 # Checks if the GROMACS_RELEASE variable was set (typically through the GitLab web interface).
64 # Excludes merge_requests and non-gromacs projects.
65 # TODO: Update to *rules* syntax.
66 .rules:nightly-only-for-release:
67   rules:
68     - if: '$CI_PROJECT_NAMESPACE != "gromacs"'
69       when: never
70     - if: '$GROMACS_RELEASE && $CI_PIPELINE_SOURCE == "web"'
71       when: always
72     - if: '$GROMACS_RELEASE && $CI_PIPELINE_SOURCE == "schedule"'
73       when: always
74
75 # Jobs that run on schedules, but not for merge requests or when GROMACS_RELEASE
76 # is set. Excludes non-gromacs projects.
77 .rules:nightly-not-for-release:
78   rules:
79     - if: '$CI_PROJECT_NAMESPACE != "gromacs"'
80       when: never
81     - if: '$GROMACS_RELEASE'
82       when: never
83     - if: '$CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "schedule"'
84       when: always
85
86 # Behavioral templates
87
88 # Use a persistent compiler cache to speed up rebuilds for a single job.
89 .use-ccache:
90   cache:
91     key: "$CI_JOB_NAME-$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
92     paths:
93       - ccache/
94
95 # Tool chains
96
97 .use-cuda:
98   variables:
99     CMAKE_PRECISION_OPTIONS: "-DGMX_DOUBLE=OFF"
100     CMAKE_GPU_OPTIONS: -DGMX_GPU=ON -DGMX_USE_CUDA=ON
101
102 .use-mpi:
103   variables:
104     CMAKE_MPI_OPTIONS: "-DGMX_MPI=ON"
105
106 .use-opencl:
107   variables:
108     CMAKE_PRECISION_OPTIONS: "-DGMX_DOUBLE=OFF"
109     CMAKE_GPU_OPTIONS: -DGMX_GPU=ON -DGMX_USE_OPENCL=ON
110
111 # Base definition for using gcc.
112 .use-gcc:base:
113   variables:
114     CMAKE_COMPILER_SCRIPT: -DCMAKE_C_COMPILER=gcc-$COMPILER_MAJOR_VERSION -DCMAKE_CXX_COMPILER=g++-$COMPILER_MAJOR_VERSION
115   before_script:
116     - mkdir -p ccache
117     - export CCACHE_BASEDIR=${PWD}
118     - export CCACHE_DIR=${PWD}/ccache
119
120 # Base definition for using clang.
121 .use-clang:base:
122   variables:
123     CMAKE_COMPILER_SCRIPT: -DCMAKE_C_COMPILER=clang-$COMPILER_MAJOR_VERSION -DCMAKE_CXX_COMPILER=clang++-$COMPILER_MAJOR_VERSION
124   before_script:
125     - mkdir -p ccache
126     - export CCACHE_BASEDIR=${PWD}
127     - export CCACHE_DIR=${PWD}/ccache
128     - export ASAN_SYMBOLIZER_PATH=/usr/local/bin/llvm-symbolizer
129