-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
170 lines (162 loc) · 6.69 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
variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- build
- analyze
- test
- deploy
check-build:
image: spacedot/build-base
stage: build
variables:
GCC_COLORS: "error=31;1:warning=35;1:note=36;1:range1=32:range2=34:locus=39;1:quote=39;1:fixit-insert=32:fixit-delete=31:diff-filename=39;1:diff-hunk=32:diff-delete=31:diff-insert=32:type-diff=32;1"
CLICOLOR_FORCE: 1 # Necessary for cmake to output colours
script:
- conan profile detect --force
- mkdir conan-build
- conan remote add conan https://artifactory.spacedot.gr/artifactory/api/conan/conan
- conan remote login -p $CONAN_PASSWORD conan $CONAN_USER
- conan install . --output-folder conan-build --build=missing
- cmake . -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -fdiagnostics-color=always" -DCMAKE_TOOLCHAIN_FILE=conan-build/Release/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
- make -j$(nproc)
cppcheck:
image: spacedot/cppcheck:2.8
stage: analyze
before_script:
- cppcheck --version
script:
- cd $CI_PROJECT_DIR
- cppcheck --enable=all --addon=misra --suppressions-list=./ci/suppressions.txt --force --inline-suppr --error-exitcode=1 \
-j $(nproc) --xml --xml-version=2 2>report.xml -I ./inc ./src -i ./src/Platform -i ./inc/Platform
after_script:
- mkdir cppcheck-html-report
- cppcheck-htmlreport --source-dir=. --title=html-report --file=report.xml --report-dir=cppcheck-html-report
artifacts:
when: always
paths:
- ./cppcheck-html-report
clang-tidy:
image: spacedot/clang-tools:13.0.0-html-1.4.1
stage: analyze
script:
- cd $CI_PROJECT_DIR
- conan profile detect --force
- mkdir conan-build
- conan remote add conan https://artifactory.spacedot.gr/artifactory/api/conan/conan
- conan remote login -p $CONAN_PASSWORD conan $CONAN_USER
- conan install . --output-folder conan-build --build=missing
- cmake -B ./build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_TOOLCHAIN_FILE=conan-build/Release/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
- clang-tidy -p $CI_PROJECT_DIR/build/compile_commands.json --config-file=$CI_PROJECT_DIR/ci/.clang-tidy --use-color `find $CI_PROJECT_DIR/src $CI_PROJECT_DIR/inc -not -path "*/Platform/*" -type f -regextype posix-egrep -regex '.*\.(cpp|hpp|c|h)'` | tee clang-tidy-output.log
after_script:
- sed -e 's/\x1b\[[0-9;]*m//g' -i clang-tidy-output.log
- mkdir clang-tidy-html-report
- clang-tidy-html clang-tidy-output.log
- mv clang.html clang-tidy-html-report
artifacts:
when: always
paths:
- ./clang-tidy-html-report
clang-analyzer:
image: spacedot/clang-tools:13.0.0-html-1.4.1
stage: analyze
before_script:
- mkdir scan-build-html-report
script:
- cd $CI_PROJECT_DIR
- conan profile detect --force
- mkdir conan-build
- conan remote add conan https://artifactory.spacedot.gr/artifactory/api/conan/conan
- conan remote login -p $CONAN_PASSWORD conan $CONAN_USER
- conan install . --output-folder conan-build --build=missing
- scan-build cmake ./ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_TOOLCHAIN_FILE=conan-build/Release/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
- scan-build -o ./scan-build-html-report make
artifacts:
paths:
- ./scan-build-html-report
doxygen:
image: spacedot/doxygen:1.9.4-4-awesomecss-1.6.0
stage: analyze
script:
- cd $CI_PROJECT_DIR
- doxygen
artifacts:
paths:
- ./docs/html
ikos:
image: spacedot/ikos:3.0
stage: analyze
before_script:
- mkdir ikos-report
script:
- cd $CI_PROJECT_DIR
- conan profile detect --force
- cp conan-profile /root/.conan2/profiles/
- mkdir conan-build
- conan remote add conan https://artifactory.spacedot.gr/artifactory/api/conan/conan
- conan remote login -p $CONAN_PASSWORD conan $CONAN_USER
- conan install . --output-folder conan-build --build=missing -pr conan-profile
- ikos-scan cmake . -DCMAKE_TOOLCHAIN_FILE=conan-build/Debug/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug
- ikos-scan make x86_services
- ikos x86_services.bc
- ikos-report -o=ikos-report.txt output.db
after_script:
- mv ikos-report.txt ikos-report
- mv output.db ikos-report
artifacts:
paths:
- ./ikos-report
tests:
image: spacedot/coverage:gcovr-6.0-lcov-1.15.5a0
stage: test
when: always
before_script:
- mkdir gcovr
script:
- cd $CI_PROJECT_DIR
- conan profile detect --force
- mkdir conan-build
- conan remote add conan https://artifactory.spacedot.gr/artifactory/api/conan/conan
- conan remote login -p $CONAN_PASSWORD conan $CONAN_USER
- conan install . --output-folder conan-build --build=missing
- cmake . -DCMAKE_CXX_FLAGS="-g -O0 --coverage" -DCMAKE_TOOLCHAIN_FILE=conan-build/Release/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release && make tests -j$(nproc)
- lcov -q --capture --initial --directory . -o coverage_base
- ./tests --colour-mode ansi
- lcov -q --capture --directory . -o coverage_tests
- lcov -q -a coverage_base -a coverage_tests -o coverage_total_unfiltered
- lcov -q --remove coverage_total_unfiltered "${PWD}/lib/*" "${PWD}/CMakeFiles/*" "${PWD}/test/*" "${PWD}/src/main.cpp" -o coverage_total_filtered
- gcovr -s -p -e "^.*(test|lib|main.cpp|CMakeFiles)" --html --html-details --html-title "Code coverage ${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}" -o ./gcovr/gcovr.html
- gcovr -e "^.*(test|lib|main.cpp|CMakeFiles)"
- genhtml --demangle-cpp -t "${CI_COMMIT_REF_NAME}" --html-epilog ci/page_style/epilog.html -o ./gcovr coverage_total_filtered
artifacts:
paths:
- ./gcovr
pages:
image: spacedot/build-base:latest
stage: deploy
script:
- mkdir .public
- cp -r ./docs/html ./.public/docs
- cp -r ./{gcovr,ikos-report,scan-build-html-report,clang-tidy-html-report,cppcheck-html-report} ./.public/
- cp -r ./{gcovr,ikos-report,cppcheck-html-report} ./.public/
- ls ./.public
- find ./.public
- mv .public public
after_script:
- "echo Artifacts for this build: ${CI_JOB_URL}/artifacts/browse"
- "echo Base page for this branch: ${CI_PAGES_URL}"
artifacts:
expose_as: 'build artifacts and documentation'
paths:
- public
conan:
image: spacedot/build-base
stage: deploy
script:
- conan profile detect --force
- cp conan-profile /root/.conan2/profiles/
- conan remote add conan https://artifactory.spacedot.gr/artifactory/api/conan/conan
- conan remote login -p $CONAN_PASSWORD conan $CONAN_USER
- conan create . --build=missing -pr conan-profile
- conan upload ecss-services/1.2 -r conan
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH