.gitlab-ci.yml: add var SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE
[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
7 variables:
8   GIT_STRATEGY: fetch
9   GIT_DEPTH: "3"
10   # "--enable-coverage" or ""
11   SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE: ""
12   #
13   # we run autobuild.py inside a samba CI docker image located on gitlab's registry
14   # overwrite this variable if you want use your own image registry.
15   #
16   # Or better ask for access to the shared development repository, see
17   # https://wiki.samba.org/index.php/Samba_CI_on_gitlab#Getting_Access
18   #
19   SAMBA_CI_CONTAINER_REGISTRY: registry.gitlab.com/samba-team/devel/samba
20   #
21   # Set this to the contents of bootstrap/sha1sum.txt
22   # which is generated by bootstrap/template.py --render
23   #
24   SAMBA_CI_CONTAINER_TAG: 1185fa2a316b3bb7e0c24e9fb8279d4c17450809
25   # We use the ubuntu1804 image as default as
26   # it matches what we have on sn-devel-184.
27   SAMBA_CI_CONTAINER_IMAGE: ubuntu1804
28   #
29   # The following images are available
30   # Please see the samba-o3 sections at the end of this file!
31   # We should run that for each available image
32   #
33   SAMBA_CI_CONTAINER_IMAGE_ubuntu1804: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1804:${SAMBA_CI_CONTAINER_TAG}
34   SAMBA_CI_CONTAINER_IMAGE_ubuntu1604: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1604:${SAMBA_CI_CONTAINER_TAG}
35   SAMBA_CI_CONTAINER_IMAGE_debian9: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-debian9:${SAMBA_CI_CONTAINER_TAG}
36   SAMBA_CI_CONTAINER_IMAGE_opensuse150: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-opensuse150:${SAMBA_CI_CONTAINER_TAG}
37   SAMBA_CI_CONTAINER_IMAGE_fedora29: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora29:${SAMBA_CI_CONTAINER_TAG}
38   SAMBA_CI_CONTAINER_IMAGE_centos7: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-centos7:${SAMBA_CI_CONTAINER_TAG}
39
40 include:
41   # The image creation details are specified in a separate file
42   # See bootstrap/README.md for details
43   - 'bootstrap/.gitlab-ci.yml'
44
45 .shared_template:
46   variables:
47     AUTOBUILD_JOB_NAME: $CI_JOB_NAME
48   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
49   stage: build
50   tags:
51     - docker
52     - shared
53   before_script:
54     - uname -a
55     - lsb_release -a
56     - cat /etc/os-release
57     - mount
58     - df -h
59     - cat /proc/swaps
60     - free -h
61       # ld will fail if coverage enabled, force link ld to ld.bfd
62     - if [ -n "$SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE" ]; then sudo ln -sf $(which ld.bfd) $(which ld); fi
63       # See bootstrap/.gitlab-ci.yml how to generate a new image
64     - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
65     - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
66     - bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
67     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
68     - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
69     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
70     - diff -u bootstrap/sha1sum.txt /sha1sum.txt
71   after_script:
72     - mount
73     - df -h
74     - cat /proc/swaps
75     - free -h
76   artifacts:
77     expire_in: 1 week
78     paths:
79       - "*.stdout"
80       - "*.stderr"
81       - "*.info"
82       - system-info.txt
83   retry:
84     max: 2
85     when:
86       - runner_system_failure
87       - stuck_or_timeout_failure
88   script:
89     # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
90     # autobuild name, which means we can define a default template that runs most autobuild jobs
91     - echo "Running cmd script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase"
92     - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE  --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
93
94 others:
95   extends: .shared_template
96   script:
97     - script/autobuild.py ldb     $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
98     - script/autobuild.py pidl    $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
99     - script/autobuild.py replace $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
100     - script/autobuild.py talloc  $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
101     - script/autobuild.py tdb     $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
102     - script/autobuild.py tevent  $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
103
104 samba:
105   extends: .shared_template
106
107 samba-none-env:
108   extends: .shared_template
109
110 samba-nopython:
111   extends: .shared_template
112
113 samba-nopython-py2:
114   extends: .shared_template
115
116 samba-systemkrb5:
117   extends: .shared_template
118
119 samba-xc:
120   extends: .shared_template
121
122 samba-ad-member:
123   extends: .shared_template
124
125 samba-ad-dc-2:
126   extends: .shared_template
127
128 samba-ad-dc-3:
129   extends: .shared_template
130
131 samba-ad-dc-4:
132   extends: .shared_template
133
134 samba-ad-dc-5:
135   extends: .shared_template
136
137 samba-ad-dc-6:
138   extends: .shared_template
139
140 samba-ad-dc-backup:
141   extends: .shared_template
142
143 samba-libs:
144   extends: .shared_template
145
146 samba-static:
147   extends: .shared_template
148
149 ctdb:
150   extends: .shared_template
151
152 samba-ctdb:
153   extends: .shared_template
154
155 samba-ad-dc-ntvfs:
156   extends: .shared_template
157
158 .private_template:
159   extends: .shared_template
160   tags:
161     - docker
162     - samba-ci-private
163   only:
164     variables:
165       # These jobs are only run if the gitlab repo has private runners available.
166       # To enable private jobs, you must add the following var and value to
167       # your gitlab repo by navigating to:
168       # settings -> CI/CD -> Environment variables
169       - $SUPPORT_PRIVATE_TEST == "yes"
170
171 samba-fileserver:
172   extends: .private_template
173
174 samba-ad-dc-1:
175   extends: .private_template
176
177 samba-nt4:
178   extends: .private_template
179
180 samba-schemaupgrade:
181   extends: .private_template
182
183 #
184 # We build samba-o3 on all supported distributions
185 #
186
187 .samba-o3-template:
188   extends: .shared_template
189   variables:
190     AUTOBUILD_JOB_NAME: samba-o3
191
192 ubuntu1804-samba-o3:
193   extends: .samba-o3-template
194   image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1804
195
196 ubuntu1604-samba-o3:
197   extends: .samba-o3-template
198   image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1604
199
200 debian9-samba-o3:
201   extends: .samba-o3-template
202   image: $SAMBA_CI_CONTAINER_IMAGE_debian9
203
204 opensuse150-samba-o3:
205   extends: .samba-o3-template
206   image: $SAMBA_CI_CONTAINER_IMAGE_opensuse150
207
208 centos7-samba-o3:
209   extends: .samba-o3-template
210   image: $SAMBA_CI_CONTAINER_IMAGE_centos7
211   variables:
212     # Git on CentOS doesn't support shallow git cloning
213     GIT_DEPTH: ""
214
215 fedora29-samba-o3:
216   extends: .samba-o3-template
217   image: $SAMBA_CI_CONTAINER_IMAGE_fedora29
218
219 #
220 # Keep the samba-o3 sections at the end ...
221 #