summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: 421c3f9ac0fc32f436be4389395e3545ea0553b6 (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
.only_settings: &only_settings
    - merge_requests
    - branches@cmake/cmake
    - tags@cmake/cmake

.fedora31: &fedora31
    image: "kitware/cmake:ci-fedora31-x86_64-2020-05-08"

    variables:
        GIT_CLONE_PATH: "$CI_BUILDS_DIR/gitlab-kitware-cmake ci"

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

    variables:
        GIT_CLONE_PATH: "$CI_BUILDS_DIR/gitlab-kitware-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_makefiles: &fedora31_makefiles
    extends: .fedora31

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

.macos: &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/gitlab-kitware-cmake ci"

.macos_ninja: &macos_ninja
    extends: .macos

    variables:
        CMAKE_CONFIGURATION: macos_ninja
        CTEST_NO_WARNINGS_ALLOWED: 1

.macos_makefiles: &macos_makefiles
    extends: .macos

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

.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.

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

before_script:
    - .gitlab/ci/cmake.sh
    - .gitlab/ci/ninja.sh
    - export PATH=$PWD/.gitlab:$PWD/.gitlab/cmake/bin:$PATH
    - cmake --version
    - ninja --version

.cmake_build_unix: &cmake_build_unix
    stage: build
    only: *only_settings

    script:
        - .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_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*/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/NoLog
            - build/Tests/CMake*Lib/*LibTests
            - build/Source/kwsys/cmsysTest*
            - build/Utilities/cmcurl/curltest
            - build/Utilities/KWIML/test/kwiml_test
            - build/Source/kwsys/libcmsysTestDynload.so

            # 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_test_artifacts: &cmake_test_artifacts
    artifacts:
        expire_in: 1d
        paths:
            # Take the install tree.
            - build/install/

.cmake_test_unix: &cmake_test_unix
    stage: test
    only: *only_settings

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

    interruptible: true

stages:
    - build
    - test

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

build:fedora31-tidy:
    <<:
        - *fedora31_tidy
        - *cmake_build_unix
        - *linux_builder_tags

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

build:fedora31-ninja:
    <<:
        - *fedora31_ninja
        - *cmake_build_unix
        - *cmake_build_artifacts
        - *linux_builder_tags
    when: manual

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

build:fedora31-makefiles:
    <<:
        - *fedora31_makefiles
        - *cmake_build_unix
        - *cmake_build_artifacts
        - *linux_builder_tags
    when: manual

test:fedora31-makefiles:
    <<:
        - *fedora31_makefiles
        - *cmake_test_unix
        - *linux_builder_tags_qt
    dependencies:
        - build:fedora31-makefiles
    needs:
        - build:fedora31-makefiles

build:macos-ninja:
    <<:
        - *macos_ninja
        - *cmake_build_unix
        - *cmake_build_artifacts
        - *macos_builder_tags
    when: manual

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

build:macos-makefiles:
    <<:
        - *macos_makefiles
        - *cmake_build_unix
        - *cmake_build_artifacts
        - *macos_builder_tags
    when: manual

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