summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: 438510c959361982fa76c80994df2ce7cc83206d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
.manual_rules_settings: &manual_rules_settings
    - if: '$CI_PROJECT_PATH == "cmake/cmake"'
      when: delayed
      start_in: 5 minutes
    - if: '$CI_MERGE_REQUEST_ID'
      when: manual
    - when: never

.rules_settings: &rules_settings
    - if: '$CI_PROJECT_PATH == "cmake/cmake"'
      when: always
    - if: '$CI_MERGE_REQUEST_ID'
      when: always
    - when: never

.release_linux: &release_linux
    image: "kitware/cmake:build-linux-x86_64-deps-2020-04-02@sha256:77e9ab183f34680990db9da5945473e288f0d6556bce79ecc1589670d656e157"

    variables:
        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
        LAUNCHER: "scl enable devtoolset-6 rh-python36 --"

.fedora31: &fedora31
    image: "kitware/cmake:ci-fedora31-x86_64-2020-06-01"

    variables:
        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"

.debian10: &debian10
    image: "kitware/cmake:ci-debian10-x86_64-2020-04-27"

    variables:
        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"

.debian10_iwyu: &debian10_iwyu
    extends: .debian10

    variables:
        CMAKE_CONFIGURATION: debian10_iwyu
        CTEST_NO_WARNINGS_ALLOWED: 1
        CMake_SKIP_INSTALL: 1

.fedora31_tidy: &fedora31_tidy
    extends: .fedora31

    variables:
        CMAKE_CONFIGURATION: fedora31_tidy
        CTEST_NO_WARNINGS_ALLOWED: 1
        CMake_SKIP_INSTALL: 1

.fedora31_sphinx: &fedora31_sphinx
    extends: .fedora31

    variables:
        CMAKE_CONFIGURATION: fedora31_sphinx
        CTEST_NO_WARNINGS_ALLOWED: 1
        CTEST_SOURCE_SUBDIRECTORY: "Utilities/Sphinx"
        CMake_SKIP_INSTALL: 1

.fedora31_ninja: &fedora31_ninja
    extends: .fedora31

    variables:
        CMAKE_CONFIGURATION: fedora31_ninja
        CTEST_NO_WARNINGS_ALLOWED: 1

.fedora31_ninja_multi: &fedora31_ninja_multi
    extends: .fedora31

    variables:
        CMAKE_CONFIGURATION: fedora31_ninja_multi
        CTEST_NO_WARNINGS_ALLOWED: 1
        CMAKE_GENERATOR: "Ninja Multi-Config"

.fedora31_makefiles: &fedora31_makefiles
    extends: .fedora31

    variables:
        CMAKE_CONFIGURATION: fedora31_makefiles
        CTEST_NO_WARNINGS_ALLOWED: 1
        CMAKE_GENERATOR: "Unix Makefiles"

.cuda10.2: &cuda
    image: "kitware/cmake:ci-cuda10.2-x86_64-2020-06-11"

    variables:
        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
        CTEST_LABELS: "CUDA"

.cuda10.2_nvidia: &cuda10_2_nvidia
    extends: .cuda10.2

    variables:
        CMAKE_CONFIGURATION: cuda10.2_nvidia
        CTEST_NO_WARNINGS_ALLOWED: 1

.macos: &macos
    variables:
        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID"
        # TODO: Factor this out so that each job selects the Xcode version to
        # use so that different versions can be tested in a single pipeline.
        DEVELOPER_DIR: "/Applications/Xcode-11.5.app/Contents/Developer"

.macos_build: &macos_build
    extends: .macos

    variables:
        # Note that shell runners only support runners with a single
        # concurrency level. We can't use `$CI_CONCURRENCY_ID` because this may
        # change between the build and test stages which CMake doesn't support.
        # Even if we could, it could change if other runners on the machine
        # could run at the same time, so we drop it.
        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"

.macos_ninja: &macos_ninja
    extends: .macos_build

    variables:
        CMAKE_CONFIGURATION: macos_ninja
        CTEST_NO_WARNINGS_ALLOWED: 1

