.gitlab-ci.yml 5.66 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
  tags:
39
    - container
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
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
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"
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
  only:
71
    - schedules
louiz’'s avatar
louiz’ committed
72 73 74 75 76
  tags:
    - armv7l
  artifacts:
    paths: []

77 78 79 80 81 82 83 84 85 86 87 88
build:freebsd:
  extends: .basic_build
  tags:
    - freebsd
  only:
    - branches@louiz/biboumi
  variables:
    CXX_FLAGS: "-Werror"
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
    GIT_STRATEGY: "clone"
    COMPILER: "clang++"

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

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

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

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

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

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

125 126 127
#
## Test jobs
#
128

129
.basic_test:
130
  extends: .sources_changed
131
  stage: test
132 133
  tags:
    - docker
134
  script:
louiz’'s avatar
louiz’ committed
135
    - cd build/
136 137 138
    - make check_junit || true; make check;
    - make e2e
  artifacts:
139 140 141 142 143
    expire_in: 2 weeks
    paths:
      - build/
    name: $CI_PROJECT_NAME-test-$CI_JOB_ID
    when: always
144 145

test:debian:
146
  extends: .basic_test
147
  image: docker.louiz.org/louiz/biboumi/test-debian:latest
148 149
  dependencies:
    - build:debian
louiz’'s avatar
louiz’ committed
150
  needs: ["build:debian"]
151 152

test:fedora:
153
  extends: .basic_test
154
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
155 156
  script:
    - cd build/
157 158
    - make coverage_check
    - make coverage_e2e
159
    - make coverage
160 161
  dependencies:
    - build:fedora
louiz’'s avatar
louiz’ committed
162
  needs: ["build:fedora"]
163

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

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

178 179 180 181 182 183 184 185 186 187
test:freebsd:
  extends: .basic_test
  tags:
    - freebsd
  only:
    - branches@louiz/biboumi
  dependencies:
    - build:freebsd
  needs: ["build:freebsd"]

louiz’'s avatar
louiz’ committed
188 189 190 191
#
## Packaging jobs
#

192 193 194 195 196 197
packaging:rpm:
  stage: packaging
  only:
    - master@louiz/biboumi
  tags:
    - docker
198
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
199
  script:
louiz’'s avatar
louiz’ committed
200
    - cd build/
201 202 203 204 205 206 207
    - make rpm -j$(nproc || echo 1)
  artifacts:
    paths:
      - build/rpmbuild/RPMS
      - build/rpmbuild/SRPMS
    when: always
    name: $CI_PROJECT_NAME-rpm-$CI_BUILD_ID
208 209
  dependencies:
    - build:fedora
210

211 212
packaging:archlinux:
  stage: packaging
213 214
  only:
    - master@louiz/biboumi
215 216
  tags:
    - docker
217
  image: docker.louiz.org/louiz/biboumi/packaging-archlinux:latest
218 219
  before_script: []
  script:
220
    - sudo pacman -Syuu --noconfirm
221 222
    - git clone https://aur.archlinux.org/biboumi-git.git
    - cd biboumi-git
223
    - makepkg -si --noconfirm
224
    - test -e /usr/bin/biboumi
225
  dependencies: []
226 227 228 229 230

#
# Deploy jobs
#

231 232 233 234 235 236 237
.doc_changed:
  only:
    changes:
      - "CMakeLists.txt"
      - ".gitlab-ci.yml"
      - "doc/**/*"

238
# The jobs with the secure tag need to access directories where important
239
# files are stored: the latest doc, etc.
240 241 242
# Other jobs can not access these, otherwise anybody doing a merge request
# could delete the official doc
.deploy:doc:
243
  extends: .doc_changed
244
  stage: deploy
245 246 247 248
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
  tags:
    - www
    - secure
249 250 251
  script:
    - cd doc/
    - make html
252 253
    - rm -rf /www/$DOC_DEPLOY_DIR
    - mv _build/html /www/$DOC_DEPLOY_DIR
254
  dependencies: []
255

256 257 258 259 260 261 262 263 264 265
deploy:doc:latest:
  extends: .deploy:doc
  only:
    - master@louiz/biboumi
  environment:
    name: doc.latest
    url: https://doc.biboumi.louiz.org
  variables:
    DOC_DEPLOY_DIR: "latest"

louiz’'s avatar
louiz’ committed
266
deploy:doc:tag:
267 268 269
  extends: .deploy:doc
  only:
    - tags
270 271 272
  environment:
    name: doc.$CI_COMMIT_TAG
    url: https://doc.biboumi.louiz.org/$CI_COMMIT_TAG/
273 274
  variables:
    DOC_DEPLOY_DIR: $CI_COMMIT_TAG