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