gitlab-ci: add clang build
[mesa.git] / .gitlab-ci.yml
1 # This is the tag of the docker image used for the build jobs. If the
2 # image doesn't exist yet, the containers-build stage generates it.
3 #
4 # In order to generate a new image, one should generally change the tag.
5 # While removing the image from the registry would also work, that's not
6 # recommended except for ephemeral images during development: Replacing
7 # an image after a significant amount of time might pull in newer
8 # versions of gcc/clang or other packages, which might break the build
9 # with older commits using the same tag.
10 #
11 # After merging a change resulting in generating a new image to the
12 # main repository, it's recommended to remove the image from the source
13 # repository's container registry, so that the image from the main
14 # repository's registry will be used there as well.
15 #
16 # The format of the tag is "%Y-%m-%d-${counter}" where ${counter} stays
17 # at "01" unless you have multiple updates on the same day :)
18 variables:
19 UBUNTU_TAG: 2019-03-05-01
20 UBUNTU_IMAGE: "$CI_REGISTRY_IMAGE/ubuntu:$UBUNTU_TAG"
21 UBUNTU_IMAGE_MAIN: "registry.freedesktop.org/mesa/mesa/ubuntu:$UBUNTU_TAG"
22
23 cache:
24 paths:
25 - ccache
26
27 stages:
28 - containers-build
29 - build+test
30
31
32 # When to automatically run the CI
33 .ci-run-policy:
34 only:
35 - master
36 - merge_requests
37 - /^ci([-/].*)?$/
38
39
40 # CONTAINERS
41
42 ubuntu:
43 extends: .ci-run-policy
44 stage: containers-build
45 image: docker:stable
46 services:
47 - docker:dind
48 variables:
49 DOCKER_HOST: tcp://docker:2375
50 DOCKER_DRIVER: overlay2
51 script:
52 # Enable experimental features such as `docker manifest inspect`
53 - mkdir -p ~/.docker
54 - "echo '{\"experimental\": \"enabled\"}' > ~/.docker/config.json"
55 - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
56 # Check if the image (with the specific tag) already exists
57 - docker manifest inspect $UBUNTU_IMAGE && exit || true
58 # Try to re-use the image from the main repository's registry
59 - docker image pull $UBUNTU_IMAGE_MAIN &&
60 docker image tag $UBUNTU_IMAGE_MAIN $UBUNTU_IMAGE &&
61 docker image push $UBUNTU_IMAGE && exit || true
62 - docker build -t $UBUNTU_IMAGE -f .gitlab-ci/Dockerfile.ubuntu .
63 - docker push $UBUNTU_IMAGE
64
65
66 # BUILD
67
68 .build:
69 extends: .ci-run-policy
70 image: $UBUNTU_IMAGE
71 stage: build+test
72 artifacts:
73 when: on_failure
74 untracked: true
75 # Use ccache transparently, and print stats before/after
76 before_script:
77 - export PATH="/usr/lib/ccache:$PATH"
78 - export CCACHE_BASEDIR="$PWD"
79 - export CCACHE_DIR="$PWD/ccache"
80 - export CCACHE_COMPILERCHECK=content
81 - ccache --zero-stats || true
82 - ccache --show-stats || true
83 after_script:
84 - export CCACHE_DIR="$PWD/ccache"
85 - ccache --show-stats
86
87 .meson-build:
88 extends: .build
89 script:
90 # We need to control the version of llvm-config we're using, so we'll
91 # generate a native file to do so. This requires meson >=0.49
92 - if test -n "$LLVM_VERSION"; then
93 LLVM_CONFIG="llvm-config-${LLVM_VERSION}";
94 echo -e "[binaries]\nllvm-config = '`which $LLVM_CONFIG`'" > native.file;
95 $LLVM_CONFIG --version;
96 else
97 touch native.file;
98 fi
99 - meson --version
100 - meson _build
101 --native-file=native.file
102 -D build-tests=true
103 -D libunwind=${UNWIND}
104 ${DRI_LOADERS}
105 -D dri-drivers=${DRI_DRIVERS:-[]}
106 ${GALLIUM_ST}
107 -D gallium-drivers=${GALLIUM_DRIVERS:-[]}
108 -D vulkan-drivers=${VULKAN_DRIVERS:-[]}
109 -D I-love-half-baked-turnips=true
110 - cd _build
111 - meson configure
112 - ninja -j4
113 - ninja test
114
115 .make-build:
116 extends: .build
117 variables:
118 MAKEFLAGS: "-j4"
119 script:
120 - if test -n "$LLVM_VERSION"; then
121 export LLVM_CONFIG="llvm-config-${LLVM_VERSION}";
122 fi
123 - mkdir build
124 - cd build
125 - ../autogen.sh
126 --enable-autotools
127 --enable-debug
128 $LIBUNWIND_FLAGS
129 $DRI_LOADERS
130 --with-dri-drivers=$DRI_DRIVERS
131 $GALLIUM_ST
132 --with-gallium-drivers=$GALLIUM_DRIVERS
133 --with-vulkan-drivers=$VULKAN_DRIVERS
134 --disable-llvm-shared-libs
135 - make
136 - eval $MAKE_CHECK_COMMAND
137
138 .scons-build:
139 extends: .build
140 variables:
141 SCONSFLAGS: "-j4"
142 script:
143 - if test -n "$LLVM_VERSION"; then
144 export LLVM_CONFIG="llvm-config-${LLVM_VERSION}";
145 fi
146 - scons $SCONS_TARGET
147 - eval $SCONS_CHECK_COMMAND
148
149 meson-vulkan:
150 extends: .meson-build
151 variables:
152 UNWIND: "false"
153 DRI_LOADERS: >
154 -D glx=disabled
155 -D gbm=false
156 -D egl=false
157 -D platforms=x11,wayland,drm
158 -D osmesa=none
159 GALLIUM_ST: >
160 -D dri3=true
161 -D gallium-vdpau=false
162 -D gallium-xvmc=false
163 -D gallium-omx=disabled
164 -D gallium-va=false
165 -D gallium-xa=false
166 -D gallium-nine=false
167 -D gallium-opencl=disabled
168 VULKAN_DRIVERS: intel,amd,freedreno
169 LLVM_VERSION: "7"
170
171 meson-loader-classic-dri:
172 extends: .meson-build
173 variables:
174 UNWIND: "false"
175 DRI_LOADERS: >
176 -D glx=dri
177 -D gbm=true
178 -D egl=true
179 -D platforms=x11,wayland,drm,surfaceless
180 -D osmesa=classic
181 DRI_DRIVERS: "i915,i965,r100,r200,swrast,nouveau"
182 GALLIUM_ST: >
183 -D dri3=true
184 -D gallium-vdpau=false
185 -D gallium-xvmc=false
186 -D gallium-omx=disabled
187 -D gallium-va=false
188 -D gallium-xa=false
189 -D gallium-nine=false
190 -D gallium-opencl=disabled
191
192 meson-glvnd:
193 extends: .meson-build
194 variables:
195 UNWIND: "true"
196 DRI_LOADERS: >
197 -D glvnd=true
198 -D egl=true
199 -D gbm=true
200 -D glx=dri
201 DRI_DRIVERS: "i965"
202 GALLIUM_ST: >
203 -D gallium-vdpau=false
204 -D gallium-xvmc=false
205 -D gallium-omx=disabled
206 -D gallium-va=false
207 -D gallium-xa=false
208 -D gallium-nine=false
209 -D gallium-opencl=disabled
210
211 meson-clang:
212 extends: .meson-build
213 variables:
214 UNWIND: "true"
215 DRI_DRIVERS: "auto"
216 GALLIUM_DRIVERS: "auto"
217 CC: clang-7
218 CXX: clang++-7
219
220 # NOTE: Building SWR is 2x (yes two) times slower than all the other
221 # gallium drivers combined.
222 # Start this early so that it doesn't hunder the run time.
223 meson-gallium-swr:
224 extends: .meson-build
225 variables:
226 UNWIND: "true"
227 DRI_LOADERS: >
228 -D glx=disabled
229 -D egl=false
230 -D gbm=false
231 GALLIUM_ST: >
232 -D dri3=false
233 -D gallium-vdpau=false
234 -D gallium-xvmc=false
235 -D gallium-omx=disabled
236 -D gallium-va=false
237 -D gallium-xa=false
238 -D gallium-nine=false
239 -D gallium-opencl=disabled
240 GALLIUM_DRIVERS: "swr"
241 LLVM_VERSION: "6.0"
242
243 meson-gallium-radeonsi:
244 extends: .meson-build
245 variables:
246 UNWIND: "true"
247 DRI_LOADERS: >
248 -D glx=disabled
249 -D egl=false
250 -D gbm=false
251 GALLIUM_ST: >
252 -D dri3=false
253 -D gallium-vdpau=false
254 -D gallium-xvmc=false
255 -D gallium-omx=disabled
256 -D gallium-va=false
257 -D gallium-xa=false
258 -D gallium-nine=false
259 -D gallium-opencl=disabled
260 GALLIUM_DRIVERS: "radeonsi"
261 LLVM_VERSION: "7"
262
263 meson-gallium-drivers-other:
264 extends: .meson-build
265 variables:
266 UNWIND: "true"
267 DRI_LOADERS: >
268 -D glx=disabled
269 -D egl=false
270 -D gbm=false
271 GALLIUM_ST: >
272 -D dri3=false
273 -D gallium-vdpau=false
274 -D gallium-xvmc=false
275 -D gallium-omx=disabled
276 -D gallium-va=false
277 -D gallium-xa=false
278 -D gallium-nine=false
279 -D gallium-opencl=disabled
280 GALLIUM_DRIVERS: "i915,iris,nouveau,kmsro,r300,r600,freedreno,svga,swrast,v3d,vc4,virgl,etnaviv,panfrost"
281 LLVM_VERSION: "5.0"
282
283 meson-gallium-clover-llvm:
284 extends: .meson-build
285 variables:
286 UNWIND: "true"
287 DRI_LOADERS: >
288 -D glx=disabled
289 -D egl=false
290 -D gbm=false
291 GALLIUM_ST: >
292 -D dri3=false
293 -D gallium-vdpau=false
294 -D gallium-xvmc=false
295 -D gallium-omx=disabled
296 -D gallium-va=false
297 -D gallium-xa=false
298 -D gallium-nine=false
299 -D gallium-opencl=icd
300 GALLIUM_DRIVERS: "r600,radeonsi"
301
302 meson-gallium-clover-llvm39:
303 extends: meson-gallium-clover-llvm
304 variables:
305 GALLIUM_DRIVERS: "r600"
306 LLVM_VERSION: "3.9"
307
308 meson-gallium-st-other:
309 extends: .meson-build
310 variables:
311 UNWIND: "true"
312 DRI_LOADERS: >
313 -D glx=disabled
314 -D egl=false
315 -D gbm=false
316 GALLIUM_ST: >
317 -D dri3=true
318 -D gallium-vdpau=true
319 -D gallium-xvmc=true
320 -D gallium-omx=bellagio
321 -D gallium-va=true
322 -D gallium-xa=true
323 -D gallium-nine=true
324 -D gallium-opencl=disabled
325 -D osmesa=gallium
326 GALLIUM_DRIVERS: "nouveau,swrast"
327 LLVM_VERSION: "5.0"
328
329 make-vulkan:
330 extends: .make-build
331 variables:
332 MAKE_CHECK_COMMAND: "make -C src/gtest check && make -C src/intel check"
333 LLVM_VERSION: "7"
334 DRI_LOADERS: >
335 --disable-glx
336 --disable-gbm
337 --disable-egl
338 --with-platforms=x11,wayland,drm
339 DRI_DRIVERS: ""
340 GALLIUM_ST: >
341 --enable-dri
342 --enable-dri3
343 --disable-opencl
344 --disable-xa
345 --disable-nine
346 --disable-xvmc
347 --disable-vdpau
348 --disable-va
349 --disable-omx-bellagio
350 --disable-gallium-osmesa
351 VULKAN_DRIVERS: intel,radeon
352 LIBUNWIND_FLAGS: --disable-libunwind
353
354 make-loader-classic-dri:
355 extends: .make-build
356 variables:
357 MAKE_CHECK_COMMAND: "make check"
358 DRI_LOADERS: >
359 --enable-glx
360 --enable-gbm
361 --enable-egl
362 --with-platforms=x11,wayland,drm,surfaceless
363 --enable-osmesa
364 DRI_DRIVERS: "i915,i965,radeon,r200,swrast,nouveau"
365 GALLIUM_ST: >
366 --enable-dri
367 --disable-opencl
368 --disable-xa
369 --disable-nine
370 --disable-xvmc
371 --disable-vdpau
372 --disable-va
373 --disable-omx-bellagio
374 --disable-gallium-osmesa
375 LIBUNWIND_FLAGS: --disable-libunwind
376
377 # NOTE: Building SWR is 2x (yes two) times slower than all the other
378 # gallium drivers combined.
379 # Start this early so that it doesn't hunder the run time.
380 make-gallium-drivers-swr:
381 extends: .make-build
382 variables:
383 MAKE_CHECK_COMMAND: "true"
384 LLVM_VERSION: "6.0"
385 DRI_LOADERS: >
386 --disable-glx
387 --disable-gbm
388 --disable-egl
389 GALLIUM_ST: >
390 --enable-dri
391 --disable-opencl
392 --disable-xa
393 --disable-nine
394 --disable-xvmc
395 --disable-vdpau
396 --disable-va
397 --disable-omx-bellagio
398 --disable-gallium-osmesa
399 GALLIUM_DRIVERS: "swr"
400 LIBUNWIND_FLAGS: --enable-libunwind
401
402 make-gallium-drivers-radeonsi:
403 extends: make-gallium-drivers-swr
404 variables:
405 LLVM_VERSION: "7"
406 GALLIUM_DRIVERS: "radeonsi"
407
408 make-gallium-drivers-other:
409 extends: make-gallium-drivers-swr
410 variables:
411 LLVM_VERSION: "3.9"
412 GALLIUM_DRIVERS: "i915,nouveau,kmsro,r300,r600,freedreno,svga,swrast,v3d,vc4,virgl,etnaviv"
413
414 make-gallium-st-clover-llvm:
415 extends: .make-build
416 variables:
417 MAKE_CHECK_COMMAND: "true"
418 DRI_LOADERS: >
419 --disable-glx
420 --disable-gbm
421 --disable-egl
422 GALLIUM_ST: >
423 --disable-dri
424 --enable-opencl
425 --enable-opencl-icd
426 --enable-llvm
427 --disable-xa
428 --disable-nine
429 --disable-xvmc
430 --disable-vdpau
431 --disable-va
432 --disable-omx-bellagio
433 --disable-gallium-osmesa
434 LIBUNWIND_FLAGS: --enable-libunwind
435 GALLIUM_DRIVERS: "r600,radeonsi"
436 LLVM_VERSION: "7"
437
438 make-gallium-st-clover-llvm-39:
439 extends: make-gallium-st-clover-llvm
440 variables:
441 LLVM_VERSION: "3.9"
442 GALLIUM_DRIVERS: "r600"
443
444 make-gallium-st-other:
445 extends: .make-build
446 variables:
447 MAKE_CHECK_COMMAND: "true"
448 # We should be testing 3.3, but 3.9 is the oldest that still exists in ubuntu
449 LLVM_VERSION: "3.9"
450 DRI_LOADERS: >
451 --disable-glx
452 --disable-gbm
453 --disable-egl
454 GALLIUM_ST: >
455 --enable-dri
456 --disable-opencl
457 --enable-xa
458 --enable-nine
459 --enable-xvmc
460 --enable-vdpau
461 --enable-va
462 --enable-omx-bellagio
463 --enable-gallium-osmesa
464 # We need swrast for osmesa and nine.
465 # i915 most likely doesn't work with most ST.
466 # Regardless - we're doing a quick build test here.
467 GALLIUM_DRIVERS: "i915,swrast"
468 LIBUNWIND_FLAGS: --enable-libunwind
469
470 scons-nollvm:
471 extends: .scons-build
472 variables:
473 SCONS_TARGET: "llvm=0"
474 SCONS_CHECK_COMMAND: "scons llvm=0 check"
475
476 scons-llvm:
477 extends: .scons-build
478 variables:
479 SCONS_TARGET: "llvm=1"
480 SCONS_CHECK_COMMAND: "scons llvm=1 check"
481 LLVM_VERSION: "3.9"
482
483 scons-swr:
484 extends: .scons-build
485 variables:
486 SCONS_TARGET: "swr=1"
487 SCONS_CHECK_COMMAND: "true"
488 LLVM_VERSION: "6.0"