.macos_makefiles: &macos_makefiles
    extends: .macos_build

    variables:
        CMAKE_CONFIGURATION: macos_makefiles
        CTEST_NO_WARNINGS_ALLOWED: 1
        CMAKE_GENERATOR: "Unix Makefiles"

.macos_xcode: &macos_xcode
    extends: .macos

    variables:
        CMAKE_CONFIGURATION: macos_xcode
        CMAKE_GENERATOR: Xcode

.windows: &windows
    variables:
        GIT_CLONE_PATH: "$CI_BUILDS_DIR\\cmake ci ext\\$CI_CONCURRENT_ID"

.windows_build: &windows_build
    extends: .windows

    variables:
        # Note that shell runners only support runners with a single
        # concurrency level. We can't use `$CI_CONCURRENCY_ID` because this may
        # change between the build and test stages which CMake doesn't support.
        # Even if we could, it could change if other runners on the machine
        # could run at the same time, so we drop it.
        GIT_CLONE_PATH: "$CI_BUILDS_DIR\\cmake ci"

.windows_ninja: &windows_ninja
    extends: .windows_build

    variables:
        # Debug and RelWithDebinfo build types use the `/Zi` which results in
        # uncacheable compiations.
        # https://github.com/mozilla/sccache/issues/242
        CMAKE_BUILD_TYPE: Release
        CTEST_NO_WARNINGS_ALLOWED: 1

.windows_vs2019_x64_ninja: &windows_vs2019_x64_ninja
    extends: .windows_ninja

    variables:
        CMAKE_CONFIGURATION: windows_vs2019_x64_ninja
        VCVARSALL: "${VS160COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat"
        VCVARSPLATFORM: "x64"
        VCVARSVERSION: "14.26"

.windows_vs2019_x64: &windows_vs2019_x64
    extends: .windows

    variables:
        CMAKE_CONFIGURATION: windows_vs2019_x64
        CMAKE_GENERATOR: "Visual Studio 16 2019"
        CMAKE_GENERATOR_PLATFORM: "x64"
        CMAKE_GENERATOR_TOOLSET: "v142,version=14.26"

.linux_builder_tags: &linux_builder_tags
    tags:
        - build
        - docker
        - linux

.linux_builder_tags_qt: &linux_builder_tags_qt
    tags:
        - build
        - docker
        - linux
        - linux-3.17 # Needed to be able to load Fedora's Qt libraries.

.linux_builder_tags_cuda: &linux_builder_tags_cuda
    tags:
        - cuda-rt
        - docker
        - linux

.macos_builder_tags: &macos_builder_tags
    tags:
        - cmake # Since this is a bare runner, pin to a project.
        - macos
        - shell
        - xcode-11.5
        - nonconcurrent

.macos_builder_ext_tags: &macos_builder_ext_tags
    tags:
        - cmake # Since this is a bare runner, pin to a project.
        - macos
        - shell
        - xcode-11.5
        - concurrent

.windows_builder_tags: &windows_builder_tags
    tags:
        - cmake # Since this is a bare runner, pin to a project.
        - windows
        - shell
        - vs2019
        - msvc-19.25
        - nonconcurrent

.windows_builder_ext_tags: &windows_builder_ext_tags
    tags:
        - cmake # Since this is a bare runner, pin to a project.
        - windows
        - shell
        - vs2019
        - msvc-19.25
        - concurrent

.before_script_unix: &before_script_unix
    - .gitlab/ci/cmake.sh
    - .gitlab/ci/ninja.sh
    - export PATH=$PWD/.gitlab:$PWD/.gitlab/cmake/bin:$PATH
    - cmake --version
    - ninja --version
    # Download Qt on macOS
    - "[ \"$( uname -s )\" = \"Darwin\" ] && cmake -P .gitlab/ci/download_qt.cmake"
    - "[ \"$( uname -s )\" = \"Darwin\" ] && export CMAKE_PREFIX_PATH=$PWD/.gitlab/qt"

