summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: f839c631c964ee2870c8fea82cd383c027529b20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
variables:
  DEBIAN_FRONTEND: noninteractive
  LC_ALL: C
  GIT_STRATEGY: fetch
  DOCKER_DRIVER: overlay2
  GIT_SUBMODULE_STRATEGY: recursive

stages:
  - image
  - build
  - test
  - documentation
  - deploy

.image: &image
  stage: image
  before_script:
    - docker info
  script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
    - docker build --no-cache -t "$IMAGE_TAG" "scripts/docker/$IMAGE_NAME"
    - docker push "$IMAGE_TAG"
  tags:
    - dind
  only:
    variables:
      - $SCHEDULE_TYPE == "weekly"

docker:knot-dns:debian:
  <<: *image
  variables:
    IMAGE_NAME: debian:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME

docker:knot-dns:debian:unstable:
  <<: *image
  variables:
    IMAGE_NAME: debian:unstable
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME

docker:knot-dns:ubuntu:
  <<: *image
  variables:
    IMAGE_NAME: ubuntu:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME

docker:knot-dns:centos:
  <<: *image
  variables:
    IMAGE_NAME: centos:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME

docker:knot-dns:fedora:
  <<: *image
  variables:
    IMAGE_NAME: fedora:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME

.freebsd_i386: &freebsd_i386
  tags:
    - freebsd
    - i386
  only:
    - master
    - triggers
    - tags

.freebsd_amd64: &freebsd_amd64
  tags:
    - freebsd
    - amd64
  only:
    - master
    - triggers
    - tags

.fedora_latest: &fedora_latest
  image: "$CI_REGISTRY/knot/knot-dns/fedora:latest"
  tags:
    - docker
    - linux
    - amd64
  except:
    - schedules


.centos_latest: &centos_latest
  image: "$CI_REGISTRY/knot/knot-dns/centos:latest"
  tags:
    - docker
    - linux
    - amd64
  except:
    - schedules

.debian_stable: &debian_stable
  image: "$CI_REGISTRY/knot/knot-dns/debian:latest"
  tags:
    - docker
    - linux
    - amd64
  except:
    - schedules

.debian_unstable: &debian_unstable
  image: "registry.labs.nic.cz/knot/knot-dns/debian:unstable"
  tags:
    - docker
    - linux
    - amd64
  except:
    - schedules

.ubuntu_latest: &ubuntu_latest
  image: "$CI_REGISTRY/knot/knot-dns/ubuntu:latest"
  tags:
    - docker
    - linux
    - amd64
  except:
    - schedules

.build: &build_job
  stage: build
  script:
    - autoreconf -fi
    - ./configure --disable-fastparser || ( cat config.log && exit 1 )
    - make -k all V=1
  artifacts:
    untracked: true
    expire_in: '1 hour'
  except:
    - schedules

.test: &test_job
  stage: test
  script:
    - make -k check V=1
  except:
    - schedules

.pkg_symbols: &pkg_symbols
  stage: test
  script:
    - ln -s distro/deb debian
    - sed -i "s/__VERSION__/99/g" distro/deb/changelog
    - dpkg-gensymbols -c4 -esrc/.libs/$LIB_NAME.so.$LIB_ABI -P. -p$LIB_NAME$LIB_ABI
  allow_failure: true
  except:
  only:
    - schedules
  dependencies:
    - build:debian:amd64

build:fedora:amd64:
  <<: *fedora_latest
  <<: *build_job

test:fedora:amd64:
  <<: *fedora_latest
  <<: *test_job
  dependencies:
    - build:fedora:amd64

build:centos:amd64:
  <<: *centos_latest
  <<: *build_job

test:centos:amd64:
  <<: *centos_latest
  <<: *test_job
  dependencies:
    - build:centos:amd64

build:ubuntu:amd64:
  <<: *ubuntu_latest
  <<: *build_job

test:ubuntu:amd64:
  <<: *ubuntu_latest
  <<: *test_job
  dependencies:
    - build:ubuntu:amd64

build:debian:amd64:
  <<: *debian_stable
  <<: *build_job
  except:  # run on schedules as well, for debian:symbols tests

test:debian:amd64:
  <<: *debian_stable
  <<: *test_job
  dependencies:
    - build:debian:amd64

pkg:debian:symbols:libknot:
  variables:
    LIB_NAME: libknot
    LIB_ABI: 8
  <<: *debian_stable
  <<: *pkg_symbols

pkg:debian:symbols:libdnssec:
  variables:
    LIB_NAME: libdnssec
    LIB_ABI: 6
  <<: *debian_stable
  <<: *pkg_symbols

