selftest: Create instructions for generating skip file entries
[Samba.git] / .gitlab-ci.yml
blobef44a3d9d899076d42635f97d9592cebafefd190
1 # see https://docs.gitlab.com/ce/ci/yaml/README.html for all available options
3 stages:
4   - images
5   - build
6   - report
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: c6ee634a9467e84ee8dd858b0b363f7a75973a66
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_ubuntu1604: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1604:${SAMBA_CI_CONTAINER_TAG}
37   SAMBA_CI_CONTAINER_IMAGE_ubuntu1804: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1804:${SAMBA_CI_CONTAINER_TAG}
38   SAMBA_CI_CONTAINER_IMAGE_ubuntu2004: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu2004:${SAMBA_CI_CONTAINER_TAG}
39   SAMBA_CI_CONTAINER_IMAGE_debian9: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-debian9:${SAMBA_CI_CONTAINER_TAG}
40   SAMBA_CI_CONTAINER_IMAGE_debian10: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-debian10:${SAMBA_CI_CONTAINER_TAG}
41   SAMBA_CI_CONTAINER_IMAGE_opensuse150: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-opensuse150:${SAMBA_CI_CONTAINER_TAG}
42   SAMBA_CI_CONTAINER_IMAGE_opensuse151: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-opensuse151:${SAMBA_CI_CONTAINER_TAG}
43   SAMBA_CI_CONTAINER_IMAGE_fedora31: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora31:${SAMBA_CI_CONTAINER_TAG}
44   SAMBA_CI_CONTAINER_IMAGE_fedora32: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-fedora32:${SAMBA_CI_CONTAINER_TAG}
45   SAMBA_CI_CONTAINER_IMAGE_centos7: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-centos7:${SAMBA_CI_CONTAINER_TAG}
46   SAMBA_CI_CONTAINER_IMAGE_centos8: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-centos8:${SAMBA_CI_CONTAINER_TAG}
48 include:
49   # The image creation details are specified in a separate file
50   # See bootstrap/README.md for details
51   - 'bootstrap/.gitlab-ci.yml'
53 .shared_template:
54   variables:
55     AUTOBUILD_JOB_NAME: $CI_JOB_NAME
56   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
57   stage: build
58   tags:
59     - docker
60     - shared
61   cache:
62     key: ccache.${CI_JOB_NAME}
63     paths:
64       - ccache
65   before_script:
66     - uname -a
67     - lsb_release -a
68     - cat /etc/os-release
69     - mount
70     - df -h
71     - cat /proc/swaps
72     - free -h
73       # ld will fail if coverage enabled, force link ld to ld.bfd
74     - if [ -n "$SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE" ]; then sudo ln -sf $(which ld.bfd) $(which ld); fi
75       # See bootstrap/.gitlab-ci.yml how to generate a new image
76     - echo "SAMBA_CI_CONTAINER_REGISTRY[${SAMBA_CI_CONTAINER_REGISTRY}]"
77     - echo "SAMBA_CI_CONTAINER_TAG[${SAMBA_CI_CONTAINER_TAG}]"
78     - bootstrap/template.py --sha1sum > /tmp/sha1sum-template.txt
79     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
80     - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
81     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
82     - diff -u bootstrap/sha1sum.txt /sha1sum.txt
83     - export CCACHE_BASEDIR="${PWD}"
84     - export CCACHE_DIR="${PWD}/ccache" && mkdir -pv "$CCACHE_DIR"
85     - export CC="ccache cc"
86     - export CXX="ccache c++"
87     - ccache -z -M 500M
88     - ccache -s
89   after_script:
90     - mount
91     - df -h
92     - cat /proc/swaps
93     - free -h
94     - CCACHE_BASEDIR="${PWD}" CCACHE_DIR="${PWD}/ccache" ccache -s -c
95   artifacts:
96     expire_in: 1 week
97     paths:
98       - "*.stdout"
99       - "*.stderr"
100       - "*.info"
101       - system-info.txt
102   retry:
103     max: 2
104     when:
105       - runner_system_failure
106       - stuck_or_timeout_failure
107   script:
108     # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
109     # autobuild name, which means we can define a default template that runs most autobuild jobs
110     - echo "Running cmd script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase"
111     - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE  --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
113 # Ensure when adding a new job below that you also add it to
114 # the dependencies for 'pages' below for the code coverage page
115 # generation.
117 others:
118   extends: .shared_template
119   script:
120     - script/autobuild.py ldb      $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
121     - script/autobuild.py pidl     $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
122     - script/autobuild.py replace  $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
123     - script/autobuild.py talloc   $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
124     - script/autobuild.py tdb      $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
125     - script/autobuild.py tevent   $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
126     - script/autobuild.py samba-xc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
128 samba:
129   extends: .shared_template
131 samba-mitkrb5:
132   extends: .shared_template
134 samba-nopython:
135   extends: .shared_template
137 samba-nopython-py2:
138   extends: .shared_template
140 samba-admem:
141   extends: .shared_template
143 samba-ad-dc-2:
144   extends: .shared_template
146 samba-ad-dc-3:
147   extends: .shared_template
149 samba-ad-dc-4:
150   extends: .shared_template
152 samba-ad-dc-5:
153   extends: .shared_template
155 samba-ad-dc-6:
156   extends: .shared_template
158 samba-libs:
159   extends: .shared_template
161 samba-static:
162   extends: .shared_template
164 samba-fuzz:
165   extends: .shared_template
166   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-ubuntu1604:${SAMBA_CI_CONTAINER_TAG}
168 ctdb:
169   extends: .shared_template
171 samba-ctdb:
172   extends: .shared_template
174 samba-ad-dc-ntvfs:
175   extends: .shared_template
177 samba-admem-mit:
178   extends: .shared_template
180 samba-ad-dc-4-mitkrb5:
181   extends: .shared_template
183 .private_template:
184   extends: .shared_template
185   tags:
186     - docker
187     - samba-ci-private
188   only:
189     variables:
190       # These jobs are only run if the gitlab repo has private runners available.
191       # To enable private jobs, you must add the following var and value to
192       # your gitlab repo by navigating to:
193       # settings -> CI/CD -> Environment variables
194       - $SUPPORT_PRIVATE_TEST == "yes"
196 samba-ad-dc-backup:
197   extends: .private_template
199 samba-fileserver:
200   extends: .private_template
202 samba-ad-dc-1:
203   extends: .private_template
205 samba-nt4:
206   extends: .private_template
208 samba-schemaupgrade:
209   extends: .private_template
211 samba-ad-dc-1-mitkrb5:
212   extends: .private_template
214 # 'pages' is a special job which can publish artifacts in `public` dir to gitlab pages
215 pages:
216   image: ${SAMBA_CI_CONTAINER_REGISTRY}/samba-ci-${SAMBA_CI_CONTAINER_IMAGE}:${SAMBA_CI_CONTAINER_TAG}
217   stage: report
218   tags:
219     - docker
220     - shared
221   dependencies:  # tell gitlab to download artifacts for these jobs
222     - others
223     - samba
224     - samba-mitkrb5
225     - samba-nopython
226     - samba-nopython-py2
227     - samba-admem
228     - samba-ad-dc-2
229     - samba-ad-dc-3
230     - samba-ad-dc-4
231     - samba-ad-dc-5
232     - samba-ad-dc-6
233     - samba-libs
234     - samba-static
235     - samba-fuzz
236     # - ctdb  # TODO
237     - samba-ctdb
238     - samba-ad-dc-ntvfs
239     - samba-admem-mit
240     - samba-ad-dc-4-mitkrb5
241     - samba-ad-dc-backup
242     - samba-fileserver
243     - samba-ad-dc-1
244     - samba-nt4
245     - samba-schemaupgrade
246     - samba-ad-dc-1-mitkrb5
247   script:
248     - ./configure.developer
249     - make -j
250     - lcov $(ls *.info | xargs -I{} echo -n "-a {} ") -o all.info
251     - genhtml all.info --output-directory public --prefix=$(pwd) --title "coverage report for $CI_COMMIT_REF_NAME $CI_COMMIT_SHORT_SHA"
252   artifacts:
253     expire_in: 30 days
254     paths:
255       - public
256   only:
257     variables:
258       - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == "--enable-coverage"
261 # We build samba-o3 on all supported distributions
264 .samba-o3-template:
265   extends: .shared_template
266   variables:
267     AUTOBUILD_JOB_NAME: samba-o3
268   only:
269     variables:
270       # do not run o3 for coverage since they are using different images
271       - $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE == ""
273 ubuntu1804-samba-o3:
274   extends: .samba-o3-template
275   image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu1804
277 ubuntu2004-samba-o3:
278   extends: .samba-o3-template
279   image: $SAMBA_CI_CONTAINER_IMAGE_ubuntu2004
281 debian10-samba-o3:
282   extends: .samba-o3-template
283   image: $SAMBA_CI_CONTAINER_IMAGE_debian10
285 opensuse150-samba-o3:
286   extends: .samba-o3-template
287   image: $SAMBA_CI_CONTAINER_IMAGE_opensuse150
289 opensuse151-samba-o3:
290   extends: .samba-o3-template
291   image: $SAMBA_CI_CONTAINER_IMAGE_opensuse151
293 centos7-samba-o3:
294   extends: .samba-o3-template
295   image: $SAMBA_CI_CONTAINER_IMAGE_centos7
296   variables:
297     # Git on CentOS doesn't support shallow git cloning
298     GIT_DEPTH: ""
299     # We need a newer GnuTLS version on CentOS7
300     PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
302 centos8-samba-o3:
303   extends: .samba-o3-template
304   image: $SAMBA_CI_CONTAINER_IMAGE_centos8
306 fedora31-samba-o3:
307   extends: .samba-o3-template
308   image: $SAMBA_CI_CONTAINER_IMAGE_fedora31
310 fedora32-samba-o3:
311   extends: .samba-o3-template
312   image: $SAMBA_CI_CONTAINER_IMAGE_fedora32
315 # Keep the samba-o3 sections at the end ...