summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: 353d86d9f736e004f9c96792e35db5f234e8114d (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
variables:
  DEBIAN_FRONTEND: noninteractive
  LC_ALL: C
  GIT_STRATEGY: fetch
  DOCKER_DRIVER: overlay2

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 pull "$IMAGE_TAG" || true
    - docker build --cache-from "$IMAGE_TAG" -t "$IMAGE_TAG" "scripts/docker/$IMAGE_NAME"
    - docker push "$IMAGE_TAG"
  tags:
    - dind
    
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

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

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

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

.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'
    
.test: &test_job
  stage: test
  script:
    - make -k check V=1

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

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

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:
    - tags
    - triggers
  artifacts:
    paths:
      - _build/*.tar.xz

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