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