summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: 19336ab70389ea6d5489fd24172a7def03644b58 (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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
variables:
  DEBIAN_FRONTEND: noninteractive
  LC_ALL: C
  GIT_STRATEGY: fetch
  DOCKER_DRIVER: overlay2
  GIT_SUBMODULE_STRATEGY: recursive
  DISTROTEST_PRIORITY: 6
  PKGTEST: 0

stages:
  - image
  - build
  - test
  - pkg
  - documentation

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

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

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

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

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

docker:knot-dns:rocky:
  <<: *image
  variables:
    IMAGE_NAME: rocky
    IMAGE_VER: latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_VER
  tags:
    - dind
    - amd64

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

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

.rocky_latest: &rocky_latest
  image: "$CI_REGISTRY/knot/knot-dns/rocky: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_stable_arm64: &debian_stable_arm64
  image: "$CI_REGISTRY/knot/knot-dns/debian-arm64:latest"
  tags:
    - docker
    - linux
    - arm64
  except:
    - schedules

.debian_unstable: &debian_unstable
  image: "$CI_REGISTRY/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 --enable-quic $EXTRA_CONFIGURE || ( cat config.log && exit 1 )
    - make all V=1
  artifacts:
    untracked: true
    expire_in: '1 hour'
  except:
    - schedules

.test: &test_job
  stage: test
  before_script:
    - find -exec touch -t $(date +%m%d%H%M) {} \;
  script:
    - make check V=1
  except:
    - schedules

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

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

build:rocky:amd64:
  <<: *rocky_latest
  <<: *build_job

test:rocky:amd64:
  <<: *rocky_latest
  <<: *test_job
  dependencies:
    - build:rocky:amd64

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

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

build:debian:amd64:
  variables:
    EXTRA_CONFIGURE: --enable-xdp=yes
  <<: *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

build:debian:arm64:
  <<: *debian_stable_arm64
  <<: *build_job

test:debian:arm64:
  <<: *debian_stable_arm64
  <<: *test_job
  dependencies:
    - build:debian:arm64

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
    CFLAGS: "-fsanitize=address -g -O2 -fno-omit-frame-pointer"
    LDFLAGS: "-fsanitize=address"
    LSAN_OPTIONS: verbosity=1:log_threads=1
  allow_failure: true
  <<: *debian_unstable
  <<: *build_job

test:debian:unstable:amd64:asan:
  variables:
    CC: clang
    CFLAGS: "-fsanitize=address -g -O2"
    LDFLAGS: "-fsanitize=address"
    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
    CFLAGS: "-fsanitize=undefined -fno-sanitize=nonnull-attribute -g -O2"
    LDFLAGS: "-fsanitize=undefined"
    UBSAN_OPTIONS: print_stacktrace=1
  allow_failure: true
  <<: *debian_unstable
  <<: *build_job

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

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

pages:
  stage: documentation
  needs:
    - build:archive
  script:
    - mkdir -p public/master
    - mv _build/doc/_build/html public/master/html
    - mv _build/doc/_build/singlehtml public/master/singlehtml
  only:
    - master
  artifacts:
    paths:
      - public

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

# packaging tests using apkg

.apkg_image: &apkg_image
  # apkg images use LC_ALL=C.UTF-8
  variables:
    LC_ALL: C.UTF-8

.pkg_test: &pkg_test
  <<: *apkg_image
  stage: pkg
  needs:
    - pkg:make-archive
  only:
    variables:
      - $PKGTEST == "1"
  artifacts:
    paths:
      - pkg/
    expire_in: '1 week'
  script:
    - python3 -m pip install apkg
    # make sure the archive from pkg:make-archive is available
    - apkg info cache | grep archive/dev
    - apkg install --build-dep
    - apkg test --test-dep

.pkg_test_deb: &pkg_test_deb
  <<: *pkg_test
  before_script:
    - apt update

pkg:make-archive:
  # archive is created once and reused in other pkg jobs
  <<: *apkg_image
  stage: pkg
  needs:
    - build:debian:amd64
  only:
    variables:
      - $PKGTEST == "1"
  image: $CI_REGISTRY/packaging/apkg/test/debian-12
  artifacts:
    paths:
      - pkg/
  before_script:
    - apt update
  script:
    - python3 -m pip install apkg
    - apkg build-dep
    - apkg make-archive

pkg:debian-12:
  <<: *pkg_test_deb
  image: $CI_REGISTRY/packaging/apkg/test/debian-12

pkg:debian-11:
  <<: *pkg_test_deb
  image: $CI_REGISTRY/packaging/apkg/test/debian-11

pkg:ubuntu-24.04:
  <<: *pkg_test_deb
  image: $CI_REGISTRY/packaging/apkg/test/ubuntu-24.04

pkg:ubuntu-22.04:
  <<: *pkg_test_deb
  image: $CI_REGISTRY/packaging/apkg/test/ubuntu-22.04

pkg:ubuntu-20.04:
  <<: *pkg_test_deb
  image: $CI_REGISTRY/packaging/apkg/test/ubuntu-20.04

pkg:fedora-41:
  <<: *pkg_test
  image: $CI_REGISTRY/packaging/apkg/test/fedora-41

pkg:fedora-40:
  <<: *pkg_test
  image: $CI_REGISTRY/packaging/apkg/test/fedora-40

pkg:alma-9:
  <<: *pkg_test
  image: $CI_REGISTRY/packaging/apkg/test/alma-9

pkg:rocky-8:
  <<: *pkg_test
  image: $CI_REGISTRY/packaging/apkg/test/rocky-8

pkg:opensuse-15.6:
  <<: *pkg_test
  image: $CI_REGISTRY/packaging/apkg/test/opensuse-15.6