b63559bab2ea843e850a380d4fe37ac39a8d5cf2
[platform/upstream/libdrm.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 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 .templates_sha: &template_sha 567700e483aabed992d0a4fea84994a0472deff6 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
16
17 include:
18   - project: 'freedesktop/ci-templates'
19     ref: *template_sha
20     file:
21     - '/templates/debian.yml'
22     - '/templates/ci-fairy.yml'
23
24 variables:
25   FDO_UPSTREAM_REPO: mesa/drm
26   FDO_REPO_SUFFIX: "$BUILD_OS/$BUILD_ARCH"
27
28 stages:
29   - "Base container"
30   - "Build"
31
32 .ci-rules:
33   rules:
34     - when: on_success
35
36 # CONTAINERS
37
38 .os-debian:
39   variables:
40     BUILD_OS: debian
41     FDO_DISTRIBUTION_VERSION: buster
42     FDO_DISTRIBUTION_PACKAGES: 'build-essential docbook-xsl libatomic-ops-dev libcairo2-dev libcunit1-dev libpciaccess-dev meson ninja-build pkg-config python3 python3-pip python3-wheel python3-setuptools python3-docutils valgrind'
43     FDO_DISTRIBUTION_EXEC: 'pip3 install meson==0.52.1'
44     # bump this tag every time you change something which requires rebuilding the
45     # base image
46     FDO_DISTRIBUTION_TAG: "2021-08-03.0"
47
48 .debian-x86_64:
49   extends:
50     - .os-debian
51   variables:
52     BUILD_ARCH: "x86-64"
53
54 .debian-aarch64:
55   extends:
56     - .os-debian
57   variables:
58     BUILD_ARCH: "aarch64"
59
60 .debian-armv7:
61   extends:
62     - .os-debian
63   variables:
64     BUILD_ARCH: "armv7"
65
66 # Build our base container image, which contains the core distribution, the
67 # toolchain, and all our build dependencies. This will be reused in the build
68 # stage.
69 x86_64-debian-container_prep:
70   extends:
71     - .ci-rules
72     - .debian-x86_64
73     - .fdo.container-build@debian
74   stage: "Base container"
75   variables:
76     GIT_STRATEGY: none
77
78 aarch64-debian-container_prep:
79   extends:
80     - .ci-rules
81     - .debian-aarch64
82     - .fdo.container-build@debian
83   tags:
84     - aarch64
85   stage: "Base container"
86   variables:
87     GIT_STRATEGY: none
88
89 armv7-debian-container_prep:
90   extends:
91     - .ci-rules
92     - .debian-armv7
93     - .fdo.container-build@debian
94   tags:
95     - aarch64
96   stage: "Base container"
97   variables:
98     GIT_STRATEGY: none
99     FDO_BASE_IMAGE: "arm32v7/debian:$FDO_DISTRIBUTION_VERSION"
100
101 # Core build environment.
102 .build-env:
103   variables:
104     MESON_BUILD_TYPE: "-Dbuildtype=debug -Doptimization=0 -Db_sanitize=address,undefined"
105
106 # OS/architecture-specific variants
107 .build-env-debian-x86_64:
108   extends:
109     - .fdo.suffixed-image@debian
110     - .debian-x86_64
111     - .build-env
112   needs:
113     - job: x86_64-debian-container_prep
114       artifacts: false
115
116 .build-env-debian-aarch64:
117   extends:
118     - .fdo.suffixed-image@debian
119     - .debian-aarch64
120     - .build-env
121   variables:
122     # At least with the versions we have, the LSan runtime makes fork unusably
123     # slow on AArch64, which is bad news since the test suite decides to fork
124     # for every single subtest. For now, in order to get AArch64 builds and
125     # tests into CI, just assume that we're not going to leak any more on
126     # AArch64 than we would on ARMv7 or x86-64.
127     ASAN_OPTIONS: "detect_leaks=0"
128   tags:
129     - aarch64
130   needs:
131     - job: aarch64-debian-container_prep
132       artifacts: false
133
134 .build-env-debian-armv7:
135   extends:
136     - .fdo.suffixed-image@debian
137     - .debian-armv7
138     - .build-env
139   tags:
140     - aarch64
141   needs:
142     - job: armv7-debian-container_prep
143       artifacts: false
144
145 # BUILD
146
147 .do-build:
148   extends:
149     - .ci-rules
150   stage: "Build"
151   variables:
152     GIT_DEPTH: 10
153   script:
154     - meson build
155         -D amdgpu=true
156         -D cairo-tests=true
157         -D etnaviv=true
158         -D exynos=true
159         -D freedreno=true
160         -D freedreno-kgsl=true
161         -D intel=true
162         -D libkms=true
163         -D man-pages=true
164         -D nouveau=true
165         -D omap=true
166         -D radeon=true
167         -D tegra=true
168         -D udev=true
169         -D valgrind=auto
170         -D vc4=true
171         -D vmwgfx=true
172     - ninja -C build
173     - ninja -C build test
174     - DESTDIR=$PWD/install ninja -C build install
175   artifacts:
176     when: on_failure
177     paths:
178       - build/meson-logs/*
179
180 # Full build and test.
181 x86_64-debian-build:
182   extends:
183     - .build-env-debian-x86_64
184     - .do-build
185
186 aarch64-debian-build:
187   extends:
188     - .build-env-debian-aarch64
189     - .do-build
190
191 armv7-debian-build:
192   extends:
193     - .build-env-debian-armv7
194     - .do-build
195
196 # Daily build
197 meson-arch-daily:
198   rules:
199     - if: '$SCHEDULE == "arch-daily"'
200       when: on_success
201     - when: never
202   image: archlinux/archlinux:base-devel
203   before_script:
204     - pacman -Syu --noconfirm --needed
205         cairo
206         cunit
207         libatomic_ops
208         libpciaccess
209         meson
210         valgrind
211         python-docutils
212   extends: .do-build