-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
140 lines (124 loc) · 2.77 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
image: ubuntu:latest
variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- build
- test
- quality
- security
- deploy
# Build the software, along with all tests
build:
stage: build
script:
- mkdir build
- cd build
- cmake ..
- make -j
- cd ..
artifacts:
paths:
- build/
- bin/
- lib/
expire_in: 1 day
# Run tests
.template: &coverage_template
stage: test
before_script:
- apt install gcovr
- cd build
- cmake .. -DBUILD_TYPE=TEST
- make -j
# after_script:
# - make gcovr
coverage: '/^lines: (\d+.\d+)%/'
unit_tests:
<<: *coverage_template
script:
- ../bin/unit_tests
- make gcovr
- mv gcovr unit_test_coverage
artifacts:
paths:
- build/unit_test_coverage
expire_in: 1 week
integration_tests:
<<: *coverage_template
script:
- ../bin/integration_tests
- make gcovr
- mv gcovr integration_test_coverage
artifacts:
paths:
- build/integration_test_coverage
expire_in: 1 week
regression_tests:
<<: *coverage_template
script:
- ../bin/regression_tests
- make gcovr
- mv gcovr regression_test_coverage
artifacts:
paths:
- build/regression_test_coverage
expire_in: 1 week
format_tests:
stage: test
script:
- find ./{test,src}/ -iname *.h -o -iname *.cpp -o -iname *.hpp | xargs clang-format-8 -style=file | clang-format-diff-8 > out.txt
- if [[ -s out.txt ]]; then false; fi
allow_failure: true
# Code quality
cyclomatic_complexity:
stage: quality
script:
- python /home/lizard/lizard.py --CCN=15 --length=100 --arguments=10 src
static_analysis:
stage: quality
script:
- script -c "cppcheck src --enable=all" cppcheck.out
artifacts:
paths:
- cppcheck.out
expire_in: 1 week
similarity:
stage: quality
script:
- script -c "sim_c++ -aRn src/*" similarity.out
artifacts:
paths:
- similarity.out
expire_in: 1 week
flaws:
stage: security
script:
- script -c "flawfinder src" flawfinder.out
artifacts:
paths:
- flawfinder.out
expire_in: 1 week
pages:
stage: deploy
script:
# assuming build folder in the build stage is kept
- mkdir builddoc && cd builddoc
- cmake ..
- make doc
# doxygen output folder name is controlled in defined Doxygen.in
# gitlab pages request document must put into `public` folder of the repo directory
- mv public/html ../public
- cd ..
- mv build/unit_test_coverage public/unit_coverage
- mv build/integration_test_coverage public/integration_coverage
- mv build/regression_test_coverage public/regression_coverage
dependencies:
- unit_tests
- integration_tests
- regression_tests
only:
- master
artifacts:
paths:
- public
allow_failure: true # TODO change to false