.gitlab-ci.yml 5.95 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 26 27 28 29 30 31
    - dind
    
docker:knot-dns:debian:
  <<: *image
  variables:
    IMAGE_NAME: debian:latest
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME
32

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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