.gitlab-ci.yml 10.4 KB
Newer Older
1 2 3 4 5
# vim: tabstop=4 shiftwidth=4 softtabstop=4

before_script:
    - which g++
    - which cmake
6
    - which ninja
7 8 9 10 11 12 13 14

# Stages are useful only to enforce some ordering of the jobs. Every job is run
# in its own directory and only very few data can be shared between the jobs in
# different stages. It has to be zipped and uploaded to the server, so we can't
# do it with the build directory. Hence, we must build, test and install in the
# same job.
stages:
    - build
15
    - doc_build
16
    - deploy
17 18 19

# default flags for cmake
.default_cmake_flags_def: &default_cmake_flags
20
    # architectures
21
    WITH_OPENMP: "no"
22 23
    WITH_CUDA: "no"
    WITH_CUDA_ARCH: "auto"
24
    WITH_MPI: "no"
25 26
    # configurations
    WITH_TESTS: "no"
27
    WITH_COVERAGE: "no"
28
    WITH_DOC: "no"
29 30 31 32
    WITH_BENCHMARKS: "no"
    WITH_EXAMPLES: "no"
    WITH_TOOLS: "no"
    WITH_PYTHON: "no"
33 34 35 36 37

# template for build jobs
.build_template_def: &build_template
    stage: build
    script:
38
        # all cores including hyperthreading
39
#        - export NUM_CORES=$(grep "core id" /proc/cpuinfo | wc -l)
40
        # all pyhsical cores
41
        - export NUM_CORES=$(grep "core id" /proc/cpuinfo | sort -u | wc -l)
42 43 44 45
        # respect $NINJAFLAGS from the outer environment if it is set
        - if [[ ${NINJAFLAGS} == "" ]]; then
                export NINJAFLAGS="-j$NUM_CORES";
          fi
46
        - export CTEST_OUTPUT_ON_FAILURE=1
47
        - export CTEST_PARALLEL_LEVEL=4
48
        # enforce (more or less) warning-free builds
49
        - export CXXFLAGS="-Werror -Wno-error=deprecated -Wno-error=deprecated-declarations -Wno-error=uninitialized -Wno-error=vla"
50 51 52
        - mkdir -p "./builddir/$CI_JOB_NAME"
        - pushd "./builddir/$CI_JOB_NAME"
        - cmake ../..
53
                -G Ninja
54 55
                -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
                -DCMAKE_INSTALL_PREFIX=$(pwd)/${BUILD_TYPE}_install_prefix
56
                -DWITH_OPENMP=${WITH_OPENMP}
57
                -DWITH_MPI=${WITH_MPI}
58 59 60
                -DWITH_CUDA=${WITH_CUDA}
                -DWITH_CUDA_ARCH=${WITH_CUDA_ARCH}
                -DWITH_TESTS=${WITH_TESTS}
61
                -DWITH_DOC=${WITH_DOC}
62
                -DWITH_COVERAGE=${WITH_COVERAGE}
63
                -DWITH_BENCHMARKS=${WITH_BENCHMARKS}
64
                -DWITH_EXAMPLES=${WITH_EXAMPLES}
65 66
                -DWITH_TOOLS=${WITH_TOOLS}
                -DWITH_PYTHON=${WITH_PYTHON}
67 68
        # "install" implies the "all" target
        - ninja ${NINJAFLAGS} install
69 70 71
        - if [[ ${WITH_TESTS} == "yes" ]]; then
                ninja test;
          fi
72 73 74 75
        - popd
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
76 77 78
    only:
        changes:
            - src/**/*.{h,hpp,cpp,cu}
79
            - Documentation/Examples/**/*.{h,hpp,cpp,cu}
80 81
            - Documentation/Tutorials/**/*.{h,hpp,cpp,cu}
            - "**/CMakeLists.txt"
82
            - .gitlab-ci.yml
83 84 85 86 87 88

# Dummy build job to ensure that a pipeline is created for a merge request, even
# when there were no changes.
dummy build job:
    stage: build
    script: echo "dummy"
89 90
    only:
        - merge_requests
91 92 93
    except:
        changes:
            - src/**/*.{h,hpp,cpp,cu}
94
            - Documentation/Examples/**/*.{h,hpp,cpp,cu}
95 96
            - Documentation/Tutorials/**/*.{h,hpp,cpp,cu}
            - "**/CMakeLists.txt"
97
            - .gitlab-ci.yml
98

99 100
# Cuda builds are specified first because they take more time than host-only builds,
# which can be allocated on hosts whitout GPUs.
101 102
# Similarly, release builds are launched first to avoid the tail effect (they take
# significantly more time than debug builds).
103

104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
cuda_tests_Debug:
    <<: *build_template
    tags:
        - openmp
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_TESTS: "yes"

cuda_tests_Release:
    <<: *build_template
    tags:
        - openmp
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        BUILD_TYPE: Release
        WITH_TESTS: "yes"


cuda_examples_Debug:
    <<: *build_template
    tags:
        - openmp
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_EXAMPLES: "yes"
140 141 142 143
    # store output snippets for documentation
    artifacts:
        paths:
            - Documentation/output_snippets/
144 145

cuda_examples_Release:
146
    <<: *build_template
147
    tags:
148
        - openmp
149 150 151
        - gpu
    variables:
        <<: *default_cmake_flags
152
        WITH_OPENMP: "yes"
153
        WITH_CUDA: "yes"
154 155
        BUILD_TYPE: Release
        WITH_EXAMPLES: "yes"
