.gitlab-ci.yml 7.18 KB
Newer Older
1
stages:
2 3 4
  - build     # Build in various conf, keeps the artifacts
  - test      # Use the build artifacts to run the tests
  - packaging # Publish some packages (rpm, deb…)
5
  - deploy    # Deploy things like the web doc
louiz’'s avatar
louiz’ committed
6
  - external  # Interact with some external service (coverity…)
7

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

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

#
## Build jobs
#

27 28 29 30 31 32 33 34
.sources_changed:
  only:
    changes:
      - "CMakeLists.txt"
      - ".gitlab-ci.yml"
      - "src/**/*"
      - "tests/**/*"

35
.basic_build:
36
  extends: .sources_changed
louiz’'s avatar
louiz’ committed
37
  stage: build
38 39
  tags:
    - docker
louiz’'s avatar
louiz’ committed
40
  script:
41
    - "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
42 43
    - mkdir build/
    - cd build/
louiz’'s avatar
louiz’ committed
44
    - cmake .. -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3} ${POSTGRESQL}
45
    - make everything -j$(nproc || echo 1)
46
  artifacts:
louiz’'s avatar
louiz’ committed
47
    expire_in: 2 weeks
48 49 50
    paths:
      - build/

51 52
.fedora_build:
  extends: .basic_build
louiz’'s avatar
louiz’ committed
53
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
54

55
build:fedora:
56
  extends: .fedora_build
57 58

build:debian:
59
  extends: .basic_build
louiz’'s avatar
louiz’ committed
60
  image: docker.louiz.org/louiz/biboumi/test-debian:latest
61

62
build:alpine:
63
  extends: .basic_build
louiz’'s avatar
louiz’ committed
64 65
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
louiz’'s avatar
louiz’ committed
66
  image: docker.louiz.org/louiz/biboumi/test-alpine:latest
louiz’'s avatar
louiz’ committed
67

louiz’'s avatar
louiz’ committed
68
build:archlinux:
69
  extends: .basic_build
louiz’'s avatar
louiz’ committed
70 71
  only:
    - branches@louiz/biboumi
72
    - schedules
louiz’'s avatar
louiz’ committed
73 74 75 76 77
  tags:
    - armv7l
  artifacts:
    paths: []

louiz’'s avatar
louiz’ committed
78 79 80 81 82 83 84 85
build:freebsd:
  extends: .basic_build
  tags:
    - freebsd
  variables:
    CXX_FLAGS: "-Werror"
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
    GIT_STRATEGY: "clone"
86
    COMPILER: "clang++"
louiz’'s avatar
louiz’ committed
87

louiz’'s avatar
louiz’ committed
88
build:no_botan:
89
  extends: .fedora_build
90 91 92
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"

louiz’'s avatar
louiz’ committed
93
build:no_udns:
94
  extends: .fedora_build
95
  variables:
louiz’'s avatar
louiz’ committed
96
    UDNS: "-DWITHOUT_UDNS=1"
97

louiz’'s avatar
louiz’ committed
98
build:no_libidn:
99
  extends: .fedora_build
100
  variables:
louiz’'s avatar
louiz’ committed
101
    UDNS: "-DWITHOUT_UDNS=1"
102

louiz’'s avatar
louiz’ committed
103
build:no_sqlite3:
104
  extends: .fedora_build
105
  variables:
106
    SQLITE3: "-DWITHOUT_SQLITE3=1"
107 108 109
    TEST_POSTGRES_URI: "postgres@postgres/postgres"
  services:
    - postgres:latest
110

louiz’'s avatar
louiz’ committed
111
build:no_db:
112
  extends: .fedora_build
113
  variables:
louiz’'s avatar
louiz’ committed
114 115
    SQLITE3: "-DWITHOUT_SQLITE3=1"
    POSTGRESQL: "-DWITHOUT_POSTGRESQL=1"
116

louiz’'s avatar
louiz’ committed
117
build:no_db_botan:
118
  extends: .fedora_build
119
  variables:
