.gitlab-ci.yml 5.73 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
  - uname -a
9
  - locale
louiz’'s avatar
louiz’ committed
10
  - whoami
11 12
  - mkdir -p build/
  - cd build/
louiz’'s avatar
louiz’ committed
13

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

#
## Build jobs
#

27
.template:basic_build: &basic_build
louiz’'s avatar
louiz’ committed
28
  stage: build
29 30
  tags:
    - docker
louiz’'s avatar
louiz’ committed
31
  script:
louiz’'s avatar
louiz’ committed
32 33
    - "echo Running cmake with the following parameters: -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}"
    - cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}
louiz’'s avatar
louiz’ committed
34
    - make -j$(nproc || echo 1)
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
    - make coverage_check -j$(nproc || echo 1)
  artifacts:
    expire_in: 8 hours
    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

build:fedora:
  <<: *fedora_build

build:debian:
  <<: *debian_build
54 55 56 57

build:1:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
58
  <<: *fedora_build
59 60 61

build:2:
  variables:
louiz’'s avatar
louiz’ committed
62
    UDNS: "-DWITHOUT_UDNS=1"
63
  <<: *fedora_build
64 65 66 67

build:3:
  variables:
    LITESQL: "-DWITHOUT_LITESQL=1"
68
  <<: *fedora_build
69 70 71 72 73

build:4:
  variables:
    LITESQL: "-DWITHOUT_LITESQL=1"
    BOTAN: "-DWITHOUT_BOTAN=1"
74
    LIBIDN: "-DWITHOUT_LIBIDN=1"
75
  <<: *fedora_build
76 77 78 79

build:5:
  variables:
    LITESQL: "-DWITHOUT_LITESQL=1"
louiz’'s avatar
louiz’ committed
80
    UDNS: "-DWITHOUT_UDNS=1"
81
  <<: *fedora_build
82 83 84 85

build:6:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
louiz’'s avatar
louiz’ committed
86
    UDNS: "-DWITHOUT_UDNS=1"
87
  <<: *fedora_build
88

89
build:7:
90
  variables:
louiz’'s avatar
louiz’ committed
91
    UDNS: "-DWITHOUT_UDNS=1"
92 93 94 95 96 97
  <<: *fedora_build


#
## Test jobs
#
98 99 100

.template:basic_test: &basic_test
  stage: test
101 102
  tags:
    - docker
103
  script:
104
    - make coverage_e2e -j$(nproc || echo 1)
105
    - make coverage
106 107
  artifacts:
    paths:
108
      - build/coverage_test_suite/
109
      - build/coverage_e2e/
110
      - build/coverage_total/
111
      - build/coverage_e2e.info
louiz’'s avatar
louiz’ committed
112
    when: always
louiz’'s avatar
louiz’ committed
113
    name: $CI_PROJECT_NAME-test-$CI_BUILD_ID
114 115

test:debian:
116
  image: docker.louiz.org/biboumi-test-debian:latest
117
  <<: *basic_test
118 119
  dependencies:
    - build:debian
120 121

test:fedora:
122
  image: docker.louiz.org/biboumi-test-fedora:latest
123
  <<: *basic_test
124 125
  dependencies:
    - build:fedora
126

127 128 129 130
test:without_udns:
  image: docker.louiz.org/biboumi-test-fedora:latest
  <<: *basic_test
  dependencies:
131
    - build:7
132

louiz’'s avatar
louiz’ committed
133
test:freebsd:
134 135
  only:
    - master@louiz/biboumi
louiz’'s avatar
louiz’ committed
136 137 138 139 140 141
  tags:
    - freebsd
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
  stage: test
  script:
louiz’'s avatar
louiz’ committed
142
    - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}
louiz’'s avatar
louiz’ committed
143
    - make
louiz’'s avatar
louiz’ committed
144 145 146
    - make check
    - make e2e

147 148 149 150 151 152 153 154 155 156 157 158 159
#
## External jobs
#

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

.template:codecov_unittests: &codecov_unittests
  <<: *codecov
  script:
160
    - bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -f ./coverage_test_suite.info -F $(echo $CI_BUILD_NAME | sed s/:/_/g)
161 162 163 164

.template:codecov_e2e: &codecov_e2e
  <<: *codecov
  script:
165
    - bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -f ./coverage_e2e.info -F $(echo $CI_BUILD_NAME | sed s/:/_/g)
166 167 168 169 170 171

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

172 173 174 175 176
codecov:without_udns:
  <<: *codecov_e2e
  dependencies:
    - test:without_udns

177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
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
219 220
  only:
    - master@louiz/biboumi
221 222
  tags:
    - docker
223
  image: docker.louiz.org/biboumi-test-fedora:latest
224 225
  allow_failure: true
  when: manual
226 227 228
  script:
    - export PATH=$PATH:~/coverity/bin
    - cmake .. -DWITHOUT_SYSTEMD=1
louiz’'s avatar
louiz’ committed
229
    - cov-build --dir cov-int   make -j$(nproc || echo 1)
230 231
    - 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
232
  dependencies: []
233

234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
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
249 250
  dependencies:
    - build:fedora
251 252 253 254 255

packaging:deb:
  stage: packaging
  only:
    - master@louiz/biboumi
256
    - debian@louiz/biboumi
257 258 259
  tags:
    - docker
  image: docker.louiz.org/packaging-debian:latest
260
  before_script: []
261 262 263 264
  script:
    - git checkout debian
    - git merge --no-commit --no-ff master
    - mk-build-deps
265
    - apt update -y
266 267
    - apt install -y ./biboumi-build-deps*.deb
    - debuild -b -us -uc
268 269 270
    - mv ../*.deb .
    - mv ../*.build .
    - mv ../*.buildinfo .
271
  dependencies: []
272
  artifacts:
273
    untracked: true
274
    name: $CI_PROJECT_NAME-deb-$CI_BUILD_ID