.before_script_windows: &before_script_windows
    - Invoke-Expression -Command .gitlab/ci/cmake.ps1
    - Invoke-Expression -Command .gitlab/ci/ninja.ps1
    - $pwdpath = $pwd.Path
    - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab;$pwdpath\.gitlab\cmake\bin;$env:PATH"
    - cmake --version
    - ninja --version
    - cmake -P .gitlab/ci/download_qt.cmake
    - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\qt\bin;$env:PATH"

.cmake_build_unix: &cmake_build_unix
    stage: build

    script:
        - *before_script_unix
        - .gitlab/ci/sccache.sh
        # Allow the server to already be running.
        - "sccache --start-server || :"
        - sccache --show-stats
        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_configure.cmake"
        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake"
        - sccache --show-stats

    interruptible: true

.cmake_build_release_linux: &cmake_build_release_linux
    stage: build

    script:
        # Bootstrap.
        - mkdir build/
        - cp -v Utilities/Release/linux/x86_64/cache.txt build/CMakeCache.txt
        # Make sccache available.
        - .gitlab/ci/sccache.sh
        - export PATH=$PWD/.gitlab:$PATH
        # Append sccache settings to the cache.
        - echo "CMAKE_C_COMPILER_LAUNCHER:STRING=sccache" >> build/CMakeCache.txt
        - echo "CMAKE_CXX_COMPILER_LAUNCHER:STRING=sccache" >> build/CMakeCache.txt
        # CI settings.
        - echo "CMake_TEST_INSTALL:BOOL=OFF" >> build/CMakeCache.txt
        - echo "CMAKE_INSTALL_PREFIX:PATH=$PWD/build/install" >> build/CMakeCache.txt
        - echo "CMAKE_SKIP_INSTALL_ALL_DEPENDENCY:BOOL=ON" >> build/CMakeCache.txt
        # Bootstrap
        - cd build/
        - "$LAUNCHER ../bootstrap --parallel=$(nproc) --docdir=doc/cmake"
        # FIXME: When CTest can drive an external CMake for the build as well,
        # use the scripts here.
        - "$LAUNCHER make -j$(nproc)"
        # NOTE: This regex matches that used in the release build.
        - "$LAUNCHER bin/ctest --output-on-failure -j$(nproc) -R '^(CMake\\.|CMakeLib\\.|CMakeServerLib\\.|RunCMake\\.ctest_memcheck)'"
        # Make a package.
        - bin/cpack -G TGZ
        - bin/cpack -G STGZ
        - sccache --show-stats

    interruptible: true

.cmake_build_windows: &cmake_build_windows
    stage: build

    script:
        - *before_script_windows
        - Set-Item -Force -Path "env:PATH" -Value "$env:PATH;$env:SCCACHE_PATH"
        - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
        - sccache --start-server
        - sccache --show-stats
        - ctest -VV -S .gitlab/ci/ctest_configure.cmake
        - ctest -VV -S .gitlab/ci/ctest_build.cmake
        - sccache --show-stats
        - sccache --stop-server

    interruptible: true

