~singpolyma/biboumi

ref: 1472adfa77f9c3a03967e723d8460f33544b545d biboumi/.gitlab-ci.yml -rw-r--r-- 7.1 KiB
1472adfa — louiz’ Remove a too old joke 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
stages:
  - build     # Build in various conf, keeps the artifacts
  - test      # Use the build artifacts to run the tests
  - packaging # Publish some packages (rpm, deb…)
  - external  # Interact with some external service (codecov, coverity…)

before_script:
  - uname -a
  - whoami
  - mkdir -p build/
  - cd build/
  # When we extract the artifacts from a previous build, the timestamp of all target are identicall to
  # the timestamps of the generated source files (like biboumi.h, etc), so Makefile thinks the targets
  # are not up to date, and everything is rebuilt.  We change the modification time of all these files
  # to be 15 minutes older, to avoid any unnecessary building.
  - find . \( -name \*.hpp -or -name \*.h -or -name \*.cpp \) -exec touch -r {} -d '-15 minute' {} \;

variables:
  COMPILER: "g++"
  BUILD_TYPE: "Debug"
  BOTAN: "-DWITH_BOTAN=1"
  UDNS: "-DWITH_UDNS=1"
  SYSTEMD: "-DWITH_SYSTEMD=1"
  LIBIDN: "-DWITH_LIBIDN=1"
  LITESQL: "-DWITH_LITESQL=1"

#
## Build jobs
#

.template:basic_build: &basic_build
  stage: build
  tags:
    - docker
  script:
    - "echo Running cmake with the following parameters: -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}"
    - cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}
    - make everything -j$(nproc || echo 1)
    - make coverage_check -j$(nproc || echo 1)
  artifacts:
    expire_in: 8 hours
    paths:
      - build/

.template:fedora_build: &fedora_build
  <<: *basic_build
  image: docker.louiz.org/biboumi-test-fedora:latest

.template:debian_build: &debian_build
  <<: *basic_build
  image: docker.louiz.org/biboumi-test-debian:latest

.template:alpine_build: &alpine_build
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
  <<: *basic_build
  image: docker.louiz.org/biboumi-test-alpine:latest

build:fedora:
  <<: *fedora_build

build:debian:
  <<: *debian_build

build:alpine:
  <<: *alpine_build

build:1:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
  <<: *fedora_build

build:2:
  variables:
    UDNS: "-DWITHOUT_UDNS=1"
  <<: *fedora_build

build:3:
  variables:
    LITESQL: "-DWITHOUT_LITESQL=1"
  <<: *fedora_build

build:4:
  variables:
    LITESQL: "-DWITHOUT_LITESQL=1"
    BOTAN: "-DWITHOUT_BOTAN=1"
    LIBIDN: "-DWITHOUT_LIBIDN=1"
  <<: *fedora_build

build:5:
  variables:
    LITESQL: "-DWITHOUT_LITESQL=1"
    UDNS: "-DWITHOUT_UDNS=1"
  <<: *fedora_build

build:6:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
    UDNS: "-DWITHOUT_UDNS=1"
  <<: *fedora_build

build:7:
  variables:
    UDNS: "-DWITHOUT_UDNS=1"
  <<: *fedora_build


#
## Test jobs
#

.template:basic_test: &basic_test
  stage: test
  tags:
    - docker
  script:
    - make coverage_e2e -j$(nproc || echo 1)
    - make coverage
  artifacts:
    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

test:debian:
  image: docker.louiz.org/biboumi-test-debian:latest
  <<: *basic_test
  dependencies:
    - build:debian

test:fedora:
  image: docker.louiz.org/biboumi-test-fedora:latest
  <<: *basic_test
  dependencies:
    - build:fedora

test:without_udns:
  image: docker.louiz.org/biboumi-test-fedora:latest
  <<: *basic_test
  dependencies:
    - build:7

test:alpine:
  image: docker.louiz.org/biboumi-test-alpine:latest
  stage: test
  tags:
    - docker
  script:
    - make e2e
  dependencies:
    - build:alpine

