.gitlab-ci.yml 6.57 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
Ondřej Surý's avatar
Ondřej Surý committed
21 22
    - docker pull "$IMAGE_TAG" || true
    - docker build --cache-from "$IMAGE_TAG" -t "$IMAGE_TAG" "scripts/docker/$IMAGE_NAME"
23
    - docker push "$IMAGE_TAG"
24
  tags:
25
    - dind
26 27 28 29
  only:
    - triggers
    - schedules

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

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

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

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

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

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

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

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

87 88

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

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

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

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

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

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

143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
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
162

163
build:ubuntu:amd64:
164
  <<: *ubuntu_latest
165 166 167
  <<: *build_job

test:ubuntu:amd64:
168
  <<: *ubuntu_latest
169 170 171
  <<: *test_job
  dependencies:
    - build:ubuntu:amd64
172

173 174
build:debian:amd64:
  <<: *debian_stable
175 176
  <<: *build_job

177 178
test:debian:amd64:
  <<: *debian_stable
179 180
  <<: *test_job
  dependencies:
181
    - build:debian:amd64
182

183 184 185 186 187 188 189 190 191 192
build:debian:unstable:amd64:
  <<: *debian_unstable
  <<: *build_job

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

193 194
build:debian:unstable:amd64:asan:
  variables:
195
    CC: clang-6.0
196
    CFLAGS: "-fsanitize=address -g -O2 -fno-omit-frame-pointer"
197
    LDFLAGS: "-fsanitize=address"
198
    ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
199
    LSAN_OPTIONS: verbosity=1:log_threads=1
200
  allow_failure: true
201 202 203 204 205
  <<: *debian_unstable
  <<: *build_job

test:debian:unstable:amd64:asan:
  variables:
206
    CC: clang-6.0
207
    CFLAGS: "-fsanitize=address -g -O2"
208
    LDFLAGS: "-fsanitize=address"
209
    ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
210
    LSAN_OPTIONS: verbosity=1:log_threads=1
211
  allow_failure: true
212 213 214 215 216 217 218
  <<: *debian_unstable
  <<: *test_job
  dependencies:
    - build:debian:unstable:amd64:asan

build:debian:unstable:amd64:ubsan:
  variables:
219
    CC: clang-6.0
220
    CFLAGS: "-fsanitize=undefined -fno-sanitize=nonnull-attribute -g -O2"
221
    LDFLAGS: "-fsanitize=undefined"
222
    UBSAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
223
    UBSAN_OPTIONS: print_stacktrace=1
224
  allow_failure: true
225 226 227 228 229
  <<: *debian_unstable
  <<: *build_job

test:debian:unstable:amd64:ubsan:
  variables:
230
    CC: clang-6.0
231
    CFLAGS: "-fsanitize=undefined -fno-sanitize=nonnull-attribute -g -O2"
232
    LDFLAGS: "-fsanitize=undefined"
233
    UBSAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
234
    UBSAN_OPTIONS: print_stacktrace=1
235
  allow_failure: true
236 237 238 239 240
  <<: *debian_unstable
  <<: *test_job
  dependencies:
    - build:debian:unstable:amd64:ubsan

241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
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
260

261 262
build:archive:
  <<: *debian_stable
263
  stage: build
264 265 266 267 268
  script:
    - autoreconf -fi
    - mkdir _build
    - cd _build
    - ../configure
269
    - make distcheck V=1
270
  only:
Tomas Krizek's avatar
Tomas Krizek committed
271
    - master
272 273
    - tags
    - triggers
274 275
    - schedules
  except: []
276 277 278 279
  artifacts:
    paths:
      - _build/*.tar.xz

Tomas Krizek's avatar
Tomas Krizek committed
280 281 282 283 284
obs:devel:
  <<: *debian_stable
  stage: deploy
  only:
    - schedules
285
  except: []
Tomas Krizek's avatar
Tomas Krizek committed
286 287 288 289 290 291 292 293
  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

294 295 296 297 298 299 300 301
build:documentation:
  <<: *debian_stable
  stage: documentation
  only:
    - tags
    - triggers
  dependencies:
    - build:debian:amd64
302
  script:
303
    - make -C doc html singlehtml pdf V=1
304 305
  artifacts:
    paths:
306 307 308
      - doc/_build/html/
      - doc/_build/singlehtml/
      - doc/_build/latex/knot.pdf
309
    expire_in: '1 hour'
310 311

deploy:documentation:
312
  <<: *debian_stable
313
  stage: deploy
314 315
  dependencies:
    - build:documentation
316 317 318 319
  only:
    - tags
    - triggers
  script:
320 321 322 323
    - "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"
324
  artifacts:
325
    name: "knot-dns-$CI_COMMIT_REF_NAME-doc"
326
    paths:
327 328 329
      - doc/_build/html/
      - doc/_build/singlehtml/
      - doc/_build/latex/knot.pdf