.gitlab-ci.yml 5.82 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
build:archlinux:
  <<: *basic_build
  only:
    - branches@louiz/biboumi
62
  when: manual
louiz’'s avatar
louiz’ committed
63 64 65 66 67
  tags:
    - armv7l
  artifacts:
    paths: []

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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