pkg:debian:symbols:libzscanner:
  variables:
    LIB_NAME: libzscanner
    LIB_ABI: 2
  <<: *debian_stable
  <<: *pkg_symbols

build:debian:unstable:amd64:
  <<: *debian_unstable
  <<: *build_job

test:debian:unstable:amd64:
  <<: *debian_unstable
  <<: *test_job
  dependencies:
    - build:debian:unstable:amd64

build:debian:unstable:amd64:asan:
  variables:
    CC: clang-6.0
    CFLAGS: "-fsanitize=address -g -O2 -fno-omit-frame-pointer"
    LDFLAGS: "-fsanitize=address"
    ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
    LSAN_OPTIONS: verbosity=1:log_threads=1
  allow_failure: true
  <<: *debian_unstable
  <<: *build_job

test:debian:unstable:amd64:asan:
  variables:
    CC: clang-6.0
    CFLAGS: "-fsanitize=address -g -O2"
    LDFLAGS: "-fsanitize=address"
    ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
    LSAN_OPTIONS: verbosity=1:log_threads=1
  allow_failure: true
  <<: *debian_unstable
  <<: *test_job
  dependencies:
    - build:debian:unstable:amd64:asan

build:debian:unstable:amd64:ubsan:
  variables:
    CC: clang-6.0
    CFLAGS: "-fsanitize=undefined -fno-sanitize=nonnull-attribute -g -O2"
    LDFLAGS: "-fsanitize=undefined"
    UBSAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
    UBSAN_OPTIONS: print_stacktrace=1
  allow_failure: true
  <<: *debian_unstable
  <<: *build_job

test:debian:unstable:amd64:ubsan:
  variables:
    CC: clang-6.0
    CFLAGS: "-fsanitize=undefined -fno-sanitize=nonnull-attribute -g -O2"
    LDFLAGS: "-fsanitize=undefined"
    UBSAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
    UBSAN_OPTIONS: print_stacktrace=1
  allow_failure: true
  <<: *debian_unstable
  <<: *test_job
  dependencies:
    - build:debian:unstable:amd64:ubsan

build:freebsd:i386:
  <<: *freebsd_i386
  <<: *build_job

test:freebsd:i386:
  <<: *freebsd_i386
  <<: *test_job
  dependencies:
    - build:freebsd:i386

build:freebsd:amd64:
  <<: *freebsd_amd64
  <<: *build_job

test:freebsd:amd64:
  <<: *freebsd_amd64
  <<: *test_job
  dependencies:
    - build:freebsd:amd64

build:archive:
  <<: *debian_stable
  stage: build
  script:
    - autoreconf -fi
    - mkdir _build
    - cd _build
    - ../configure
    - make distcheck V=1
  only:
    - master
    - tags
    - triggers
    - schedules
  except: []
  artifacts:
    paths:
      - _build/*.tar.xz

obs:devel:
  <<: *debian_stable
  stage: deploy
  only:
    variables:
      - $SCHEDULE_TYPE == "nightly"
  except: []
  dependencies:
    - build:archive
  script:
    - mv _build/*.tar.xz ./
    - scripts/make-distrofiles.sh
    - echo -e "[general]\napiurl = https://api.opensuse.org\n\n[https://api.opensuse.org]\nuser = CZ-NIC-automation\npass = $OBS_PASSWORD" > /root/.oscrc
    - scripts/build-in-obs.sh knot-dns-devel

build:documentation:
  <<: *debian_stable
  stage: documentation
  only:
    - tags
    - triggers
  dependencies:
    - build:debian:amd64
  script:
    - make -C doc html singlehtml pdf V=1
  artifacts:
    paths:
      - doc/_build/html/
      - doc/_build/singlehtml/
      - doc/_build/latex/knot.pdf
    expire_in: '1 hour'

deploy:documentation:
  <<: *debian_stable
  stage: deploy
  dependencies:
    - build:documentation
  only:
    - tags
    - triggers
  script:
    - "curl --http1.1 --request POST --form token=$WEBSITE_TOKEN --form ref=master
      --form \"variables[RELEASE_CI_BUILD_REF_NAME]=$CI_COMMIT_REF_NAME\"
      --form \"variables[RELEASE_CI_BUILD_ID]=$CI_JOB_ID\"
      https://gitlab.labs.nic.cz/api/v3/projects/5/trigger/builds"
  artifacts:
    name: "knot-dns-$CI_COMMIT_REF_NAME-doc"
    paths:
      - doc/_build/html/
      - doc/_build/singlehtml/
      - doc/_build/latex/knot.pdf