.gitlab-ci.yml 4.9 KB
Newer Older
1 2 3 4 5 6
variables:
  DEBIAN_FRONTEND: noninteractive
  LC_ALL: C.UTF-8
  GIT_STRATEGY: fetch

stages:
7
  - docker
8 9
  - build
  - test
10
  - documentation
11
  - deploy
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
docker:knot-dns:debian:
  stage: docker
  before_script:
    - docker info
  script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.labs.nic.cz
    - docker build -t "knot-dns/debian:latest" "scripts/docker/debian:latest"
    - docker tag "knot-dns/debian:latest" "registry.labs.nic.cz/knot/knot-dns/debian:latest"
    - docker push "registry.labs.nic.cz/knot/knot-dns/debian:latest"
  tags:
    - shell
    - linux

docker:knot-dns:ubuntu:
  stage: docker
  before_script:
    - docker info
  script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.labs.nic.cz
    - docker build -t "knot-dns/ubuntu:latest" "scripts/docker/ubuntu:latest"
    - docker tag "knot-dns/ubuntu:latest" "registry.labs.nic.cz/knot/knot-dns/ubuntu:latest"
    - docker push "registry.labs.nic.cz/knot/knot-dns/ubuntu:latest"
  tags:
    - shell
    - linux
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

docker:knot-dns:centos:
  stage: docker
  before_script:
    - docker info
  script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.labs.nic.cz
    - docker build -t "knot-dns/centos:latest" "scripts/docker/centos:latest"
    - docker tag "knot-dns/centos:latest" "registry.labs.nic.cz/knot/knot-dns/centos:latest"
    - docker push "registry.labs.nic.cz/knot/knot-dns/centos:latest"
  tags:
    - shell
    - linux

docker:knot-dns:fedora:
  stage: docker
  before_script:
    - docker info
  script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.labs.nic.cz
    - docker build -t "knot-dns/fedora:latest" "scripts/docker/fedora:latest"
    - docker tag "knot-dns/fedora:latest" "registry.labs.nic.cz/knot/knot-dns/fedora:latest"
    - docker push "registry.labs.nic.cz/knot/knot-dns/fedora:latest"
  tags:
    - shell
    - linux

Ondřej Surý's avatar
Ondřej Surý committed
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
.freebsd_i386: &freebsd_i386
  tags:
    - freebsd
    - i386
  only:
    - master
    - triggers
    - tags

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

83
.fedora_latest: &fedora_latest
84
  image: "registry.labs.nic.cz/knot/knot-dns/fedora:latest"
85 86 87 88 89 90
  tags:
    - docker
    - linux
    - amd64

.centos_latest: &centos_latest
91
  image: "registry.labs.nic.cz/knot/knot-dns/centos:latest"
92 93 94 95 96
  tags:
    - docker
    - linux
    - amd64
    
97
.debian_stable: &debian_stable
98
  image: "registry.labs.nic.cz/knot/knot-dns/debian:latest"
99 100 101 102
  tags:
    - docker
    - linux
    - amd64
103

104
.ubuntu_latest: &ubuntu_latest
105
  image: "registry.labs.nic.cz/knot/knot-dns/ubuntu:latest"
106 107 108 109 110 111 112 113
  tags:
    - docker
    - linux
    - amd64

.build: &build_job
  stage: build
  script:
114 115
    - autoreconf -fi
    - ./configure --disable-fastparser
116 117 118
    - make -k all
  artifacts:
    untracked: true
119
    expire_in: '1 hour'
120
    
121 122 123 124 125
.test: &test_job
  stage: test
  script:
    - make -k check

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

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

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

160 161
test:debian:amd64:
  <<: *debian_stable
162 163
  <<: *test_job
  dependencies:
164
    - build:debian:amd64
Ondřej Surý's avatar
Ondřej Surý committed
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184

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
185

186 187
build:archive:
  <<: *debian_stable
188
  stage: build
189 190 191 192 193 194
  script:
    - autoreconf -fi
    - mkdir _build
    - cd _build
    - ../configure
    - make distcheck
195 196 197
  only:
    - tags
    - triggers
198 199 200 201 202 203 204 205 206 207 208 209
  artifacts:
    paths:
      - _build/*.tar.xz

build:documentation:
  <<: *debian_stable
  stage: documentation
  only:
    - tags
    - triggers
  dependencies:
    - build:debian:amd64
210 211 212 213
  script:
    - make -C doc html singlehtml pdf
  artifacts:
    paths:
214 215 216
      - doc/_build/html/
      - doc/_build/singlehtml/
      - doc/_build/latex/knot.pdf
217
    expire_in: '1 hour'
218 219

deploy:documentation:
220
  <<: *debian_stable
221
  stage: deploy
222 223
  dependencies:
    - build:documentation
224 225 226 227
  only:
    - tags
    - triggers
  script:
228 229 230 231
    - "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"
232
  artifacts:
233
    name: "knot-dns-$CI_COMMIT_REF_NAME-doc"
234
    paths:
235 236 237
      - doc/_build/html/
      - doc/_build/singlehtml/
      - doc/_build/latex/knot.pdf