gitlab-ci: Add CentOS 8 to CI
[amitay/samba.git] / .gitlab-ci.yml
1 # see https://docs.gitlab.com/ce/ci/yaml/README.html for all available options
2
3 stages:
4   - images
5   - build
6   - report
7
8 variables:
9   GIT_STRATEGY: fetch
10   GIT_DEPTH: "3"
11   # "--enable-coverage" or ""
12   SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE: ""
13   #
14   # we run autobuild.py inside a samba CI docker image located on gitlab's registry
15   # overwrite this variable if you want use your own image registry.
16   #
17   # Or better ask for access to the shared development repository, see
18   # https://wiki.samba.org/index.php/Samba_CI_on_gitlab#Getting_Access
19   #
20   SAMBA_CI_CONTAINER_REGISTRY: registry.gitlab.com/samba-team/devel/samba
21   #
22   # Set this to the contents of bootstrap/sha1sum.txt
23   # which is generated by bootstrap/template.py --render
24   #
25   SAMBA_CI_CONTAINER_TAG: 4a498d9dd6c861b85bf4a749f3feb0805ea7298e
26   #
27   # We use the ubuntu1804 image as default as
28   # it matches what we have on sn-devel-184.
29   #
30   SAMBA_CI_CONTAINER_IMAGE: ubuntu1804
31   #
32   # The following images are available
33   # Please see the samba-o3 sections at the end of this file!
34   # We should run that for each available image
35   #
36   SAMBA_CI_CONTAINER_IMAGE_ubuntu1804: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1804:${SAMBA_CI_CONTAINER_TAG}
37   SAMBA_CI_CONTAINER_IMAGE_ubuntu1604: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1604:${SAMBA_CI_CONTAINER_TAG}
38   SAMBA_CI_CONTAINER_IMAGE_debian9: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-debian9:${SAMBA_CI_CONTAINER_TAG}
39   SAMBA_CI_CONTAINER_IMAGE_opensuse150: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-opensuse150:${SAMBA_CI_CONTAINER_TAG}
40   SAMBA_CI_CONTAINER_IMAGE_opensuse151: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-opensuse151:${SAMBA_CI_CONTAINER_TAG}
41   SAMBA_CI_CONTAINER_IMAGE_fedora29: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora29:${SAMBA_CI_CONTAINER_TAG}
42   SAMBA_CI_CONTAINER_IMAGE_fedora30: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora30:${SAMBA_CI_CONTAINER_TAG}
43   SAMBA_CI_CONTAINER_IMAGE_centos7: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-centos7:${SAMBA_CI_CONTAINER_TAG}
44   SAMBA_CI_CONTAINER_IMAGE_centos8: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-centos8:${SAMBA_CI_CONTAINER_TAG}
45
46 include:
47   # The image creation details are specified in a separate file
48   # See bootstrap/README.md for details
49   - 'bootstrap/.gitlab-ci.yml'
50
51 .shared_template:
52   variables:
53     AUTOBUILD_JOB_NAME: $CI_JOB_NAME
54   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
55   stage: build
56   tags:
57     - docker
58     - shared
59   before_script:
60     - uname -a
61     - lsb_release -a
62     - cat /etc/os-release
63     - mount
64     - df -h
65     - cat /proc/swaps
66     - free -h
67       # ld will fail if coverage enabled, force link ld to ld.bfd
68     - if [ -n "$SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE" ]; then sudo ln -sf $(which ld.bfd) $(which ld); fi
69       # See bootstrap/.gitlab-ci.yml how to generate a new image
70     - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
71     - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
72     - bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
73     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
74     - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
75     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
76     - diff -u bootstrap/sha1sum.txt /sha1sum.txt
77   after_script:
78     - mount
79     - df -h
80     - cat /proc/swaps
81     - free -h
82   artifacts:
83     expire_in: 1 week
84     paths:
85       - "*.stdout"
86       - "*.stderr"
87       - "*.info"
88       - system-info.txt
89   retry:
90     max: 2
91     when:
92       - runner_system_failure
93       - stuck_or_timeout_failure
94   script:
95     # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
96     # autobuild name, which means we can define a default template that runs most autobuild jobs
97     - echo "Running cmd script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase"
98     - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE  --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
99
100 others:
101   extends: .shared_template
102   script:
103     - script/autobuild.py ldb     $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
104     - script/autobuild.py pidl    $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
105     - script/autobuild.py replace $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
106     - script/autobuild.py talloc  $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
107     - script/autobuild.py tdb     $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
108     - script/autobuild.py tevent  $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
109
110 samba:
111   extends: .shared_template
112
113 samba-none-env:
114   extends: .shared_template
115
116 samba-nopython:
117   extends: .shared_template
118
119 samba-nopython-py2:
120   extends: .shared_template
121
122 samba-systemkrb5:
123   extends: .shared_template
124
125 samba-xc:
126   extends: .shared_template
127
128 samba-ad-member:
129   extends: .shared_template
130
131 samba-ad-dc-2:
132   extends: .shared_template
133
134 samba-ad-dc-3:
135   extends: .shared_template
136
137 samba-ad-dc-4:
138   extends: .shared_template
139
140 samba-ad-dc-5:
141   extends: .shared_template
142
143 samba-ad-dc-6:
144   extends: .shared_template
145
146 samba-libs:
147   extends: .shared_template
148
149 samba-static:
150   extends: .shared_template
151
152 ctdb:
153   extends: .shared_template
154
155 samba-ctdb:
156   extends: .shared_template
157
158 samba-ad-dc-ntvfs:
159   extends: .shared_template
160
161 .private_template:
162   extends: .shared_template
163   tags:
164     - docker
165     - samba-ci-private
166   only:
167     variables:
168       # These jobs are only run if the gitlab repo has private runners available.
169       # To enable private jobs, you must add the following var and value to
170       # your gitlab repo by navigating to:
171       # settings -> CI/CD -> Environment variables
172       - $SUPPORT_PRIVATE_TEST == "yes"
173
174 samba-ad-dc-backup:
175   extends: .private_template
176
177 samba-fileserver:
178   extends: .private_template
179
180 samba-ad-dc-1:
181   extends: .private_template
182
183 samba-nt4:
184   extends: .private_template
185
186 samba-schemaupgrade:
187   extends: .private_template
188
189 # 'pages' is a special job which can publish artifacts in `public` dir to gitlab pages
190 pages:
191   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
192   stage: report
193   tags:
194     - docker
195     - shared
196   dependencies:  # tell gitlab to download artifacts for these jobs
197     - samba
198     - samba-ad-dc-1
199     - samba-ad-dc-2
200     - samba-ad-dc-3
201     - samba-ad-dc-4
202     - samba-ad-dc-5
203     - samba-ad-dc-6
204     - samba-ad-dc-backup
205     - samba-ad-dc-ntvfs
206     - samba-ad-member
207     - samba-ctdb
208     - samba-fileserver
209     - samba-libs
210     - samba-none-env
211     - samba-nopython
212     - samba-nopython-py2
213     - samba-nt4
214     - samba-schemaupgrade
215     - samba-static
216     - samba-systemkrb5
217     - samba-xc
218     # - ctdb  # TODO
219     - others
220   script:
221     - ./configure.developer
222     - make -j
223     - lcov $(ls *.info | xargs -I{} echo -n "-a {} ") -o all.info
224     - genhtml all.info --output-directory public --prefix=$(pwd) --title "coverage report for $CI_COMMIT_REF_NAME $CI_COMMIT_SHORT_SHA"
225   artifacts:
226     expire_in: 30 days
227     paths:
228       - public
229   only:
230     variables:
231       - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == "--enable-coverage"
232
233 #
234 # We build samba-o3 on all supported distributions
235 #
236
237 .samba-o3-template:
238   extends: .shared_template
239   variables:
240     AUTOBUILD_JOB_NAME: samba-o3
241   only:
242     variables:
243       # do not run o3 for coverage since they are using different images
244       - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == ""
245
246 ubuntu1804-samba-o3:
247   extends: .samba-o3-template
248   image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1804
249
250 ubuntu1604-samba-o3:
251   extends: .samba-o3-template
252   image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1604
253
254 debian9-samba-o3:
255   extends: .samba-o3-template
256   image: $SAMBA_CI_CONTAINER_IMAGE_debian9
257
258 opensuse150-samba-o3:
259   extends: .samba-o3-template
260   image: $SAMBA_CI_CONTAINER_IMAGE_opensuse150
261
262 opensuse151-samba-o3:
263   extends: .samba-o3-template
264   image: $SAMBA_CI_CONTAINER_IMAGE_opensuse151
265
266 centos7-samba-o3:
267   extends: .samba-o3-template
268   image: $SAMBA_CI_CONTAINER_IMAGE_centos7
269   variables:
270     # Git on CentOS doesn't support shallow git cloning
271     GIT_DEPTH: ""
272     # We need a newer GnuTLS version on CentOS7
273     PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
274
275 centos8-samba-o3:
276   extends: .samba-o3-template
277   image: $SAMBA_CI_CONTAINER_IMAGE_centos8
278
279 fedora29-samba-o3:
280   extends: .samba-o3-template
281   image: $SAMBA_CI_CONTAINER_IMAGE_fedora29
282
283 fedora30-samba-o3:
284   extends: .samba-o3-template
285   image: $SAMBA_CI_CONTAINER_IMAGE_fedora30
286
287 #
288 # Keep the samba-o3 sections at the end ...
289 #