louiz’'s avatar
louiz’ committed
120 121 122
    SQLITE3: "-DWITHOUT_SQLITE3=1"
    POSTGRESQL: "-DWITHOUT_POSTGRESQL=1"
    BOTAN: "-DWITHOUT_BOTAN=1"
123

124 125 126
#
## Test jobs
#
127

128
.basic_test:
129
  extends: .sources_changed
130
  stage: test
131 132
  tags:
    - docker
133
  script:
louiz’'s avatar
louiz’ committed
134
    - cd build/
135 136
    - make check -j$(nproc || echo 1)
    - make e2e -j$(nproc || echo 1)
137 138

test:debian:
139
  extends: .basic_test
louiz’'s avatar
louiz’ committed
140
  image: docker.louiz.org/louiz/biboumi/test-debian:latest
141 142
  dependencies:
    - build:debian
louiz’'s avatar
louiz’ committed
143
  needs: ["build:debian"]
144 145

test:fedora:
146
  extends: .basic_test
louiz’'s avatar
louiz’ committed
147
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
148 149 150 151 152
  script:
    - cd build/
    - make coverage_check -j$(nproc || echo 1)
    - make coverage_e2e -j$(nproc || echo 1)
    - make coverage
153 154
  dependencies:
    - build:fedora
louiz’'s avatar
louiz’ committed
155
  needs: ["build:fedora"]
156 157 158 159 160 161 162 163 164
  artifacts:
    expire_in: 2 weeks
    paths:
      - build/coverage_test_suite/
      - build/coverage_e2e/
      - build/coverage_total/
      - build/coverage_e2e.info
    when: always
    name: $CI_PROJECT_NAME-test-$CI_JOB_ID
165

louiz’'s avatar
louiz’ committed
166
test:no_udns:
167
  extends: .basic_test
louiz’'s avatar
louiz’ committed
168
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
169
  dependencies:
louiz’'s avatar
louiz’ committed
170
    - build:no_udns
louiz’'s avatar
louiz’ committed
171
  needs: ["build:no_udns"]
172

louiz’'s avatar
louiz’ committed
173
test:alpine:
174
  extends: .basic_test
louiz’'s avatar
louiz’ committed
175
  image: docker.louiz.org/louiz/biboumi/test-alpine:latest
louiz’'s avatar
louiz’ committed
176
  dependencies:
177
    - build:alpine
louiz’'s avatar
louiz’ committed
178
  needs: ["build:alpine"]
179
  image: docker.louiz.org/louiz/biboumi/test-alpine:latest
louiz’'s avatar
louiz’ committed
180

louiz’'s avatar
louiz’ committed
181
test:freebsd:
louiz’'s avatar
louiz’ committed
182
  extends: .basic_test
louiz’'s avatar
louiz’ committed
183 184
  tags:
    - freebsd
louiz’'s avatar
louiz’ committed
185 186
#  only:
#    - branches@louiz/biboumi
louiz’'s avatar
louiz’ committed
187
  script:
louiz’'s avatar
louiz’ committed
188
    - cd build/
louiz’'s avatar
louiz’ committed
189 190
    - make check
    - make e2e
louiz’'s avatar
louiz’ committed
191 192
  dependencies:
    - build:freebsd
louiz’'s avatar
louiz’ committed
193

louiz’'s avatar
louiz’ committed
194 195 196 197
#
## Packaging jobs
#

198 199 200 201 202 203
packaging:rpm:
  stage: packaging
  only:
    - master@louiz/biboumi
  tags:
    - docker
louiz’'s avatar
louiz’ committed
204
  allow_failure: true
louiz’'s avatar
louiz’ committed
205
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
206
  script:
louiz’'s avatar
louiz’ committed
207
    - cd build/
208 209 210 211 212 213 214
    - make rpm -j$(nproc || echo 1)
  artifacts:
    paths:
      - build/rpmbuild/RPMS
      - build/rpmbuild/SRPMS
    when: always
    name: $CI_PROJECT_NAME-rpm-$CI_BUILD_ID
215 216
  dependencies:
    - build:fedora
217 218 219 220 221

packaging:deb:
  stage: packaging
  only:
    - master@louiz/biboumi
