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

stages:
  - build
  - test
9
  - documentation
10
  - deploy
11

12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
.freebsd_i386: &freebsd_i386
  tags:
    - freebsd
    - i386
  only:
    - master
    - triggers
    - tags

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

30 31 32 33 34 35 36 37 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
.dnf_build_depends: &dnf_build_depends
  before_script:
    - dnf -y upgrade
    - dnf -y install 'dnf-command(builddep)' -y
    - dnf -y install curl
    - curl -L http://pkgs.fedoraproject.org/cgit/rpms/knot.git/plain/knot.spec -o knot.spec
    - dnf -y builddep knot.spec
    - dnf -y install autoconf automake libtool pkgconfig

.yum_build_depends: &yum_build_depends
  before_script:
    - yum -y upgrade
    - yum -y install epel-release
    - yum -y install curl
    - curl -L http://pkgs.fedoraproject.org/cgit/rpms/knot.git/plain/knot.spec -o knot.spec
    - yum-builddep knot.spec -y
    - yum -y install autoconf automake libtool pkgconfig

.fedora_latest: &fedora_latest
  <<: *dnf_build_depends
  image: fedora:latest
  tags:
    - docker
    - linux
    - amd64

.centos_latest: &centos_latest
  <<: *yum_build_depends
  image: centos:latest
  tags:
    - docker
    - linux
    - amd64
    
.deb_build_depends: &deb_build_depends
65
  before_script:
66
    - sed -i 's/deb\.debian\.org/ftp.cz.debian.org/g;s/archive\.ubuntu\.com/cz.archive.ubuntu.com/g' /etc/apt/sources.list
67 68 69 70 71
    - apt-get -y update
    - apt-get -y dist-upgrade
    - apt-get -y install build-essential
    - apt-get -y install ghostscript python-sphinx texinfo texlive texlive-font-utils texlive-generic-extra texlive-latex-extra
    - apt-get -y install autoconf automake libtool autotools-dev bash-completion bison flex libedit-dev libfstrm-dev libgnutls28-dev libidn2-0-dev liblmdb-dev libprotobuf-c-dev libsystemd-dev libsystemd-dev liburcu-dev pkg-config protobuf-c-compiler
72 73
    
.debian_stable: &debian_stable
74
  <<: *deb_build_depends
75
  image: debian:stable-slim
76 77 78 79
  tags:
    - docker
    - linux
    - amd64
80

81
.ubuntu_latest: &ubuntu_latest
82
  <<: *deb_build_depends
83
  image: ubuntu:latest
84 85 86 87 88 89 90 91
  tags:
    - docker
    - linux
    - amd64

.build: &build_job
  stage: build
  script:
92 93
    - autoreconf -fi
    - ./configure --disable-fastparser
94 95 96
    - make -k all
  artifacts:
    untracked: true
97
    expire_in: '1 hour'
98
    
99 100 101 102 103
.test: &test_job
  stage: test
  script:
    - make -k check

104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
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
    
124
build:ubuntu:amd64:
125
  <<: *ubuntu_latest
126 127 128
  <<: *build_job

test:ubuntu:amd64:
129
  <<: *ubuntu_latest
130 131 132
  <<: *test_job
  dependencies:
    - build:ubuntu:amd64
133

134 135
build:debian:amd64:
  <<: *debian_stable
136 137
  <<: *build_job

138 139
test:debian:amd64:
  <<: *debian_stable
140 141
  <<: *test_job
  dependencies:
142
    - build:debian:amd64
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162

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
163

164 165
build:archive:
  <<: *debian_stable
166
  stage: build
167 168 169 170 171 172
  script:
    - autoreconf -fi
    - mkdir _build
    - cd _build
    - ../configure
    - make distcheck
173 174 175
  only:
    - tags
    - triggers
176 177 178 179 180 181 182 183 184 185 186 187
  artifacts:
    paths:
      - _build/*.tar.xz

build:documentation:
  <<: *debian_stable
  stage: documentation
  only:
    - tags
    - triggers
  dependencies:
    - build:debian:amd64
188 189 190 191
  script:
    - make -C doc html singlehtml pdf
  artifacts:
    paths:
192 193 194
      - doc/_build/html/
      - doc/_build/singlehtml/
      - doc/_build/latex/knot.pdf
195
    expire_in: '1 hour'
196 197

deploy:documentation:
198
  <<: *debian_stable
199
  stage: deploy
200 201
  dependencies:
    - build:documentation
202 203 204 205
  only:
    - tags
    - triggers
  script:
206 207 208 209
    - "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"
210
  artifacts:
211
    name: "knot-dns-$CI_COMMIT_REF_NAME-doc"
212
    paths:
213 214 215
      - doc/_build/html/
      - doc/_build/singlehtml/
      - doc/_build/latex/knot.pdf