.gitlab-ci.yml 6.2 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"
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
    - "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
32 33
    - mkdir build/
    - cd build/
34
    - cmake .. -DCMAKE_CXX_FLAGS="-Werror -Wno-psabi" -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3} ${POSTGRESQL}
35
    - make everything -j$(nproc || echo 1)
36
  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 47 48
build:fedora:
  <<: *fedora_build

build:debian:
49
  <<: *basic_build
louiz’'s avatar
louiz’ committed
50
  image: docker.louiz.org/louiz/biboumi/test-debian:latest
51

52
build:alpine:
louiz’'s avatar
louiz’ committed
53 54 55
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
  <<: *basic_build
louiz’'s avatar
louiz’ committed
56
  image: docker.louiz.org/louiz/biboumi/test-alpine:latest
louiz’'s avatar
louiz’ committed
57

louiz’'s avatar
louiz’ committed
58 59 60 61
build:archlinux:
  <<: *basic_build
  only:
    - branches@louiz/biboumi
62
    - triggers
louiz’'s avatar
louiz’ committed
63 64 65 66 67
  tags:
    - armv7l
  artifacts:
    paths: []

louiz’'s avatar
louiz’ committed
68
build:no_botan:
69 70
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
71
  <<: *fedora_build
72

louiz’'s avatar
louiz’ committed
73
build:no_udns:
74
  variables:
louiz’'s avatar
louiz’ committed
75
    UDNS: "-DWITHOUT_UDNS=1"
76
  <<: *fedora_build
77

louiz’'s avatar
louiz’ committed
78
build:no_libidn:
79
  variables:
louiz’'s avatar
louiz’ committed
80
    UDNS: "-DWITHOUT_UDNS=1"
81
  <<: *fedora_build
82

louiz’'s avatar
louiz’ committed
83
build:no_sqlite3:
84
  variables:
85
    SQLITE3: "-DWITHOUT_SQLITE3=1"
86 87 88
    TEST_POSTGRES_URI: "postgres@postgres/postgres"
  services:
    - postgres:latest
89
  <<: *fedora_build
90

louiz’'s avatar
louiz’ committed
91
build:no_db:
92
  variables:
louiz’'s avatar
louiz’ committed
93 94
    SQLITE3: "-DWITHOUT_SQLITE3=1"
    POSTGRESQL: "-DWITHOUT_POSTGRESQL=1"
95
  <<: *fedora_build
96

louiz’'s avatar
louiz’ committed
97
build:no_db_botan:
98
  variables:
louiz’'s avatar
louiz’ committed
99 100 101
    SQLITE3: "-DWITHOUT_SQLITE3=1"
    POSTGRESQL: "-DWITHOUT_POSTGRESQL=1"
    BOTAN: "-DWITHOUT_BOTAN=1"
102 103
  <<: *fedora_build

104 105 106
#
## Test jobs
#
107 108 109

.template:basic_test: &basic_test
  stage: test
110 111
  tags:
    - docker
112
  script:
louiz’'s avatar
louiz’ committed
113
    - cd build/
114 115
    - make check -j$(nproc || echo 1)
    - make e2e -j$(nproc || echo 1)
116 117

test:debian:
louiz’'s avatar
louiz’ committed
118
  image: docker.louiz.org/louiz/biboumi/test-debian:latest
119
  <<: *basic_test
120 121
  dependencies:
    - build:debian
122 123

test:fedora:
louiz’'s avatar
louiz’ committed
124
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
125
  <<: *basic_test
126 127 128 129 130
  script:
    - cd build/
    - make coverage_check -j$(nproc || echo 1)
    - make coverage_e2e -j$(nproc || echo 1)
    - make coverage
131 132
  dependencies:
    - build:fedora
133 134 135 136 137 138 139 140 141
  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
142

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

louiz’'s avatar
louiz’ committed
149
test:alpine:
louiz’'s avatar
louiz’ committed
150
  image: docker.louiz.org/louiz/biboumi/test-alpine:latest
151
  <<: *basic_test
