.gitlab-ci.yml 7.04 KB
Newer Older
1
stages:
2 3 4 5
  - build     # Build in various conf, keeps the artifacts
  - test      # Use the build artifacts to run the tests
  - packaging # Publish some packages (rpm, deb…)
  - external  # Interact with some external service (codecov, coverity…)
6

louiz’'s avatar
louiz’ committed
7
before_script:
louiz’'s avatar
louiz’ committed
8 9
  - uname -a
  - whoami
louiz’'s avatar
louiz’ committed
10

11 12 13 14
variables:
  COMPILER: "g++"
  BUILD_TYPE: "Debug"
  BOTAN: "-DWITH_BOTAN=1"
louiz’'s avatar
louiz’ committed
15
  UDNS: "-DWITH_UDNS=1"
16 17
  SYSTEMD: "-DWITH_SYSTEMD=1"
  LIBIDN: "-DWITH_LIBIDN=1"
18
  SQLITE3: "-DWITH_SQLITE3=1"
19
  POSTGRESQL: "-WITH_POSTGRESQL=1"
20 21 22 23 24

#
## Build jobs
#

25
.template:basic_build: &basic_build
louiz’'s avatar
louiz’ committed
26
  stage: build
27 28
  tags:
    - docker
louiz’'s avatar
louiz’ committed
29
  script:
30
    - "echo Running cmake with the following parameters: -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3} ${POSTGRESQL}"
louiz’'s avatar
louiz’ committed
31 32
    - mkdir build/
    - cd build/
33
    - cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3} ${POSTGRESQL}
34
    - make everything -j$(nproc || echo 1)
35 36
    - make coverage_check -j$(nproc || echo 1)
  artifacts:
louiz’'s avatar
louiz’ committed
37
    expire_in: 2 weeks
38 39 40 41 42
    paths:
      - build/

.template:fedora_build: &fedora_build
  <<: *basic_build
louiz’'s avatar
louiz’ committed
43
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
44 45 46

.template:debian_build: &debian_build
  <<: *basic_build
louiz’'s avatar
louiz’ committed
47
  image: docker.louiz.org/louiz/biboumi/test-debian:latest
48

louiz’'s avatar
louiz’ committed
49 50 51 52
.template:alpine_build: &alpine_build
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
  <<: *basic_build
louiz’'s avatar
louiz’ committed
53
  image: docker.louiz.org/louiz/biboumi/test-alpine:latest
louiz’'s avatar
louiz’ committed
54

55 56 57 58 59
build:fedora:
  <<: *fedora_build

build:debian:
  <<: *debian_build
60

louiz’'s avatar
louiz’ committed
61 62 63
build:alpine:
  <<: *alpine_build

64 65 66
build:1:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
67
  <<: *fedora_build
68 69 70

build:2:
  variables:
louiz’'s avatar
louiz’ committed
71
    UDNS: "-DWITHOUT_UDNS=1"
72
  <<: *fedora_build
73 74 75

build:3:
  variables:
76
    SQLITE3: "-DWITHOUT_SQLITE3=1"
77 78 79
    TEST_POSTGRES_URI: "postgres@postgres/postgres"
  services:
    - postgres:latest
80
  <<: *fedora_build
81 82 83

build:4:
  variables:
84
    SQLITE3: "-DWITHOUT_SQLITE3=1"
85
    POSTGRESQL: "-DWITHOUT_POSTGRESQL=1"
86
    BOTAN: "-DWITHOUT_BOTAN=1"
87
    LIBIDN: "-DWITHOUT_LIBIDN=1"
88
  <<: *fedora_build
89 90 91

build:5:
  variables:
louiz’'s avatar
louiz’ committed
92
    UDNS: "-DWITHOUT_UDNS=1"
93 94 95
    TEST_POSTGRES_URI: "postgres@postgres/postgres"
  services:
    - postgres:latest
96
  <<: *fedora_build
97 98 99 100

build:6:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
louiz’'s avatar
louiz’ committed
101
    UDNS: "-DWITHOUT_UDNS=1"
102
  <<: *fedora_build
103

104
build:7:
105
  variables:
louiz’'s avatar
louiz’ committed
106
    UDNS: "-DWITHOUT_UDNS=1"
107 108
  <<: *fedora_build

109 110 111
#
## Test jobs
#
112 113 114

.template:basic_test: &basic_test
  stage: test
115 116
  tags:
    - docker
117
  script:
louiz’'s avatar
louiz’ committed
118
    - cd build/
119
    - make coverage_e2e -j$(nproc || echo 1)
120
    - make coverage
121
  artifacts:
122
    expire_in: 2 weeks
123
    paths:
124
      - build/coverage_test_suite/
125
      - build/coverage_e2e/
126
      - build/coverage_total/
127
      - build/coverage_e2e.info
louiz’'s avatar
louiz’ committed
128
    when: always
129
    name: $CI_PROJECT_NAME-test-$CI_JOB_ID
130 131

test:debian:
louiz’'s avatar
louiz’ committed
132
  image: docker.louiz.org/louiz/biboumi/test-debian:latest
133
  <<: *basic_test
134 135
  dependencies:
    - build:debian
136 137

test:fedora:
louiz’'s avatar
louiz’ committed
138
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
139
  <<: *basic_test
140 141
  dependencies:
    - build:fedora
142

143
test:without_udns:
louiz’'s avatar
louiz’ committed
144
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
145 146
  <<: *basic_test
  dependencies:
147
    - build:7
148

louiz’'s avatar
louiz’ committed
149
test:alpine:
louiz’'s avatar
louiz’ committed
150
  image: docker.louiz.org/louiz/biboumi/test-alpine:latest
