.gitlab-ci.yml 7.3 KB
Newer Older
1 2
variables:
  DEBIAN_FRONTEND: noninteractive
3
  LC_ALL: C
4
  GIT_STRATEGY: fetch
5
  DOCKER_DRIVER: overlay2
6
  GIT_SUBMODULE_STRATEGY: recursive
7 8

stages:
9
  - image
10 11
  - build
  - test
12
  - documentation
13
  - deploy
14

15
.image: &image
16
  stage: image
17 18
  before_script:
    - docker info
19
  script:
20
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
21
    - docker build --no-cache -t "$IMAGE_TAG" "scripts/docker/$IMAGE_NAME"
22
    - docker push "$IMAGE_TAG"
23
  tags:
24
    - dind
25
  only:
Tomas Krizek's avatar
Tomas Krizek committed
26 27
    variables:
      - $SCHEDULE_TYPE == "weekly"
28

29 30 31 32 33
docker:knot-dns:debian:
  <<: *image
  variables:
    IMAGE_NAME: debian:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME
34

35 36 37 38 39 40
docker:knot-dns:debian:unstable:
  <<: *image
  variables:
    IMAGE_NAME: debian:unstable
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME

41
docker:knot-dns:ubuntu:
42 43 44 45
  <<: *image
  variables:
    IMAGE_NAME: ubuntu:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME
46 47

docker:knot-dns:centos:
48 49
  <<: *image
  variables:
Ondřej Surý's avatar
Ondřej Surý committed
50
    IMAGE_NAME: centos:latest
51
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME
52 53

docker:knot-dns:fedora:
54 55 56 57
  <<: *image
  variables:
    IMAGE_NAME: fedora:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME
58

59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
.freebsd_i386: &freebsd_i386
  tags:
    - freebsd
    - i386
  only:
    - master
    - triggers
    - tags

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

77
.fedora_latest: &fedora_latest
78
  image: "$CI_REGISTRY/knot/knot-dns/fedora:latest"
79 80 81 82
  tags:
    - docker
    - linux
    - amd64
83 84 85
  except:
    - schedules

86 87

.centos_latest: &centos_latest
88
  image: "$CI_REGISTRY/knot/knot-dns/centos:latest"
89 90 91 92
  tags:
    - docker
    - linux
    - amd64
93 94 95
  except:
    - schedules

96
.debian_stable: &debian_stable
97
  image: "$CI_REGISTRY/knot/knot-dns/debian:latest"
98 99 100 101
  tags:
    - docker
    - linux
    - amd64
102 103
  except:
    - schedules
104

105 106 107 108 109 110
.debian_unstable: &debian_unstable
  image: "registry.labs.nic.cz/knot/knot-dns/debian:unstable"
  tags:
    - docker
    - linux
    - amd64
111 112
  except:
    - schedules
113

114
.ubuntu_latest: &ubuntu_latest
115
  image: "$CI_REGISTRY/knot/knot-dns/ubuntu:latest"
116 117 118 119
  tags:
    - docker
    - linux
    - amd64
120 121
  except:
    - schedules
122 123 124 125

.build: &build_job
  stage: build
  script:
126
    - autoreconf -fi
127
    - ./configure --disable-fastparser || ( cat config.log && exit 1 )
128
    - make -k all V=1
129 130
  artifacts:
    untracked: true
131
    expire_in: '1 hour'
132 133 134
  except:
    - schedules

135 136 137
.test: &test_job
  stage: test
  script:
138
    - make -k check V=1
139 140
  except:
    - schedules
141

142 143 144 145 146 147 148 149 150 151 152 153 154
.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

155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
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
174

175
build:ubuntu:amd64:
176
  <<: *ubuntu_latest
177 178 179
  <<: *build_job

test:ubuntu:amd64:
180
  <<: *ubuntu_latest
181 182 183
  <<: *test_job
  dependencies:
    - build:ubuntu:amd64
184

185 186
build:debian:amd64:
  <<: *debian_stable
187
  <<: *build_job
188
  except:  # run on schedules as well, for debian:symbols tests
189

190 191
test:debian:amd64:
  <<: *debian_stable
192 193
  <<: *test_job
  dependencies:
194
    - build:debian:amd64
195

196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
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

217 218 219 220 221 222 223 224 225 226
build:debian:unstable:amd64:
  <<: *debian_unstable
  <<: *build_job

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

227 228
build:debian:unstable:amd64:asan:
  variables:
229
    CC: clang-6.0
230
    CFLAGS: "-fsanitize=address -g -O2 -fno-omit-frame-pointer"
231
    LDFLAGS: "-fsanitize=address"
232
    ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
233
    LSAN_OPTIONS: verbosity=1:log_threads=1
234
  allow_failure: true
235 236 237 238 239
  <<: *debian_unstable
  <<: *build_job

test:debian:unstable:amd64:asan:
  variables:
240
    CC: clang-6.0
241
    CFLAGS: "-fsanitize=address -g -O2"
242
    LDFLAGS: "-fsanitize=address"
243
    ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
244
    LSAN_OPTIONS: verbosity=1:log_threads=1
245
  allow_failure: true
246 247 248 249 250 251 252
  <<: *debian_unstable
  <<: *test_job
  dependencies:
    - build:debian:unstable:amd64:asan

build:debian:unstable:amd64:ubsan:
  variables:
253
    CC: clang-6.0
254
    CFLAGS: "-fsanitize=undefined -fno-sanitize=nonnull-attribute -g -O2"
255
    LDFLAGS: "-fsanitize=undefined"
256
    UBSAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
257
    UBSAN_OPTIONS: print_stacktrace=1
258
  allow_failure: true
259 260 261 262 263
  <<: *debian_unstable
  <<: *build_job

test:debian:unstable:amd64:ubsan:
  variables:
264
    CC: clang-6.0
265
    CFLAGS: "-fsanitize=undefined -fno-sanitize=nonnull-attribute -g -O2"
266
    LDFLAGS: "-fsanitize=undefined"
267
    UBSAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
268
    UBSAN_OPTIONS: print_stacktrace=1
269
  allow_failure: true
270 271 272 273 274
  <<: *debian_unstable
  <<: *test_job
  dependencies:
    - build:debian:unstable:amd64:ubsan

275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
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
294

295 296
build:archive:
  <<: *debian_stable
297
  stage: build
298 299 300 301 302
  script:
    - autoreconf -fi
    - mkdir _build
    - cd _build
    - ../configure
303
    - make distcheck V=1
304
  only:
Tomas Krizek's avatar
Tomas Krizek committed
305
    - master
306 307
    - tags
    - triggers
308 309
    - schedules
  except: []
310 311 312 313
  artifacts:
    paths:
      - _build/*.tar.xz

Tomas Krizek's avatar
Tomas Krizek committed
314 315 316 317
obs:devel:
  <<: *debian_stable
  stage: deploy
  only:
Tomas Krizek's avatar
Tomas Krizek committed
318 319
    variables:
      - $SCHEDULE_TYPE == "nightly"
320
  except: []
Tomas Krizek's avatar
Tomas Krizek committed
321 322 323 324 325 326 327 328
  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

329 330 331 332 333 334 335 336
build:documentation:
  <<: *debian_stable
  stage: documentation
  only:
    - tags
    - triggers
  dependencies:
    - build:debian:amd64
337
  script:
338
    - make -C doc html singlehtml pdf V=1
339 340
  artifacts:
    paths:
341 342 343
      - doc/_build/html/
      - doc/_build/singlehtml/
      - doc/_build/latex/knot.pdf
344
    expire_in: '1 hour'
345 346

deploy:documentation:
347
  <<: *debian_stable
348
  stage: deploy
349 350
  dependencies:
    - build:documentation
351 352 353 354
  only:
    - tags
    - triggers
  script:
355 356 357 358
    - "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"
359
  artifacts:
360
    name: "knot-dns-$CI_COMMIT_REF_NAME-doc"
361
    paths:
362 363 364
      - doc/_build/html/
      - doc/_build/singlehtml/
      - doc/_build/latex/knot.pdf