156 157 158 159 160 161 162 163 164 165 166 167 168


cuda_benchmarks_tools_python_Debug:
    <<: *build_template
    tags:
        - openmp
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_BENCHMARKS: "yes"
169 170
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
171

172
cuda_benchmarks_tools_python_Release:
173
    <<: *build_template
174
    tags:
175
        - openmp
176
        - gpu
177 178
    variables:
        <<: *default_cmake_flags
179
        WITH_OPENMP: "yes"
180
        WITH_CUDA: "yes"
181
        BUILD_TYPE: Release
182 183 184 185
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"

186

187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
cuda_mpi_tests_Debug:
    <<: *build_template
    tags:
        - openmp
        - gpu
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Debug
        WITH_TESTS: "yes"

cuda_mpi_tests_Release:
202 203 204 205 206 207 208 209 210 211 212
    <<: *build_template
    tags:
        - openmp
        - gpu
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Release
213 214
        WITH_TESTS: "yes"

215

216
cuda_mpi_examples_Debug:
217 218
    <<: *build_template
    tags:
219
        - openmp
220
        - gpu
221
        - mpi
222 223
    variables:
        <<: *default_cmake_flags
224
        WITH_OPENMP: "yes"
225
        WITH_CUDA: "yes"
226
        WITH_MPI: "yes"
227
        BUILD_TYPE: Debug
228
        WITH_EXAMPLES: "yes"
229

230
cuda_mpi_examples_Release:
231 232
    <<: *build_template
    tags:
233
        - openmp
234
        - gpu
235
        - mpi
236 237
    variables:
        <<: *default_cmake_flags
238
        WITH_OPENMP: "yes"
239
        WITH_CUDA: "yes"
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
        WITH_MPI: "yes"
        BUILD_TYPE: Release
        WITH_EXAMPLES: "yes"


cuda_mpi_benchmarks_tools_python_Debug:
    <<: *build_template
    tags:
        - openmp
        - gpu
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        WITH_MPI: "yes"
256
        BUILD_TYPE: Debug
257 258 259
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
260

261
cuda_mpi_benchmarks_tools_python_Release:
262 263
    <<: *build_template
    tags:
264
        - openmp
265
        - gpu
266
        - mpi
267 268
    variables:
        <<: *default_cmake_flags
269
        WITH_OPENMP: "yes"
270
        WITH_CUDA: "yes"
271
        WITH_MPI: "yes"
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
        BUILD_TYPE: Release
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"





default_tests_Debug:
    <<: *build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
        WITH_TESTS: "yes"

default_tests_Release:
    <<: *build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_TESTS: "yes"

default_examples_Debug:
    <<: *build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
        WITH_EXAMPLES: "yes"

default_examples_Release:
    <<: *build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_EXAMPLES: "yes"

default_benchmarks_tools_python_Debug:
    <<: *build_template
    variables:
        <<: *default_cmake_flags
313
        BUILD_TYPE: Debug
314 315 316 317 318 319 320 321 322 323 324 325
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"

default_benchmarks_tools_python_Release:
    <<: *build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
326

327

328
mpi_tests_Debug:
329
    <<: *build_template
330 331 332 333 334 335 336 337 338
    tags:
        - openmp
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Debug
        WITH_TESTS: "yes"
339

340
mpi_tests_Release:
341
    <<: *build_template
342 343 344
    tags:
        - openmp
        - mpi
345 346
    variables:
        <<: *default_cmake_flags
347 348
        WITH_OPENMP: "yes"
        WITH_MPI: "yes"
349
        BUILD_TYPE: Release
350
        WITH_TESTS: "yes"
351

352
mpi_examples_Debug:
353 354 355 356 357 358 359 360 361
    <<: *build_template
    tags:
        - openmp
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Debug
362
        WITH_EXAMPLES: "yes"
363

364
mpi_examples_Release:
365 366 367 368 369 370 371 372 373
    <<: *build_template
    tags:
        - openmp
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Release
374
        WITH_EXAMPLES: "yes"
375

376
mpi_benchmarks_tools_python_Debug:
377 378 379
    <<: *build_template
    tags:
        - openmp
380
        - mpi
381 382 383
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
384
        WITH_MPI: "yes"
385
        BUILD_TYPE: Debug
386 387 388
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
389

390
mpi_benchmarks_tools_python_Release:
391 392 393
    <<: *build_template
    tags:
        - openmp
394
        - mpi
395 396 397
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
398
        WITH_MPI: "yes"
399
        BUILD_TYPE: Release
400 401 402
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
403 404


405 406 407


build documentation:
408
    stage: doc_build
409 410 411 412
    only:
        changes:
            - Documentation/**/*
            - src/TNL/**/*.{h,hpp}
413
            - .gitlab-ci.yml
414 415 416
    dependencies:
        # the job which builds Documentation/output_snippets/
        - cuda_examples_Debug
417 418 419 420 421 422 423 424
    script:
        - ./Documentation/build
    artifacts:
        paths:
            - ./Documentation/html/
    tags:
        - doxygen

425 426 427
deploy documentation:
    stage: deploy
    only:
428 429 430 431
        changes:
            - Documentation/**/*
            - src/TNL/**/*.{h,hpp}
            - .gitlab-ci.yml
432 433 434 435 436 437
        variables:
            - $TNL_DOC_DEPLOY_KEY
        refs:
            - develop
            - schedules
            - triggers
438 439
    dependencies:
        - build documentation
440 441 442 443
    script:
        - ./Documentation/deploy
    tags:
        - doxygen
444
        - deploy_key