-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
666 lines (603 loc) · 14.7 KB
/
.gitlab-ci.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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
variables:
GIT_STRATEGY: clone
REGISTRY: $CI_REGISTRY_IMAGE
cache:
key: none
paths: []
policy: pull
stages:
- docker1
- docker2
- build
- test
- deploy
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "web"
.docker:
tags:
- docker
- linux
image: docker:stable
services:
- docker:dind
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- docker build
--build-arg REGISTRY=$REGISTRY
-t $CI_REGISTRY_IMAGE/$NAME:$TAG docker/$NAME/$TAG
- docker push $CI_REGISTRY_IMAGE/$NAME:$TAG
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
changes:
- docker/**/*
- .gitlab-ci.yml
when: always
.docker1:
extends: .docker
stage: docker1
.docker2:
extends: .docker
stage: docker2
.build:
stage: build
tags:
- docker
- linux
needs: []
script:
- autoreconf -i
- ./configure $CONFIGURE_OPTIONS
- make
artifacts:
untracked: true
.test:
stage: test
tags:
- docker
- linux
script:
- touch aclocal.m4 configure config.status Makefile.in
- make -t
- make check
artifacts:
when: on_failure
paths:
- test/test-*.log
- unit-tests/test-*.log
expire_in: 1 week
.docker-gcc:
extends: .docker1
script:
- docker build
--build-arg __GNUC__=$__GNUC__
-t $CI_REGISTRY_IMAGE/gcc:$__GNUC__ docker/gcc
- docker push $CI_REGISTRY_IMAGE/gcc:$__GNUC__
docker-gcc:
extends: .docker-gcc
parallel:
matrix:
- __GNUC__: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
build:gcc:
extends: .build
image: $REGISTRY/gcc:$__GNUC__
parallel:
matrix:
- __GNUC__: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
variables:
CONFIGURE_OPTIONS: --disable-python2
test:gcc:4:
extends: .test
image: $REGISTRY/gcc:4
needs: ["build:gcc: [4]"]
test:gcc:5:
extends: .test
image: $REGISTRY/gcc:5
needs: ["build:gcc: [5]"]
test:gcc:6:
extends: .test
image: $REGISTRY/gcc:6
needs: ["build:gcc: [6]"]
test:gcc:7:
extends: .test
image: $REGISTRY/gcc:7
needs: ["build:gcc: [7]"]
test:gcc:8:
extends: .test
image: $REGISTRY/gcc:8
needs: ["build:gcc: [8]"]
test:gcc:9:
extends: .test
image: $REGISTRY/gcc:9
needs: ["build:gcc: [9]"]
test:gcc:10:
extends: .test
image: $REGISTRY/gcc:10
needs: ["build:gcc: [10]"]
test:gcc:11:
extends: .test
image: $REGISTRY/gcc:11
needs: ["build:gcc: [11]"]
test:gcc:12:
extends: .test
image: $REGISTRY/gcc:12
needs: ["build:gcc: [12]"]
test:gcc:13:
extends: .test
image: $REGISTRY/gcc:13
needs: ["build:gcc: [13]"]
build:configure:
extends: .build
image: $REGISTRY/gcc:13
parallel:
matrix:
- CONFIGURE_OPTIONS:
- --disable-canfd
- --disable-errno
- --disable-malloc
- --disable-master
- --disable-stdio
- --enable-ecss-compliance
test:configure:disable-canfd:
extends: .test
image: $REGISTRY/gcc:13
needs: ["build:configure: [--disable-canfd]"]
test:configure:disable-errno:
extends: .test
image: $REGISTRY/gcc:13
needs: ["build:configure: [--disable-errno]"]
test:configure:disable-malloc:
extends: .test
image: $REGISTRY/gcc:13
needs: ["build:configure: [--disable-malloc]"]
test:configure:disable-master:
extends: .test
image: $REGISTRY/gcc:13
needs: ["build:configure: [--disable-master]"]
test:configure:disable-stdio:
extends: .test
image: $REGISTRY/gcc:13
needs: ["build:configure: [--disable-stdio]"]
test:configure:enable-ecss-compliance:
extends: .test
image: $REGISTRY/gcc:13
needs: ["build:configure: [--enable-ecss-compliance]"]
docker:mingw-w64:
extends: .docker1
script:
- docker build
--build-arg ARCH=$ARCH
-t $CI_REGISTRY_IMAGE/$ARCH-w64-mingw32:$TAG docker/mingw-w64/$TAG
- docker push $CI_REGISTRY_IMAGE/$ARCH-w64-mingw32:$TAG
variables:
TAG: bullseye
parallel:
matrix:
- ARCH: [i686, x86_64]
build:mingw-w64:
extends: .build
image: $REGISTRY/$HOST:bullseye
variables:
CONFIGURE_OPTIONS: --host=$HOST --disable-python
parallel:
matrix:
- HOST: [i686-w64-mingw32, x86_64-w64-mingw32]
test:i686-w64-mingw32:
extends: .test
image: $REGISTRY/i686-w64-mingw32:bullseye
needs: ["build:mingw-w64: [i686-w64-mingw32]"]
rules:
- when: manual # awaiting fix
allow_failure: true
test:x86_64-w64-mingw32:
extends: .test
image: $REGISTRY/x86_64-w64-mingw32:bullseye
needs: ["build:mingw-w64: [x86_64-w64-mingw32]"]
docker:crossbuild:
extends: .docker1
script:
- docker build
--build-arg ARCH=$ARCH
--build-arg NAME=$NAME
-t $CI_REGISTRY_IMAGE/$NAME:$TAG docker/crossbuild/$TAG
- docker push $CI_REGISTRY_IMAGE/$NAME:$TAG
parallel:
matrix:
- ARCH: armhf
NAME: arm-linux-gnueabihf
TAG: buster
- ARCH: arm64
NAME: aarch64-linux-gnu
TAG: buster
build:crossbuild:
extends: .build
image: $REGISTRY/$HOST:buster
variables:
ARCH: armhf
# TODO enable unit tests (switch to bullseye)
CONFIGURE_OPTIONS: --host=$HOST --disable-unit-tests
parallel:
matrix:
- HOST: [arm-linux-gnueabihf, aarch64-linux-gnu]
test:arm-linux-gnueabihf:
extends: .test
image: $REGISTRY/arm-linux-gnueabihf:buster
needs: ["build:crossbuild: [arm-linux-gnueabihf]"]
test:aarch64-linux-gnu:
extends: .test
image: $REGISTRY/aarch64-linux-gnu:buster
needs: ["build:crossbuild: [aarch64-linux-gnu]"]
docker:build:
extends: .docker1
variables:
NAME: build
TAG: bullseye
docker:arm-none-eabi:
extends: .docker2
needs: ["docker:build"]
variables:
NAME: arm-none-eabi
TAG: bullseye
build:arm-none-eabi:
extends: .build
image: $REGISTRY/arm-none-eabi:bullseye
variables:
CFLAGS: -g -O2 -mcpu=cortex-m3 -D__NEWLIB__
CONFIGURE_OPTIONS: --host=arm-none-eabi --disable-tools --disable-tests --disable-unit-tests --disable-python --disable-threads --disable-daemon
CXXFLAGS: -g -O2 -mcpu=cortex-m3 -D__NEWLIB__
LDFLAGS: --specs=nosys.specs
docker:doc:
extends: .docker2
needs: ["docker:build"]
variables:
NAME: doc
TAG: bullseye
doc:
stage: build
tags:
- docker
- linux
image: $REGISTRY/doc:bullseye
needs: []
script:
- autoreconf -i
- ./configure
- make html
artifacts:
paths:
- doc/
expire_in: 1 week
docker:cpplint:
extends: .docker1
variables:
NAME: cpplint
TAG: bullseye
cpplint:
stage: test
tags:
- docker
- linux
image: $REGISTRY/cpplint:bullseye
needs: []
script:
- python2 $(which cpplint.py)
--quiet
--extensions=cpp
$(find include -name *.hpp)
$(find src -name *.cpp)
$(find unit-tests -name *.cpp -o -name *.hpp)
docker:clang-format:
extends: .docker2
needs: ["docker:build"]
variables:
NAME: clang-format
TAG: bullseye
clang-format:
stage: test
tags:
- docker
- linux
image: $REGISTRY/clang-format:bullseye
needs: []
script:
- ln -sf .clang-format.c .clang-format
- clang-format
-n
--Werror
$(find include -name *.h)
$(find src -name *.c -o -name *.h)
$(find tools -name *.c -o -name *.h)
$(find test -name *.c -o -name *.h)
$(find unit-tests -name *.cpp -o -name *.hpp)
- ln -sf .clang-format.cpp .clang-format
- clang-format
-n
--Werror
$(find include -name *.hpp)
$(find src -name *.cpp -o -name *.hpp)
$(find test -name *.cpp -o -name *.hpp)
docker:valgrind:
extends: .docker2
needs: ["docker:build"]
variables:
NAME: valgrind
TAG: bullseye
valgrind:
stage: test
tags:
- docker
- linux
image: $REGISTRY/valgrind:bullseye
needs: []
script:
- autoreconf -i
- ./configure --disable-cython
- make
- make check-valgrind-memcheck
artifacts:
when: on_failure
paths:
- test/test-*.log
- unit-tests/test-*.log
expire_in: 1 week
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: always
- if: '$CI_MERGE_REQUEST_EVENT_TYPE == "merge_train"'
when: always
- when: manual
allow_failure: true
valgrind:ecss:
stage: test
tags:
- docker
- linux
image: $REGISTRY/valgrind:bullseye
needs: []
script:
- autoreconf -i
- ./configure --enable-ecss-compliance
- make
- make check-valgrind-memcheck
artifacts:
when: on_failure
paths:
- test/test-*.log
- unit-tests/test-*.log
expire_in: 1 week
docker:lcov:
extends: .docker2
needs: ["docker:build"]
variables:
NAME: lcov
TAG: bullseye
lcov:
stage: test
tags:
- docker
- linux
image: $REGISTRY/lcov:bullseye
needs: []
variables:
# force empty so --enable-code-coverage will setup them correctly
CFLAGS: ""
CXXFLAGS: ""
script:
- autoreconf -i
- ./configure --enable-code-coverage --disable-shared $LELY_CORE_ANALYSIS_CONFIGURE_OPTIONS
- make
- make check-code-coverage
- lcov --summary coverage.info --rc lcov_branch_coverage=1
coverage: '/lines[\.]*\:\s*(\d+\.\d+)%/'
artifacts:
paths:
- coverage/
expire_in: 1 week
docker:scan-build:
extends: .docker2
needs: ["docker:build"]
variables:
NAME: scan-build
TAG: bullseye
scan-build:
stage: test
tags:
- docker
- linux
image: $REGISTRY/scan-build:bullseye
needs: []
script:
- autoreconf -i
- scan-build ./configure --disable-cython $LELY_CORE_ANALYSIS_CONFIGURE_OPTIONS
- scan-build --keep-cc -o ./scan-build make check
artifacts:
when: on_failure
paths:
- scan-build/
expire_in: 1 week
docker:cppcheck-unix64:
extends: .docker2
needs: ["docker:build"]
variables:
NAME: cppcheck-unix64
TAG: bullseye
cppcheck-unix64:
stage: test
tags:
- docker
- linux
image: $REGISTRY/cppcheck-unix64:bullseye
needs: []
script:
- autoreconf -i
- ./configure --disable-python
- cppcheck --doc > cppcheck-rules.md
- cppcheck
-D_GNU_SOURCE -D__linux__=1 -DHAVE_CONFIG_H
--enable=warning,style,performance,portability,missingInclude
--error-exitcode=1
--force
--quiet
-I. -I./include
--inline-suppr
--platform=unix64
--std=c11 --std=c++11
--library=std --library=gnu
--suppressions-list=suppressions.txt
-isrc/io2/win32
include src unit-tests
artifacts:
paths:
- cppcheck-rules.md
expire_in: 1 week
docker:cppcheck-win64:
extends: .docker2
needs: ["docker:mingw-w64: [x86_64]"]
variables:
NAME: cppcheck-win64
TAG: bullseye
cppcheck-win64:
stage: test
tags:
- docker
- linux
image: $REGISTRY/cppcheck-win64:bullseye
needs: []
script:
- autoreconf -i
- ./configure --host=x86_64-w64-mingw32 --disable-python
- cppcheck --doc > cppcheck-rules.md
- cppcheck
-D_WIN32=1 -D_WIN64=1 -D__MINGW32__=1 -D__MINGW64__=1 -DHAVE_CONFIG_H
-U__linux__
--enable=warning,style,performance,portability,missingInclude
--error-exitcode=1
--force
--quiet
-I. -I./include
--inline-suppr
--platform=win64
--std=c11 --std=c++11
--library=std --library=gnu --library=windows
--suppress=va_list_usedBeforeStarted
--suppressions-list=suppressions.txt
-isrc/io2/linux
include src unit-tests
artifacts:
paths:
- cppcheck-rules.md
expire_in: 1 week
docker:python-checks:
extends: .docker1
variables:
NAME: python-checks
TAG: 3.8-slim
python-checks:
stage: test
tags:
- docker
- linux
image: $REGISTRY/python-checks:3.8-slim
needs: []
script:
- black --diff --check python/dcf-tools/
- flake8 python/dcf-tools
docker:coverity:
extends: .docker1
script:
- docker build
--build-arg REGISTRY=$REGISTRY
--build-arg COVERITY_PROJECT=$COVERITY_PROJECT
--build-arg COVERITY_TOKEN=$COVERITY_TOKEN
-t $CI_REGISTRY_IMAGE/coverity:gcc9 docker/coverity/gcc9
- docker push $CI_REGISTRY_IMAGE/coverity:gcc9
coverity:
stage: test
tags:
- docker
- linux
image: $REGISTRY/coverity:gcc9
needs: []
script:
- autoreconf -i
- ./configure --disable-cython $LELY_CORE_ANALYSIS_CONFIGURE_OPTIONS
- cov-build --dir cov-int make check
after_script:
- tar caf $CI_PROJECT_NAME.xz cov-int
- curl --form token=$COVERITY_TOKEN
--form email=$COVERITY_EMAIL
--form file=@$CI_PROJECT_NAME.xz
--form version="$(git describe --abbrev=0 --tags | sed s/^v//)"
--form description="$CI_COMMIT_REF_NAME"
https://scan.coverity.com/builds?project=$COVERITY_PROJECT
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: always
- when: manual
allow_failure: true
docker:sonarcloud:
extends: .docker2
needs: ["docker:build"]
script:
- docker build
--build-arg REGISTRY=$REGISTRY
--build-arg SONAR_HOST_URL=$SONAR_HOST_URL
--build-arg SONAR_TOKEN=SONAR_TOKEN
-t $CI_REGISTRY_IMAGE/sonarcloud:bullseye docker/sonarcloud/bullseye
- docker push $CI_REGISTRY_IMAGE/sonarcloud:bullseye
sonarcloud:
stage: test
tags:
- docker
- linux
image: $REGISTRY/sonarcloud:bullseye
needs: []
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
GIT_DEPTH: "0"
script:
- autoreconf -i
- ./configure --disable-cython $LELY_CORE_ANALYSIS_CONFIGURE_OPTIONS
- /opt/sonar-build-wrapper/build-wrapper-linux-x86-64 --out-dir bw-output make check
- /opt/sonar-scanner/bin/sonar-scanner
-Dsonar.host.url="${SONAR_HOST_URL}"
-Dsonar.token="${SONAR_TOKEN}"
-Dsonar.projectKey="${SONAR_PROJECT_KEY}"
-Dsonar.organization="${SONAR_ORGANIZATION}"
-Dsonar.projectName="Lely CANopen"
-Dsonar.links.homepage="${CI_PROJECT_URL}"
-Dsonar.links.ci="${CI_PROJECT_URL}/pipelines"
-Dsonar.links.scm="${CI_PROJECT_URL}"
-Dsonar.links.issue="${CI_PROJECT_URL}/issues"
-Dsonar.sources=include,src,tools,python
-Dsonar.tests=test,unit-tests
-Dsonar.cfamily.build-wrapper-output=bw-output
-Dsonar.cfamily.threads=1
-Dsonar.cfamily.cache.enabled=false
rules:
- if: '$CI_MERGE_REQUEST_EVENT_TYPE != "merge_train"'
when: always
- when: never
pages:
stage: deploy
tags:
- docker
- linux
image: alpine:latest
needs: ["doc", "lcov"]
script:
- mkdir -p public
- mv coverage public/lcov
- mv doc/html public/doxygen
artifacts:
paths:
- public
expire_in: 1 weeks
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: always
- when: never