-
Notifications
You must be signed in to change notification settings - Fork 74
/
job-linux.yml
414 lines (385 loc) · 15 KB
/
job-linux.yml
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
#################################################
# Global
#################################################
.set-max-jobs: &set-max-jobs
- |
case "$CMAKE_GENERATOR" in
'Unix Makefiles')
export CMAKE_BUILD_PARALLEL_LEVEL=$MAKEFILE_JOBS ;;
'Ninja')
export CMAKE_BUILD_PARALLEL_LEVEL=$NINJA_JOBS ;;
*)
export CMAKE_BUILD_PARALLEL_LEVEL=1 ;;
esac
echo "CMAKE_BUILD_PARALLEL_LEVEL='$CMAKE_BUILD_PARALLEL_LEVEL'"
.linux-ccache:
cache:
key: $CI_JOB_NAME
paths:
- ccache/
before_script:
- git submodule foreach --recursive git fetch --tags --force
- "[[ -f /opt/rh/devtoolset-8/enable ]] && source /opt/rh/devtoolset-8/enable"
- mkdir -p ccache
- echo "max_size = $CCACHE_SIZE" > ccache/ccache.conf
- export CCACHE_BASEDIR=${PWD}
- export CCACHE_DIR=${PWD}/ccache
- ccache -s
after_script:
- export CCACHE_DIR=${PWD}/ccache
- ccache -s
.job-linux-build:
stage: build 🏗
tags: [ "docker" ]
extends: .linux-ccache
script:
- *set-max-jobs
- mkdir work && cd work
- cmake -G "$CMAKE_GENERATOR" $DEFAULT_CMAKE_OPTIONS -DCMAKE_INSTALL_PREFIX="$PWD/../OUTPUT" $CMAKE_OPTIONS ..
- cmake --build .
# Files required by the flexisip_tester bin
.tester-artifacts:
artifacts:
paths:
- work/bin/flexisip_tester
- work/lib{,64}/
- "**grammar"
- tester/cert
- tester/config
- tester/images
- tester/scripts
- tester/sounds
#################################################
# RPM
#################################################
.job-linux-rpm:
stage: package 📦
tags: [ "docker" ]
extends:
- .rules-default # ⚠ See `rules.yml`
variables:
CMAKE_GENERATOR: 'Ninja'
script:
- "[[ -f /opt/rh/devtoolset-8/enable ]] && source /opt/rh/devtoolset-8/enable"
- *set-max-jobs
- mkdir build && cd build
- cmake -G $CMAKE_GENERATOR $DEFAULT_PACKAGING_CMAKE_OPTIONS $CMAKE_OPTIONS -DCPACK_GENERATOR=RPM ..
- cmake --build . --target package
artifacts:
paths:
- build/*.rpm
- .gitlab-ci-files/deploy.sh
when: always
expire_in: 1 week
.job-rpm-deploy:
stage: deploy 🚀
tags: [ "deploy" ]
extends: .rules-deploy # ⚠ See `rules.yml`
variables:
# Do not clone, only use artifacts (TODO 'none' doesn't clean, we are using 'fetch' until we find a way)
GIT_STRATEGY: fetch
script: ./.gitlab-ci-files/deploy.sh ${DISTRIB}
#################################################
# DEB
#################################################
.job-linux-deb:
stage: package 📦
tags: [ "docker" ]
extends:
- .rules-default # ⚠ See `rules.yml`
variables:
CMAKE_GENERATOR: 'Ninja'
script:
- *set-max-jobs
- mkdir build && cd build
- cmake -G $CMAKE_GENERATOR $DEFAULT_PACKAGING_CMAKE_OPTIONS $CMAKE_OPTIONS -DCPACK_GENERATOR=DEB ..
- cmake --build . --target package
artifacts:
paths:
- build/*.deb
- build/*.ddeb
when: always
expire_in: 1 week
.job-debian-deb-deploy:
stage: deploy 🚀
tags: [ "deploy" ]
extends: .rules-deploy # ⚠ See `rules.yml`
variables:
# Do not clone, only use artifacts (TODO 'none' doesn't clean, we are using 'fetch' until we find a way)
GIT_STRATEGY: fetch
script: ./.gitlab-ci-files/deploy.sh debian
#################################################
# DOCKER
#################################################
.job-flexisip-image-deploy:
stage: image
tags: [ "linux-deploy" ]
extends: .rules-deploy # ⚠ See `rules.yml`
script:
- mkdir -p docker/DEBS && mv build/*.{deb,ddeb} docker/DEBS
- cd docker
- make flexisip-deb-build
- make flexisip-deb-push
# Enable this to use tests-flexisip-mr
#docker-build-flexisip-src:
# stage: build 🏗
# tags: [ "linux-nuc-build" ]
# extends: .rules-dev # ⚠ See `rules.yml`
# variables:
# DOCKER_BUILD_OPTIONS: "--no-cache --force-rm -t flexisip-from-src:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHA -f docker/flex-from-src --build-arg=njobs=12 --build-arg=build_type=RelWithDebInfo"
# script:
# - docker image ls
# - echo $DOCKER_BUILD_OPTIONS
# - docker build $DOCKER_BUILD_OPTIONS .
# - docker image ls
#################################################
# Nightly only
#################################################
.job-linux-build-nightly:
extends:
- .job-linux-build
- .rules-nightly # ⚠ See `rules.yml`
#################################################
# Build Makefile
#################################################
.job-makefile-gcc:
extends: .job-linux-build-nightly
variables:
CMAKE_GENERATOR: Unix Makefiles
CC: gcc
CXX: g++
.job-makefile-clang:
extends: .job-linux-build-nightly
variables:
CMAKE_GENERATOR: Unix Makefiles
CC: clang
CXX: clang++
#################################################
# Build Ninja
#################################################
.job-ninja-gcc:
extends:
- .job-linux-build
- .rules-manual # ⚠ See `rules.yml`
variables:
CMAKE_GENERATOR: Ninja
CC: gcc
CXX: g++
.job-ninja-clang:
extends:
- .job-linux-build
- .rules-dev # ⚠ See `rules.yml`
variables:
CMAKE_GENERATOR: Ninja
CC: clang
CXX: clang++
#################################################
# Tests
#################################################
.unit-test:
stage: test 🧪
tags: [ "docker-test-flexisip" ]
extends: .rules-dev # ⚠ See `rules.yml`
variables:
# Do not clone, only use artifacts (TODO 'none' doesn't clean, we are using 'fetch' until we find a way)
GIT_STRATEGY: fetch
LSAN_SUPPRESSIONS_FILE_PATH: "./sanitizer_ignore.txt"
script:
- export LD_LIBRARY_PATH=/usr/local/lib
- export LSAN_OPTIONS="suppressions=$LSAN_SUPPRESSIONS_FILE_PATH"
- ./work/bin/flexisip_tester --verbose --xml || exit $?
artifacts:
reports:
junit:
- BCUnitAutomated-Results.xml
when: always
expire_in: 1 week
# Disabled because of too much random test errors for a valid result for now.
#
# tests-flexisip-mr:
# stage: test 🧪
# tags: [ "linux-nuc"]
# allow_failure: true
# extends: .rules-dev # ⚠ See `rules.yml`
# needs :
# - docker-build-flexisip-src
# variables:
# #Branch of the Flexisip-tester project to use. Could be modified to test fixes or features in the Flexisip-tester
# FLEXISIP_TESTER_BRANCH: "release/flexisip_2.2"
#
# #This value specifies the workspace where we from all tests outputs.
# workspace: "${CI_PROJECT_DIR}/liblinphone_tester_workspace"
#
# #Flexisip docker image is build from source in the build stage (job docker-build-flexisip-src)
# #No need to modify these value
# FLEXISIP_DOCKER_TAG: "$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHA"
#
# # Docker run options are only used for coredump display if any
# # We are forced to copy the same string as "workspace" because we can't use nested variables in the same place (i.e. in variable declaration)
# docker_run_options: "-v ${CI_PROJECT_DIR}/liblinphone_tester_workspace:/home/bc/linphone-sdk-build/linphone-sdk/desktop/work"
# flexisip_docker_run_options: "-v ${CI_PROJECT_DIR}/liblinphone_tester_workspace:/root"
#
# script:
# # Retrieve the SDK commit sha used by Flexisip
# - cd linphone-sdk
# - export LIBLINPHONE_DOCKER_TAG=$(git rev-parse --verify HEAD)
# - echo "SDK commit sha " $LIBLINPHONE_DOCKER_TAG
# - cd ..
#
# # used to ensure there will be not network name conflict for parallel
# # docker-compose executions
# - export COMPOSE_PROJECT_NAME=$RANDOM
# - echo "Compose project name " $COMPOSE_PROJECT_NAME
#
# - export FLEXISIP_TESTER_IPV4_PREFIX="172.0.`expr $COMPOSE_PROJECT_NAME % 255`"
# - echo "Flexisip tester private ipv4 prefix " $FLEXISIP_TESTER_IPV4_PREFIX
#
# - export FLEXISIP_TESTER_IPV6_SUBNET="2001:3200:3200:`printf '%x\n' $COMPOSE_PROJECT_NAME`::/64"
# - echo "Flexisip tester private ipv6 subnet " $FLEXISIP_TESTER_IPV6_SUBNET
#
# - export FLEXISIP_TESTER_IPV6_GATEWAY="2001:3200:3200:`printf '%x\n' $COMPOSE_PROJECT_NAME`::1"
# - export FLEXISIP_TESTER_IPV6_PROBING_ADDR=$FLEXISIP_TESTER_IPV6_GATEWAY
# - echo "Flexisip tester private ipv6 gateway" $FLEXISIP_TESTER_IPV6_GATEWAY
#
# - echo "Liblinphone tester version:" $LIBLINPHONE_DOCKER_TAG
# - echo $workspace
#
# - git clone -b $FLEXISIP_TESTER_BRANCH --single-branch [email protected]:BC/private/flexisip-tester --jobs 12
#
# #We make sure that the variables we set here can be accessed by the docker-compose scripts (in the flexisip-tester project).
# - export FLEXISIP_DOCKER_TAG="$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHA"
# - export LIBLINPHONE_DOCKER_TAG=$LIBLINPHONE_DOCKER_TAG
#
# - |
# if [ -z $workspace ]; then
# echo "Error, $workspace should be set. Aborting to avoid unwanted rm"
# exit 1
# fi
#
# - mkdir -p $workspace
# - rm -rf $workspace/*
#
# - mkdir -p $workspace/{bin,flexiapi,ext,lime,lime-ext}
#
# # workaround for logs writing
# - chmod -R 777 $workspace
#
# # Handle multiple runs by unsetting variable
# # Overriding docker-compose.yaml values with docker-compose-standalone.yaml
# # in the ways specified with docker docs (either OR or AND, depending on key)
#
# - |
# docker_compose_options="--env-file ${CI_PROJECT_DIR}/flexisip-tester/docker/.env"
# for name in 'docker-compose.yaml' 'docker-compose-standalone.yaml'; do
# docker_compose_options="$docker_compose_options -f ${CI_PROJECT_DIR}/flexisip-tester/docker/$name"
# done
#
# #Tester's options like parallel mode are defined in the docker-compose-standalone.yaml file of the flexisip-tester project
#
# - export FLEXISIP_LOGS="$workspace"
# - export LIBLINPHONE_LOGS="$workspace"
#
# - export FLEXISIP_WORKSPACE="$workspace"
#
# - echo $docker_run_options
#
# - cd $workspace
#
# # Stop and remove containers, networks and volumes from previous tests.
# # Already done after tests, should do nothing except if previous job crashed.
# - docker-compose $docker_compose_options down --volumes --remove-orphans
#
# - echo "COMPOSE_PROJECT_NAME=$COMPOSE_PROJECT_NAME" > savedEnv
#
# # commented -d option to have debug logs on standard output in case of
# # buggy or silent log artifacts
# # We output only liblinphone_tester on stdout
#
# #-V, --renew-anon-volumes Recreate anonymous volumes instead of retrieving data from the previous containers.
# #--exit-code-from Exits with the return code from the specified container (implies --abort-on-container-exit)
# #In the grep we are searching only for the logs related to liblinphone_tester and docker build, so we remove output from all other services.
#
# - docker-compose $docker_compose_options up --build -V --exit-code-from liblinphone_tester |& tee logs_all | grep -vE 'redis_server[_-]1|flexisip[_-]1|flexisip-regevent[_-]1|flexisip-external[_-]1|flexisip-external-domain[_-]1|lime-server[_-]1|lime-server[_-]1|lime-external-server[_-]1|dbserver[_-]1|account-manager[_-]1|file-transfer-server[_-]1|http-proxy[_-]1|ldap-server[_-]1' || EXIT=$?
#
# #docker-compose log command isn't used anymore because of bad performance
# #the logs were converted by docker in json format, then reconverted to txt, which is useless (doing this made the job last for 20-30 minutes for 9 minutes of tests)
#
# - |
# for service in $(docker-compose $docker_compose_options ps --services); do
# if [[ "${service}" == "flexisip" ]]; then
# continue
# fi
# filename="${service}_stdout.log"
# echo -n "Writting ${filename}..."
# grep $service logs_all >> ${filename}.log
# echo " done"
# done
#
# #we wait for each grep to end before stopping containers
# - wait
#
# # The sleep command was removed because we now wait for the db socket to open (in compose file) before launching tests
#
# # Stop and remove containers, networks and volumes from previous tests
# - docker-compose $docker_compose_options down --volumes --remove-orphans || true
#
# - gzip *.log
#
# - gzip */*.log
#
# - exit $EXIT
#
# after_script:
#
# #content of $workspace (set like this because the variable can't be resolved here)
# - cd ${CI_PROJECT_DIR}/liblinphone_tester_workspace
# # we specify commands to launch for each coredump of liblinphone_tester
# - echo "set debug-file-directory ../lib64" | tee gdb_options
# - echo "thread apply all bt" | tee -a gdb_options
# # searching for core files and if there are some, launch gdb on all of it
# # xargs -L1 means that the command in argument will be executed for each
# # line (core dump) found in find output
# # The docker syntax is error proning : to override the entrypoint with
# # args, we enter the entrypoint first, then the name of the image, then the
# # args to the entrypoint command.
# # "|| true " is used here to continue the script even if the find fails
# - FIND_EXIT=0
# - find . -type f -name "core.liblin*" | grep . || FIND_EXIT=$?
# - echo $FIND_EXIT
# - if [[ $FIND_EXIT = 0 ]]; then find . -type f -name "core.liblin*" | xargs -L1 docker run $docker_run_options --entrypoint gdb "$LIBLINPHONE_DOCKER_IMAGE:$LIBLINPHONE_DOCKER_TAG" ../bin/liblinphone_tester -x gdb_options; fi || true
# - unset FIND_EXIT
# # we specify commands to launch for each coredump of flexisip_tester
# - echo "set debug-file-directory /opt/belledonne-communications/lib" | tee gdb_options
# - echo "thread apply all bt" | tee -a gdb_options
# - echo $flexisip_docker_run_options
# - find . -type f -name "core.flexisip*"
# - echo $FLEXISIP_DOCKER_IMAGE
# - echo $FLEXISIP_DOCKER_TAG
# - echo $flexisip_docker_run_options
# - FIND_EXIT=0
# - find . -type f -name "core.flexisip*" | grep . || FIND_EXIT=$?
# - echo $FIND_EXIT
# - if [[ $FIND_EXIT = 0 ]]; then find . -type f -name "core.flexisip*" | xargs -L1 docker run $flexisip_docker_run_options --entrypoint gdb "$FLEXISIP_DOCKER_IMAGE:$FLEXISIP_DOCKER_TAG" /opt/belledonne-communications/bin/flexisip -x gdb_options; fi || true
#
# # simplifing artifacts browsing
# # Moving artifacts to ease browsing from web view
# # initially, all the paths needed to be browsed entirely to see artifacts
# # now there is only the folder "results" to check
# - mkdir -p ${CI_PROJECT_DIR}/results/ext
# - chmod 777 ${CI_PROJECT_DIR}/results
# - cp -r BCUnitAutomated* ${CI_PROJECT_DIR}/results
# - cp -r *.log.gz ${CI_PROJECT_DIR}/results
# - cp -r ext/*.log* ${CI_PROJECT_DIR}/results/ext
#
# # Remove network (useful in case of crash or cancel), loading the random generated project name saved during execution
# - source savedEnv
# - docker network rm "$COMPOSE_PROJECT_NAME"_default "$COMPOSE_PROJECT_NAME"_flexisip_internal_private || true
#
# artifacts:
# paths:
# - results/*
# when: always
# reports:
# junit:
# - liblinphone_tester_workspace/BCUnitAutomated-Results.xml
# expire_in: 4 week