louiz’'s avatar
louiz’ committed
152
  dependencies:
153
    - build:alpine
154
  image: docker.louiz.org/louiz/biboumi/test-alpine:latest
louiz’'s avatar
louiz’ committed
155

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

louiz’'s avatar
louiz’ committed
173 174 175 176
#
## Packaging jobs
#

177 178 179 180 181 182
packaging:rpm:
  stage: packaging
  only:
    - master@louiz/biboumi
  tags:
    - docker
louiz’'s avatar
louiz’ committed
183
  allow_failure: true
louiz’'s avatar
louiz’ committed
184
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
185
  script:
louiz’'s avatar
louiz’ committed
186
    - cd build/
187 188 189 190 191 192 193
    - make rpm -j$(nproc || echo 1)
  artifacts:
    paths:
      - build/rpmbuild/RPMS
      - build/rpmbuild/SRPMS
    when: always
    name: $CI_PROJECT_NAME-rpm-$CI_BUILD_ID
194 195
  dependencies:
    - build:fedora
196 197 198 199 200

packaging:deb:
  stage: packaging
  only:
    - master@louiz/biboumi
201
    - debian@louiz/biboumi
202 203
  tags:
    - docker
louiz’'s avatar
louiz’ committed
204
  allow_failure: true
205
  image: docker.louiz.org/louiz/biboumi/packaging-debian:latest
206
  before_script: []
207 208
  script:
    - git checkout debian
209
    - git pull
210 211
    - git merge --no-commit --no-ff master
    - mk-build-deps
212
    - apt update -y
213 214
    - apt install -y ./biboumi-build-deps*.deb
    - debuild -b -us -uc
215 216 217
    - mv ../*.deb .
    - mv ../*.build .
    - mv ../*.buildinfo .
218
  dependencies: []
219
  artifacts:
220
    untracked: true
221
    name: $CI_PROJECT_NAME-deb-$CI_BUILD_ID
222 223 224

packaging:archlinux:
  stage: packaging
225 226
  only:
    - master@louiz/biboumi
227 228
  tags:
    - docker
louiz’'s avatar
louiz’ committed
229
  allow_failure: true
230
  image: docker.louiz.org/louiz/biboumi/packaging-archlinux:latest
231 232
  before_script: []
  script:
233
    - sudo pacman -Syuu --noconfirm
234 235
    - git clone https://aur.archlinux.org/biboumi-git.git
    - cd biboumi-git
236
    - makepkg -si --noconfirm
237
    - test -e /usr/bin/biboumi
238
  dependencies: []
239 240 241 242 243

#
# Deploy jobs
#

244
deploy_doc:
245 246
  stage: deploy
  only:
247
    - master@louiz/biboumi
248 249
  tags:
    - www
louiz’'s avatar
louiz’ committed
250 251 252
  environment:
    name: doc.latest
    url: https://doc.biboumi.louiz.org
253 254 255 256 257 258 259
  image: docker.louiz.org/louiz/biboumi/doc-builder
  script:
    - cd doc/
    - make html
    - rm -rf /www/latest
    - mv _build/html /www/latest
  dependencies: []
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293

deploy_doc_tag:
  stage: deploy
  only:
    - tags@louiz/biboumi
  tags:
    - www
  environment:
    name: doc.$CI_COMMIT_TAG
    url: https://doc.biboumi.louiz.org/$CI_COMMIT_TAG/
    on_stop: undeploy_doc_tag
  image: docker.louiz.org/louiz/biboumi/doc-builder
  script:
    - cd doc/
    - make html
    - mv _build/html /www/$CI_COMMIT_TAG
  dependencies: []

undeploy_doc_tag:
  stage: deploy
  only:
    - tags@testing/biboumi
  tags:
    - www
  variables:
    GIT_STRATEGY: none
  environment:
    name: doc.$CI_COMMIT_TAG
    action: stop
  image: docker.louiz.org/louiz/biboumi/doc-builder
  script:
    - rm -rf /www/$CI_COMMIT_TAG
  when: manual
  dependencies: []