.gitlab-ci.yml 5.74 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_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

.template:debian_build: &debian_build
  <<: *basic_build
louiz’'s avatar
louiz’ committed
47
  image: docker.louiz.org/louiz/biboumi/test-debian:latest
48

louiz’'s avatar
louiz’ committed
49 50 51 52
.template:alpine_build: &alpine_build
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
  <<: *basic_build
louiz’'s avatar
louiz’ committed
53
  image: docker.louiz.org/louiz/biboumi/test-alpine:latest
louiz’'s avatar
louiz’ committed
54

55 56 57 58 59
build:fedora:
  <<: *fedora_build

build:debian:
  <<: *debian_build
60

louiz’'s avatar
louiz’ committed
61 62 63
build:alpine:
  <<: *alpine_build

64 65 66
build:1:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
67
  <<: *fedora_build
68 69 70

build:2:
  variables:
louiz’'s avatar
louiz’ committed
71
    UDNS: "-DWITHOUT_UDNS=1"
72
  <<: *fedora_build
73 74 75

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

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

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

build:6:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
louiz’'s avatar
louiz’ committed
101
    UDNS: "-DWITHOUT_UDNS=1"
102
  <<: *fedora_build
103

104
build:7:
105
  variables:
louiz’'s avatar
louiz’ committed
106
    UDNS: "-DWITHOUT_UDNS=1"
107 108
  <<: *fedora_build

109 110 111
#
## Test jobs
#
112 113 114

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

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

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

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

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

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

175 176
coverity:
  stage: external
177
  only:
178
    - branches@louiz/biboumi
179 180
  tags:
    - docker
louiz’'s avatar
louiz’ committed
181
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
182 183
  allow_failure: true
  when: manual
184 185
  script:
    - export PATH=$PATH:~/coverity/bin
louiz’'s avatar
louiz’ committed
186 187
    - mkdir build/
    - cd build/
188
    - cmake .. -DWITHOUT_SYSTEMD=1
189
    - cov-build --dir cov-int   make everything -j$(nproc || echo 1)
190 191
    - 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
192
  dependencies: []
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
248 249
  tags:
    - docker
louiz’'s avatar
louiz’ committed
250
  allow_failure: true
louiz’'s avatar
louiz’ committed
251
  image: docker.louiz.org/louiz/biboumi/test-archlinux:latest
252 253
  before_script: []
  script:
254
    - sudo pacman -Syuu --noconfirm
255 256
    - git clone https://aur.archlinux.org/biboumi-git.git
    - cd biboumi-git
257
    - makepkg -si --noconfirm
258
    - test -e /usr/bin/biboumi
259
  dependencies: []