louiz’'s avatar
louiz’ committed
151 152 153 154
  stage: test
  tags:
    - docker
  script:
louiz’'s avatar
louiz’ committed
155
    - cd build/
louiz’'s avatar
louiz’ committed
156 157 158 159
    - make e2e
  dependencies:
    - build:alpine

louiz’'s avatar
louiz’ committed
160
test:freebsd:
161
  only:
162
    - branches@louiz/biboumi
louiz’'s avatar
louiz’ committed
163 164 165 166 167 168
  tags:
    - freebsd
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
  stage: test
  script:
louiz’'s avatar
louiz’ committed
169 170
    - mkdir build/
    - cd build/
171
    - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3}
louiz’'s avatar
louiz’ committed
172 173 174
    - make check
    - make e2e

175 176 177 178 179 180 181 182
#
## External jobs
#

.template:codecov: &codecov
  stage: external
  tags:
    - docker
louiz’'s avatar
louiz’ committed
183
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
184 185 186 187

.template:codecov_unittests: &codecov_unittests
  <<: *codecov
  script:
188
    - bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -f ./coverage_test_suite.info -F $(echo $CI_JOB_NAME | sed s/:/_/g | sed s/codecov_//)
189 190 191 192

.template:codecov_e2e: &codecov_e2e
  <<: *codecov
  script:
193
    - bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -f ./coverage_e2e.info -F $(echo $CI_JOB_NAME | sed s/:/_/g | sed s/codecov_//)
194 195 196 197 198 199

codecov:fedora:
  <<: *codecov_e2e
  dependencies:
    - test:fedora

200 201 202 203 204
codecov:without_udns:
  <<: *codecov_e2e
  dependencies:
    - test:without_udns

205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
codecov:debian:
  <<: *codecov_e2e
  dependencies:
    - test:debian

codecov:build:1:
  <<: *codecov_unittests
  dependencies:
    - build:1

codecov:build:2:
  <<: *codecov_unittests
  dependencies:
    - build:2

codecov:build:3:
  <<: *codecov_unittests
  dependencies:
    - build:3

codecov:build:4:
  <<: *codecov_unittests
  dependencies:
    - build:4

codecov:build:5:
  <<: *codecov_unittests
  dependencies:
    - build:5

codecov:build:6:
  <<: *codecov_unittests
  dependencies:
    - build:6

codecov:build:7:
  <<: *codecov_unittests
  dependencies:
    - build:7

coverity:
  stage: external
247
  only:
248
    - branches@louiz/biboumi
249 250
  tags:
    - docker
louiz’'s avatar
louiz’ committed
251
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
252 253
  allow_failure: true
  when: manual
254 255
  script:
    - export PATH=$PATH:~/coverity/bin
louiz’'s avatar
louiz’ committed
256 257
    - mkdir build/
    - cd build/
258
    - cmake .. -DWITHOUT_SYSTEMD=1
259
    - cov-build --dir cov-int   make everything -j$(nproc || echo 1)
260 261
    - tar czvf biboumi_coverity.tgz cov-int
    - curl --form token=$COVERITY_TOKEN   --form email=louiz@louiz.org   --form file=@biboumi_coverity.tgz  --form version="$(git rev-parse --short HEAD)" --form description="Automatic submission by gitlab-ci" https://scan.coverity.com/builds?project=louiz%2Fbiboumi
262
  dependencies: []
263

louiz’'s avatar
louiz’ committed
264 265 266 267
#
## Packaging jobs
#

268 269 270 271 272 273
packaging:rpm:
  stage: packaging
  only:
    - master@louiz/biboumi
  tags:
    - docker
louiz’'s avatar
louiz’ committed
274
  allow_failure: true
louiz’'s avatar
louiz’ committed
275
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
276
  script:
louiz’'s avatar
louiz’ committed
277
    - cd build/
278 279 280 281 282 283 284
    - make rpm -j$(nproc || echo 1)
  artifacts:
    paths:
      - build/rpmbuild/RPMS
      - build/rpmbuild/SRPMS
    when: always
    name: $CI_PROJECT_NAME-rpm-$CI_BUILD_ID
285 286
  dependencies:
    - build:fedora
287 288 289 290 291

packaging:deb:
  stage: packaging
  only:
    - master@louiz/biboumi
292
    - debian@louiz/biboumi
293 294
  tags:
    - docker
louiz’'s avatar
louiz’ committed
295
  allow_failure: true
296
  image: docker.louiz.org/louiz/biboumi/packaging-debian:latest
297
  before_script: []
298 299
  script:
    - git checkout debian
300
    - git pull
301 302
    - git merge --no-commit --no-ff master
    - mk-build-deps
303
    - apt update -y
304 305
    - apt install -y ./biboumi-build-deps*.deb
    - debuild -b -us -uc
306 307 308
    - mv ../*.deb .
    - mv ../*.build .
    - mv ../*.buildinfo .
309
  dependencies: []
310
  artifacts:
311
    untracked: true
312
    name: $CI_PROJECT_NAME-deb-$CI_BUILD_ID
313 314 315

packaging:archlinux:
  stage: packaging
316 317
  only:
    - master@louiz/biboumi
318 319
  tags:
    - docker
louiz’'s avatar
louiz’ committed
320
  allow_failure: true
louiz’'s avatar
louiz’ committed
321
  image: docker.louiz.org/louiz/biboumi/test-archlinux:latest
322 323
  before_script: []
  script:
324
    - sudo pacman -Syuu --noconfirm
325 326
    - git clone https://aur.archlinux.org/biboumi-git.git
    - cd biboumi-git
327
    - makepkg -si --noconfirm
328
    - test -e /usr/bin/biboumi
329
  dependencies: []