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