.gitlab-ci.yml 5.81 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…)
louiz’'s avatar
louiz’ committed
5
  - external  # Interact with some external service (coverity…)
6

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

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

#
## Build jobs
#

25
.template:basic_build: &basic_build
louiz’'s avatar
louiz’ committed
26
  stage: build
27 28
  tags:
    - docker
louiz’'s avatar
louiz’ committed
29
  script:
30
    - "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
31 32
    - mkdir build/
    - cd build/
33
    - cmake .. -DCMAKE_CXX_FLAGS="-Werror -Wno-psabi" -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3} ${POSTGRESQL}
34
    - make everything -j$(nproc || echo 1)
35 36
    - make coverage_check -j$(nproc || echo 1)
  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 62 63 64 65 66
build:archlinux:
  <<: *basic_build
  only:
    - branches@louiz/biboumi
  tags:
    - armv7l
  artifacts:
    paths: []

67 68 69
build:1:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
70
  <<: *fedora_build
71 72 73

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

build:3:
  variables:
79
    SQLITE3: "-DWITHOUT_SQLITE3=1"
80 81 82
    TEST_POSTGRES_URI: "postgres@postgres/postgres"
  services:
    - postgres:latest
83
  <<: *fedora_build
84 85 86

build:4:
  variables:
87
    SQLITE3: "-DWITHOUT_SQLITE3=1"
88
    POSTGRESQL: "-DWITHOUT_POSTGRESQL=1"
89
    BOTAN: "-DWITHOUT_BOTAN=1"
90
    LIBIDN: "-DWITHOUT_LIBIDN=1"
91
  <<: *fedora_build
92 93 94

build:5:
  variables:
louiz’'s avatar
louiz’ committed
95
    UDNS: "-DWITHOUT_UDNS=1"
96 97 98
    TEST_POSTGRES_URI: "postgres@postgres/postgres"
  services:
    - postgres:latest
99
  <<: *fedora_build
100 101 102 103

build:6:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
louiz’'s avatar
louiz’ committed
104
    UDNS: "-DWITHOUT_UDNS=1"
105
  <<: *fedora_build
106

107
build:without_udns:
108
  variables:
louiz’'s avatar
louiz’ committed
109
    UDNS: "-DWITHOUT_UDNS=1"
110 111
  <<: *fedora_build

112 113 114
#
## Test jobs
#
115 116 117

.template:basic_test: &basic_test
  stage: test
118 119
  tags:
    - docker
120
  script:
louiz’'s avatar
louiz’ committed
121
    - cd build/
122
    - make coverage_e2e -j$(nproc || echo 1)
123
    - make coverage
124
  artifacts:
125
    expire_in: 2 weeks
126
    paths:
127
      - build/coverage_test_suite/
128
      - build/coverage_e2e/
129
      - build/coverage_total/
130
      - build/coverage_e2e.info
louiz’'s avatar
louiz’ committed
131
    when: always
132
    name: $CI_PROJECT_NAME-test-$CI_JOB_ID
133 134

test:debian:
louiz’'s avatar
louiz’ committed
135
  image: docker.louiz.org/louiz/biboumi/test-debian:latest
136
  <<: *basic_test
137 138
  dependencies:
    - build:debian
139 140

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

146
test:without_udns:
louiz’'s avatar
louiz’ committed
147
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
148 149
  <<: *basic_test
  dependencies:
150
    - build:without_udns
151

louiz’'s avatar
louiz’ committed
152
test:alpine:
louiz’'s avatar
louiz’ committed
153
  image: docker.louiz.org/louiz/biboumi/test-alpine:latest
louiz’'s avatar
louiz’ committed
154 155 156 157
  stage: test
  tags:
    - docker
  script:
louiz’'s avatar
louiz’ committed
158
    - cd build/
louiz’'s avatar
louiz’ committed
159 160 161 162
    - make e2e
  dependencies:
    - build:alpine

louiz’'s avatar
louiz’ committed
163
test:freebsd:
164
  only:
165
    - branches@louiz/biboumi
louiz’'s avatar
louiz’ committed
166 167 168 169 170 171
  tags:
    - freebsd
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
  stage: test
  script:
louiz’'s avatar
louiz’ committed
172 173
    - mkdir build/
    - cd build/
174
    - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3}
louiz’'s avatar
louiz’ committed
175 176 177
    - make check
    - make e2e

178 179
coverity:
  stage: external
180
  only:
181
    - branches@louiz/biboumi
182 183
  tags:
    - docker
louiz’'s avatar
louiz’ committed
184
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
185 186
  allow_failure: true
  when: manual
187 188
  script:
    - export PATH=$PATH:~/coverity/bin
louiz’'s avatar
louiz’ committed
189 190
    - mkdir build/
    - cd build/
191
    - cmake .. -DWITHOUT_SYSTEMD=1
192
    - cov-build --dir cov-int   make everything -j$(nproc || echo 1)
193 194
    - 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
195
  dependencies: []
196

louiz’'s avatar
louiz’ committed
197 198 199 200
#
## Packaging jobs
#

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

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

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