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