222
    - debian@louiz/biboumi
223 224
  tags:
    - docker
louiz’'s avatar
louiz’ committed
225
  allow_failure: true
226
  image: docker.louiz.org/louiz/biboumi/packaging-debian:latest
227
  before_script: []
228 229
  script:
    - git checkout debian
230
    - git pull
231 232
    - git merge --no-commit --no-ff master
    - mk-build-deps
233
    - apt update -y
234 235
    - apt install -y ./biboumi-build-deps*.deb
    - debuild -b -us -uc
236 237 238
    - mv ../*.deb .
    - mv ../*.build .
    - mv ../*.buildinfo .
239
  dependencies: []
240
  artifacts:
241
    untracked: true
242
    name: $CI_PROJECT_NAME-deb-$CI_BUILD_ID
243 244 245

packaging:archlinux:
  stage: packaging
246 247
  only:
    - master@louiz/biboumi
louiz’'s avatar
louiz’ committed
248
    - triggers
249 250
  tags:
    - docker
louiz’'s avatar
louiz’ committed
251
  allow_failure: true
252
  image: docker.louiz.org/louiz/biboumi/packaging-archlinux:latest
253 254
  before_script: []
  script:
255
    - sudo pacman -Syuu --noconfirm
256 257
    - git clone https://aur.archlinux.org/biboumi-git.git
    - cd biboumi-git
258
    - makepkg -si --noconfirm
259
    - test -e /usr/bin/biboumi
260
  dependencies: []
261 262 263 264 265

#
# Deploy jobs
#

266 267 268 269 270 271 272
.doc_changed:
  only:
    changes:
      - "CMakeLists.txt"
      - ".gitlab-ci.yml"
      - "doc/**/*"

273 274 275 276 277
# The jobs with the secure tag need to access directories where important
# files are stored: the latest doc, etc.'
# Other jobs can not access these, otherwise anybody doing a merge request
# could delete the official doc
.deploy:doc:
278
  extends: .doc_changed
279 280 281 282 283
  stage: deploy
  image: docker.louiz.org/louiz/biboumi/doc-builder
  script:
    - cd doc/
    - make html
284 285
    - rm -rf /www/$DOC_DEPLOY_DIR
    - mv _build/html /www/$DOC_DEPLOY_DIR
286
  dependencies: []
287

288 289 290 291 292 293 294 295 296 297 298 299 300
deploy:doc:latest:
  extends: .deploy:doc
  only:
    - master@louiz/biboumi
  tags:
    - www
    - secure
  environment:
    name: doc.latest
    url: https://doc.biboumi.louiz.org
  variables:
    DOC_DEPLOY_DIR: "latest"

louiz’'s avatar
louiz’ committed
301
deploy:doc:tag:
302 303 304
  extends: .deploy:doc
  only:
    - tags
305 306
  tags:
    - www
307
    - secure
308 309 310
  environment:
    name: doc.$CI_COMMIT_TAG
    url: https://doc.biboumi.louiz.org/$CI_COMMIT_TAG/
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
  variables:
    DOC_DEPLOY_DIR: $CI_COMMIT_TAG

deploy:doc:mr:
  extends: .deploy:doc
  only:
    - merge_requests
  tags:
    - www
    - unsecure
  environment:
    name: doc.mr.$CI_MERGE_REQUEST_ID
    url: https://doc.biboumi.louiz.org/mr/$CI_MERGE_REQUEST_ID/
    on_stop: undeploy:doc:mr
  variables:
    DOC_DEPLOY_DIR: $CI_MERGE_REQUEST_ID
327

328
undeploy:doc:mr:
329 330 331
  stage: deploy
  tags:
    - www
332 333 334 335
    - unsecure
  only:
    - merge_requests
  image: docker.louiz.org/louiz/biboumi/doc-builder
336 337
  variables:
    GIT_STRATEGY: none
338
  when: manual
339
  environment:
340
    name: doc.mr.$CI_MERGE_REQUEST_ID
341 342
    action: stop
  script:
343
    - rm -rf /www/$CI_MERGE_REQUEST_ID
344
  dependencies: []