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

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

14
.image: &image
15
  stage: image
16 17
  before_script:
    - docker info
18
  script:
19
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
Ondřej Surý's avatar
Ondřej Surý committed
20 21
    - docker pull "$IMAGE_TAG" || true
    - docker build --cache-from "$IMAGE_TAG" -t "$IMAGE_TAG" "scripts/docker/$IMAGE_NAME"
22
    - docker push "$IMAGE_TAG"
23
  tags:
24 25 26 27 28 29 30
    - dind
    
docker:knot-dns:debian:
  <<: *image
  variables:
    IMAGE_NAME: debian:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME
31

32 33 34 35 36 37
docker:knot-dns:debian:unstable:
  <<: *image
  variables:
    IMAGE_NAME: debian:unstable
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME

38
docker:knot-dns:ubuntu:
39 40 41 42
  <<: *image
  variables:
    IMAGE_NAME: ubuntu:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME
43 44

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

docker:knot-dns:fedora:
51 52 53 54
  <<: *image
  variables:
    IMAGE_NAME: fedora:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME
55

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

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

74
.fedora_latest: &fedora_latest
75
  image: "$CI_REGISTRY/knot/knot-dns/fedora:latest"
76 77 78 79 80 81
  tags:
    - docker
    - linux
    - amd64

.centos_latest: &centos_latest
82
  image: "$CI_REGISTRY/knot/knot-dns/centos:latest"
83 84 85 86 87
  tags:
    - docker
    - linux
    - amd64
    
88
.debian_stable: &debian_stable
89
  image: "$CI_REGISTRY/knot/knot-dns/debian:latest"
90 91 92 93
  tags:
    - docker
    - linux
    - amd64
94

95 96 97 98 99 100 101
.debian_unstable: &debian_unstable
  image: "registry.labs.nic.cz/knot/knot-dns/debian:unstable"
  tags:
    - docker
    - linux
    - amd64

102
.ubuntu_latest: &ubuntu_latest
103
  image: "$CI_REGISTRY/knot/knot-dns/ubuntu:latest"
104 105 106 107 108 109 110 111
  tags:
    - docker
    - linux
    - amd64

.build: &build_job
  stage: build
  script:
112
    - autoreconf -fi
113
    - ./configure --disable-fastparser || ( cat config.log && exit 1 )
114 115 116
    - make -k all
  artifacts:
    untracked: true
117
    expire_in: '1 hour'
118
    
119 120 121 122 123
.test: &test_job
  stage: test
  script:
    - make -k check

124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
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
    
144
build:ubuntu:amd64:
145
  <<: *ubuntu_latest
146 147 148
  <<: *build_job

test:ubuntu:amd64:
149
  <<: *ubuntu_latest
150 151 152
  <<: *test_job
  dependencies:
    - build:ubuntu:amd64
153

154 155
build:debian:amd64:
  <<: *debian_stable
156 157
  <<: *build_job

158 159
test:debian:amd64:
  <<: *debian_stable
160 161
  <<: *test_job
  dependencies:
162
    - build:debian:amd64
163

164 165 166 167 168 169 170 171 172 173
build:debian:unstable:amd64:
  <<: *debian_unstable
  <<: *build_job

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

174 175
build:debian:unstable:amd64:asan:
  variables:
176
    CC: clang-6.0
177
    CFLAGS: "-fsanitize=address -g -O2 -fno-omit-frame-pointer"
178
    LDFLAGS: "-fsanitize=address"
179
    ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
180
    LSAN_OPTIONS: verbosity=1:log_threads=1
181
  allow_failure: true
182 183 184 185 186
  <<: *debian_unstable
  <<: *build_job

test:debian:unstable:amd64:asan:
  variables:
187
    CC: clang-6.0
188
    CFLAGS: "-fsanitize=address -g -O2"
189
    LDFLAGS: "-fsanitize=address"
190
    ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
191
    LSAN_OPTIONS: verbosity=1:log_threads=1
192
  allow_failure: true
193 194 195 196 197 198 199
  <<: *debian_unstable
  <<: *test_job
  dependencies:
    - build:debian:unstable:amd64:asan

build:debian:unstable:amd64:ubsan:
  variables:
200
    CC: clang-6.0
201
    CFLAGS: "-fsanitize=undefined -fno-sanitize=nonnull-attribute -g -O2"
202
    LDFLAGS: "-fsanitize=undefined"
203
    UBSAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
204
    UBSAN_OPTIONS: print_stacktrace=1
205
  allow_failure: true
206 207 208 209 210
  <<: *debian_unstable
  <<: *build_job

test:debian:unstable:amd64:ubsan:
  variables:
211
    CC: clang-6.0
212
    CFLAGS: "-fsanitize=undefined -fno-sanitize=nonnull-attribute -g -O2"
213
    LDFLAGS: "-fsanitize=undefined"
214
    UBSAN_SYMBOLIZER_PATH: /usr/lib/llvm-6.0/bin/llvm-symbolizer
215
    UBSAN_OPTIONS: print_stacktrace=1
216
  allow_failure: true
217 218 219 220 221
  <<: *debian_unstable
  <<: *test_job
  dependencies:
    - build:debian:unstable:amd64:ubsan

222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
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
241

242 243
build:archive:
  <<: *debian_stable
244
  stage: build
245 246 247 248 249 250
  script:
    - autoreconf -fi
    - mkdir _build
    - cd _build
    - ../configure
    - make distcheck
251 252 253
  only:
    - tags
    - triggers
254 255 256 257 258 259 260 261 262 263 264 265
  artifacts:
    paths:
      - _build/*.tar.xz

build:documentation:
  <<: *debian_stable
  stage: documentation
  only:
    - tags
    - triggers
  dependencies:
    - build:debian:amd64
266 267 268 269
  script:
    - make -C doc html singlehtml pdf
  artifacts:
    paths:
270 271 272
      - doc/_build/html/
      - doc/_build/singlehtml/
      - doc/_build/latex/knot.pdf
273
    expire_in: '1 hour'
274 275

deploy:documentation:
276
  <<: *debian_stable
277
  stage: deploy
278 279
  dependencies:
    - build:documentation
280 281 282 283
  only:
    - tags
    - triggers
  script:
284 285 286 287
    - "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"
288
  artifacts:
289
    name: "knot-dns-$CI_COMMIT_REF_NAME-doc"
290
    paths:
291 292 293
      - doc/_build/html/
      - doc/_build/singlehtml/
      - doc/_build/latex/knot.pdf