.gitlab-ci.yml 6.51 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
10 11
  - mkdir -p build/
  - cd build/
louiz’'s avatar
louiz’ committed
12

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

#
## Build jobs
#

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

.template:fedora_build: &fedora_build
  <<: *basic_build
  image: docker.louiz.org/biboumi-test-fedora:latest

.template:debian_build: &debian_build
  <<: *basic_build
  image: docker.louiz.org/biboumi-test-debian:latest

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

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

build:debian:
  <<: *debian_build
59

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

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

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

build:3:
  variables:
75
    SQLITE3: "-DWITHOUT_SQLITE3=1"
76
  <<: *fedora_build
77 78 79

build:4:
  variables:
80
    SQLITE3: "-DWITHOUT_SQLITE3=1"
81
    BOTAN: "-DWITHOUT_BOTAN=1"
82
    LIBIDN: "-DWITHOUT_LIBIDN=1"
83
  <<: *fedora_build
84 85 86

build:5:
  variables:
87
    SQLITE3: "-DWITHOUT_SQLITE3=1"
louiz’'s avatar
louiz’ committed
88
    UDNS: "-DWITHOUT_UDNS=1"
89
  <<: *fedora_build
90 91 92 93

build:6:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
louiz’'s avatar
louiz’ committed
94
    UDNS: "-DWITHOUT_UDNS=1"
95
  <<: *fedora_build
96

97
build:7:
98
  variables:
louiz’'s avatar
louiz’ committed
99
    UDNS: "-DWITHOUT_UDNS=1"
100 101 102 103 104 105
  <<: *fedora_build


#
## Test jobs
#
106 107 108

.template:basic_test: &basic_test
  stage: test
109 110
  tags:
    - docker
111
  script:
112
    - make coverage_e2e -j$(nproc || echo 1)
113
    - make coverage
114
  artifacts:
115
    expire_in: 2 weeks
116
    paths:
117
      - build/coverage_test_suite/
118
      - build/coverage_e2e/
119
      - build/coverage_total/
120
      - build/coverage_e2e.info
louiz’'s avatar
louiz’ committed
121
    when: always
122
    name: $CI_PROJECT_NAME-test-$CI_JOB_ID
123 124

test:debian:
125
  image: docker.louiz.org/biboumi-test-debian:latest
126
  <<: *basic_test
127 128
  dependencies:
    - build:debian
129 130

test:fedora:
131
  image: docker.louiz.org/biboumi-test-fedora:latest
132
  <<: *basic_test
133 134
  dependencies:
    - build:fedora
135

136 137 138 139
test:without_udns:
  image: docker.louiz.org/biboumi-test-fedora:latest
  <<: *basic_test
  dependencies:
140
    - build:7
141

louiz’'s avatar
louiz’ committed
142 143 144 145 146 147 148 149 150 151
test:alpine:
  image: docker.louiz.org/biboumi-test-alpine:latest
  stage: test
  tags:
    - docker
  script:
    - make e2e
  dependencies:
    - build:alpine

louiz’'s avatar
louiz’ committed
152
test:freebsd:
153
  only:
154
    - branches@louiz/biboumi
louiz’'s avatar
louiz’ committed
155 156 157 158 159 160
  tags:
    - freebsd
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
  stage: test
  script:
161
    - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3}
louiz’'s avatar
louiz’ committed
162 163 164
    - make check
    - make e2e

165 166 167 168 169 170 171 172 173 174 175 176 177
#
## External jobs
#

.template:codecov: &codecov
  stage: external
  tags:
    - docker
  image: docker.louiz.org/biboumi-test-fedora:latest

.template:codecov_unittests: &codecov_unittests
  <<: *codecov
  script:
178
    - 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_//)
179 180 181 182

.template:codecov_e2e: &codecov_e2e
  <<: *codecov
  script:
183
    - 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_//)
184 185 186 187 188 189

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

190 191 192 193 194
codecov:without_udns:
  <<: *codecov_e2e
  dependencies:
    - test:without_udns

195 196 197 198 199 200 201 202 203 204 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
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
237
  only:
238
    - branches@louiz/biboumi
239 240
  tags:
    - docker
241
  image: docker.louiz.org/biboumi-test-fedora:latest
242 243
  allow_failure: true
  when: manual
244 245 246
  script:
    - export PATH=$PATH:~/coverity/bin
    - cmake .. -DWITHOUT_SYSTEMD=1
247
    - cov-build --dir cov-int   make everything -j$(nproc || echo 1)
248 249
    - 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
250
  dependencies: []
251

252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
packaging:rpm:
  stage: packaging
  only:
    - master@louiz/biboumi
  tags:
    - docker
  image: docker.louiz.org/biboumi-test-fedora:latest
  script:
    - make rpm -j$(nproc || echo 1)
  artifacts:
    paths:
      - build/rpmbuild/RPMS
      - build/rpmbuild/SRPMS
    when: always
    name: $CI_PROJECT_NAME-rpm-$CI_BUILD_ID
267 268
  dependencies:
    - build:fedora
269 270 271 272 273

packaging:deb:
  stage: packaging
  only:
    - master@louiz/biboumi
274
    - debian@louiz/biboumi
275 276 277
  tags:
    - docker
  image: docker.louiz.org/packaging-debian:latest
278
  before_script: []
279 280 281 282
  script:
    - git checkout debian
    - git merge --no-commit --no-ff master
    - mk-build-deps
283
    - apt update -y
284 285
    - apt install -y ./biboumi-build-deps*.deb
    - debuild -b -us -uc
286 287 288
    - mv ../*.deb .
    - mv ../*.build .
    - mv ../*.buildinfo .
289
  dependencies: []
290
  artifacts:
291
    untracked: true
292
    name: $CI_PROJECT_NAME-deb-$CI_BUILD_ID
293 294 295

packaging:archlinux:
  stage: packaging
296 297
  only:
    - master@louiz/biboumi
298 299 300 301 302
  tags:
    - docker
  image: docker.louiz.org/biboumi-test-archlinux:latest
  before_script: []
  script:
303
    - sudo pacman -Syuu --noconfirm
304 305
    - git clone https://aur.archlinux.org/biboumi-git.git
    - cd biboumi-git
306
    - makepkg -si --noconfirm
307
    - test -e /usr/bin/biboumi
308
  dependencies: []