.cmake_build_artifacts: &cmake_build_artifacts
    artifacts:
        expire_in: 1d
        paths:
            # XXX(globbing): Can be simplified with support from
            # https://gitlab.com/gitlab-org/gitlab-runner/issues/4840
            - build/CTestTestfile.cmake
            - build/*/CTestTestfile.cmake
            - build/*/*/CTestTestfile.cmake
            - build/*/*/*/CTestTestfile.cmake
            - build/*/*/*/*/CTestTestfile.cmake

            # Allow CMake to find CMAKE_ROOT.
            - build/CMakeFiles/CMakeSourceDir.txt

            # Take the install tree.
            - build/install/

            # We need the main binaries.
            - build/bin/
            # The cache is needed for the installation test.
            - build/CMakeCache.txt
            # Test binaries. Eventually these might be better under
            # `Source/Tests` or the like.
            - build/Tests/EnforceConfig.cmake
            - build/Tests/CMakeBuildTest.cmake
            - build/Tests/CMakeBuildDoubleProjectTest.cmake
            - build/Tests/CMake*/runcompilecommands
            - build/Tests/CMake*/runcompilecommands.exe
            - build/Tests/CMake*/test*
            - build/Tests/CMake*/PseudoMemcheck/valgrind
            - build/Tests/CMake*/PseudoMemcheck/purify
            - build/Tests/CMake*/PseudoMemcheck/memcheck_fail
            - build/Tests/CMake*/PseudoMemcheck/BC
            - build/Tests/CMake*/PseudoMemcheck/valgrind.exe
            - build/Tests/CMake*/PseudoMemcheck/purify.exe
            - build/Tests/CMake*/PseudoMemcheck/memcheck_fail.exe
            - build/Tests/CMake*/PseudoMemcheck/BC.exe
            - build/Tests/CMake*/PseudoMemcheck/NoLog
            - build/Tests/CMake*Lib/*LibTests
            - build/Tests/CMake*Lib/*LibTests.exe
            - build/Source/kwsys/cmsysTest*
            - build/Source/kwsys/testConsoleBufChild.exe
            - build/Utilities/cmcurl/curltest
            - build/Utilities/cmcurl/curltest.exe
            - build/Utilities/KWIML/test/kwiml_test
            - build/Utilities/KWIML/test/kwiml_test.exe
            - build/Source/kwsys/*cmsysTestDynload.*
            - build/Source/kwsys/dynloaddir/cmsysTestDynloadImpl.dll
            - build/Source/kwsys/dynloaddir/cmsysTestDynloadUse.dll

            # Test directories.
            - build/Tests/CTest*
            - build/Tests/Find*
            - build/Tests/Qt5*
            - build/Tests/RunCMake/
            - build/Tests/CMakeOnly/
            - build/Tests/CMakeTests/

            # CTest/CDash information.
            - build/Testing/
            - build/DartConfiguation.tcl
            - build/CTestCustom.cmake

.cmake_release_artifacts: &cmake_release_artifacts
    artifacts:
        expire_in: 5d
        paths:
            # Any packages made.
            - build/cmake-*-Linux-x86_64.*

.cmake_test_artifacts: &cmake_test_artifacts
    artifacts:
        expire_in: 1d
        paths:
            # Take the install tree.
            - build/install/

.cmake_test_unix: &cmake_test_unix
    stage: test

    script:
        - *before_script_unix
        - "$LAUNCHER ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake"

    interruptible: true

.cmake_test_windows: &cmake_test_windows
    stage: test

    script:
        - *before_script_windows
        - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
        - ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake

    interruptible: true

.cmake_test_linux_package: &cmake_test_linux_package
    stage: test-ext

    script:
        - *before_script_unix
        # Make the CMake package available.
        - mkdir -p build/install
        - tar -C build/install --strip-components=1 -xzf build/cmake-*-Linux-x86_64.tar.gz
        - .gitlab/ci/sccache.sh
        # Allow the server to already be running.
        - "sccache --start-server || :"
        - sccache --show-stats
        - "$LAUNCHER build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake"
        - sccache --show-stats

    interruptible: true

.cmake_test_linux_external: &cmake_test_linux_external
    stage: test-ext

    script:
        - *before_script_unix
        - .gitlab/ci/sccache.sh
        - sccache --start-server
        - sccache --show-stats
        - "$LAUNCHER build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake"
        - sccache --show-stats

    interruptible: true

.cmake_test_macos_external: &cmake_test_macos_external
    stage: test-ext

    script:
        - *before_script_unix
        - .gitlab/ci/sccache.sh
        # Allow the server to already be running.
        - "sccache --start-server || :"
        - sccache --show-stats
        - "$LAUNCHER build/install/CMake.app/Contents/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake"
        - sccache --show-stats

    interruptible: true

.cmake_test_windows_external: &cmake_test_windows_external
    stage: test-ext

    script:
        - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake

    interruptible: true

stages:
    - build
    - test
    - test-ext

build:debian10-iwyu:
    <<:
        - *debian10_iwyu
        - *cmake_build_unix
        - *linux_builder_tags
    rules: *rules_settings

build:fedora31-tidy:
    <<:
        - *fedora31_tidy
        - *cmake_build_unix
        - *linux_builder_tags_qt
    rules: *rules_settings

build:fedora31-sphinx:
    <<:
        - *fedora31_sphinx
        - *cmake_build_unix
        - *linux_builder_tags_qt
    rules: *rules_settings

build:centos6-release:
    <<:
        - *release_linux
        - *cmake_build_release_linux
        - *cmake_release_artifacts
        - *linux_builder_tags
    rules: *manual_rules_settings

test:fedora31-makefiles:
    <<:
        - *fedora31_makefiles
        - *cmake_test_linux_package
        - *linux_builder_tags_qt
    rules: *rules_settings
    dependencies:
        - build:centos6-release
    needs:
        - build:centos6-release

test:cuda10.2-nvidia:
    <<:
        - *cuda10_2_nvidia
        - *cmake_test_linux_package
        - *linux_builder_tags_cuda
    rules: *rules_settings
    dependencies:
        - build:centos6-release
    needs:
        - build:centos6-release

build:fedora31-ninja:
    <<:
        - *fedora31_ninja
        - *cmake_build_unix
        - *cmake_build_artifacts
        - *linux_builder_tags_qt
    rules: *manual_rules_settings

test:fedora31-ninja:
    <<:
        - *fedora31_ninja
        - *cmake_test_unix
        - *linux_builder_tags_qt
        - *cmake_test_artifacts
    rules: *rules_settings
    dependencies:
        - build:fedora31-ninja
    needs:
        - build:fedora31-ninja

test:fedora31-ninja-multi:
    <<:
        - *fedora31_ninja_multi
        - *cmake_test_linux_external
        - *linux_builder_tags_qt
    rules: *rules_settings
    dependencies:
        - test:fedora31-ninja
    needs:
        - test:fedora31-ninja

build:macos-ninja:
    <<:
        - *macos_ninja
        - *cmake_build_unix
        - *cmake_build_artifacts
        - *macos_builder_tags
    rules: *manual_rules_settings

test:macos-ninja:
    <<:
        - *macos_ninja
        - *cmake_test_unix
        - *cmake_test_artifacts
        - *macos_builder_tags
    rules: *rules_settings
    dependencies:
        - build:macos-ninja
    needs:
        - build:macos-ninja

build:macos-makefiles:
    <<:
        - *macos_makefiles
        - *cmake_build_unix
        - *cmake_build_artifacts
        - *macos_builder_tags
    rules: *manual_rules_settings

test:macos-makefiles:
    <<:
        - *macos_makefiles
        - *cmake_test_unix
        - *macos_builder_tags
    rules: *rules_settings
    dependencies:
        - build:macos-makefiles
    needs:
        - build:macos-makefiles

test:macos-xcode:
    <<:
        - *macos_xcode
        - *cmake_test_macos_external
        - *macos_builder_ext_tags
    rules: *rules_settings
    dependencies:
        - test:macos-ninja
    needs:
        - test:macos-ninja

build:windows-vs2019-x64-ninja:
    <<:
        - *windows_vs2019_x64_ninja
        - *cmake_build_windows
        - *cmake_build_artifacts
        - *windows_builder_tags
    rules: *manual_rules_settings

test:windows-vs2019-x64-ninja:
    <<:
        - *windows_vs2019_x64_ninja
        - *cmake_test_windows
        - *windows_builder_tags
        - *cmake_test_artifacts
    rules: *rules_settings
    dependencies:
        - build:windows-vs2019-x64-ninja
    needs:
        - build:windows-vs2019-x64-ninja

test:windows-vs2019-x64:
    <<:
        - *windows_vs2019_x64
        - *cmake_test_windows_external
        - *windows_builder_ext_tags
    rules: *rules_settings
    dependencies:
        - test:windows-vs2019-x64-ninja
    needs:
        - test:windows-vs2019-x64-ninja