test:freebsd:
  only:
    - master@louiz/biboumi
  tags:
    - freebsd
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
  stage: test
  script:
    - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}
    - make check
    - make e2e

#
## External jobs
#

.template:codecov: &codecov
  stage: external
  tags:
    - docker
  image: docker.louiz.org/biboumi-test-fedora:latest

.template:codecov_unittests: &codecov_unittests
  <<: *codecov
  script:
    - bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -f ./coverage_test_suite.info -F $(echo $CI_JOB_NAME | sed s/:/_/g)

.template:codecov_e2e: &codecov_e2e
  <<: *codecov
  script:
    - bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -f ./coverage_e2e.info -F $(echo $CI_JOB_NAME | sed s/:/_/g | sed s/codecov_//)

codecov:fedora:
  <<: *codecov_e2e
  dependencies:
    - test:fedora

codecov:without_udns:
  <<: *codecov_e2e
  dependencies:
    - test:without_udns

codecov:debian:
  <<: *codecov_e2e
  dependencies:
    - test:debian

codecov:build:1:
  <<: *codecov_unittests
  dependencies:
    - build:1

codecov:build:2:
  <<: *codecov_unittests
  dependencies:
    - build:2

codecov:build:3:
  <<: *codecov_unittests
  dependencies:
    - build:3

codecov:build:4:
  <<: *codecov_unittests
  dependencies:
    - build:4

codecov:build:5:
  <<: *codecov_unittests
  dependencies:
    - build:5

codecov:build:6:
  <<: *codecov_unittests
  dependencies:
    - build:6

codecov:build:7:
  <<: *codecov_unittests
  dependencies:
    - build:7

coverity:
  stage: external
  only:
    - master@louiz/biboumi
  tags:
    - docker
  image: docker.louiz.org/biboumi-test-fedora:latest
  allow_failure: true
  when: manual
  script:
    - export PATH=$PATH:~/coverity/bin
    - cmake .. -DWITHOUT_SYSTEMD=1
    - cov-build --dir cov-int   make everything -j$(nproc || echo 1)
    - 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
  dependencies: []

packaging:rpm:
  stage: packaging
  only:
    - master@louiz/biboumi
  tags:
    - docker
  image: docker.louiz.org/biboumi-test-fedora:latest
  script:
    - make rpm -j$(nproc || echo 1)
  artifacts:
    paths:
      - build/rpmbuild/RPMS
      - build/rpmbuild/SRPMS
    when: always
    name: $CI_PROJECT_NAME-rpm-$CI_BUILD_ID
  dependencies:
    - build:fedora

packaging:deb:
  stage: packaging
  only:
    - master@louiz/biboumi
    - debian@louiz/biboumi
  tags:
    - docker
  image: docker.louiz.org/packaging-debian:latest
  before_script: []
  script:
    - git checkout debian
    - git merge --no-commit --no-ff master
    - mk-build-deps
    - apt update -y
    - apt install -y ./biboumi-build-deps*.deb
    - debuild -b -us -uc
    - mv ../*.deb .
    - mv ../*.build .
    - mv ../*.buildinfo .
  dependencies: []
  artifacts:
    untracked: true
    name: $CI_PROJECT_NAME-deb-$CI_BUILD_ID

packaging:archlinux:
  stage: packaging
  tags:
    - docker
  image: docker.louiz.org/biboumi-test-archlinux:latest
  before_script: []
  script:
    - sudo pacman -Syuu --noconfirm
    - git clone https://aur.archlinux.org/litesql-git.git
    - cd litesql-git
    - makepkg --noconfirm -s && makepkg -f && sudo pacman --noconfirm -U *.pkg.*
    - cd ..
    - git clone https://aur.archlinux.org/biboumi-git.git
    - cd biboumi-git
    - makepkg --noconfirm -s && makepkg -f && sudo pacman --noconfirm -U *.pkg.*
  dependencies: []