-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
247 lines (232 loc) · 6.62 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
workflow:
rules:
- if: '$CI_COMMIT_REF_NAME == "main"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_PIPELINE_SOURCE == "web"'
stages:
- build
# TODO rearchitect on-target testing setup so these stages don't need to be serialized
- build-freertos
- build-mqx
- build-zephyr
- deploy
variables:
COMMON_CMAKE_DEFS: -DETCPAL_BUILD_MOCK_LIB=ON -DETCPAL_BUILD_TESTS=ON -DETCPAL_BUILD_EXAMPLES=ON -DETCPAL_WARN_AS_ERROR=ON
KLOCWORK_PROJECT: "EtcPal"
include:
# Helper for environment setup for native Ninja builds with Windows/MSVC
- project: "etc/common-tech/tools/gitlab-ci-util"
ref: v2.3.1
file: "/ci-yml/msvc-environment.yml"
# Versioned build automation
- project: "etc/common-tech/tools/gitlab-ci-util"
ref: v2.3.1
file: "/ci-yml/deploy-versioned-build.yml"
# Klocwork static analysis
- project: "etc/common-tech/tools/gitlab-ci-util"
ref: v2.3.1
file: "/ci-yml/linux-klocwork.yml"
windows-build-and-test:
stage: build
tags:
- ct-windows
variables:
CMAKE_DEFS: -DETCPAL_ENABLE_CLANG_TIDY=ON -DETCPAL_CLANG_TIDY_WERROR=ON -DETCPAL_ENABLE_ASAN=ON
script:
- mkdir build
- cd build
- cmake -G "Visual Studio 16 2019" -A x64 $env:COMMON_CMAKE_DEFS.Split(" ") $env:CMAKE_DEFS.Split(" ") ..
- cmake --build . --config Release -j
- cd ..
- python tools\ci\run_tests.py build --config Release
artifacts:
when: always
reports:
junit: build/test_results_*.xml
macos-build-and-test:
stage: build
tags:
- ct-macos
parallel:
matrix:
- SANITIZER_DEFS:
- -DETCPAL_ENABLE_ASAN=ON -DETCPAL_ENABLE_UBSAN=ON
- -DETCPAL_ENABLE_TSAN=ON
script:
- mkdir build
- cd build
- cmake ${COMMON_CMAKE_DEFS} ${SANITIZER_DEFS} ..
- cmake --build .
- cd ..
- python3 tools/ci/run_tests.py build
artifacts:
when: always
reports:
junit: build/test_results_*.xml
linux-gcc-build-and-test:
stage: build
image: etc-docker.artifactory.etcconnect.com/etc/common-tech/gcc-cmake:latest
tags:
- etc-linux-docker
variables:
# TODO remove ETCPAL_TEST_IPV6=OFF when DEVOPS-1383 is completed
CMAKE_DEFS: -DETCPAL_TEST_IPV6=OFF
parallel:
matrix:
- CMAKE_CXX_FLAGS:
- -fexceptions
- -fno-exceptions
SANITIZER_DEFS:
- -DETCPAL_ENABLE_ASAN=ON -DETCPAL_ENABLE_UBSAN=ON
- -DETCPAL_ENABLE_TSAN=ON
script:
- python3 -m pip install unity-test-parser
- mkdir build
- cd build
# The CMAKE_CXX_FLAGS var must be quoted here and not in the variable because of this bug:
# https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1742
- cmake -G "Unix Makefiles" ${COMMON_CMAKE_DEFS} ${CMAKE_DEFS} ${SANITIZER_DEFS} -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" ..
- make -j `nproc`
- cd ..
- python3 tools/ci/run_tests.py build
artifacts:
when: always
reports:
junit: build/test_results_*.xml
linux-clang-build-and-test:
stage: build
image: etc-docker.artifactory.etcconnect.com/etc/common-tech/clang-cmake-msan:latest
tags:
- etc-linux-docker
variables:
# TODO remove ETCPAL_TEST_IPV6=OFF when DEVOPS-1383 is completed
CMAKE_DEFS: -DETCPAL_TEST_IPV6=OFF
parallel:
matrix:
- CMAKE_CXX_FLAGS:
- -fexceptions
- -fno-exceptions
SANITIZER_DEFS:
- -DETCPAL_ENABLE_MSAN=ON
script:
- python3 -m pip install unity-test-parser
- mkdir build
- cd build
# The CMAKE_CXX_FLAGS var must be quoted here and not in the variable because of this bug:
# https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1742
- cmake -G "Unix Makefiles" ${COMMON_CMAKE_DEFS} ${CMAKE_DEFS} ${SANITIZER_DEFS} -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" ..
- make -j `nproc`
- cd ..
- python3 tools/ci/run_tests.py build
artifacts:
when: always
reports:
junit: build/test_results_*.xml
oss-build-and-test:
stage: build
image: etc-docker.artifactory.etcconnect.com/etc/common-tech/gcc-cmake:latest
tags:
- etc-linux-docker
script:
# Remove the .git folder to simulate building from P4/zip archive
- rm -rf .git/
- mkdir build
- cd build
# Use default config, no options
- cmake -G "Unix Makefiles" ..
- make -j `nproc`
# Build and test EtcPal with OS and network support disabled
# This is currently done on Linux but with the OS and network targets set to none.
bare-metal-build-and-test:
stage: build
image: etc-docker.artifactory.etcconnect.com/etc/common-tech/gcc-cmake:latest
tags:
- etc-linux-docker
variables:
CMAKE_DEFS: -DETCPAL_BUILD_TESTS=ON -DETCPAL_ENABLE_ASAN=ON -DETCPAL_OS_TARGET='none' -DETCPAL_NET_TARGET='none'
script:
- python3 -m pip install unity-test-parser
- mkdir build
- cd build
- cmake -G "Unix Makefiles" ${CMAKE_DEFS} ..
- make -j `nproc`
- cd ..
- python3 tools/ci/run_tests.py build
freertos-lwip-build-and-test:
stage: build-freertos
tags:
- ct-etcpal-test
script:
- python C:\etcpal_testing\build_and_test_etcpal.py $env:CI_PROJECT_DIR freertos_lwip
artifacts:
when: always
reports:
junit: test_results_*.xml
mqx-build-and-test:
stage: build-mqx
tags:
- ct-etcpal-test
script:
- python C:\etcpal_testing\build_and_test_etcpal.py $env:CI_PROJECT_DIR mqx
artifacts:
when: always
reports:
junit: test_results_*.xml
zephyr-build-and-test:
stage: build-zephyr
tags:
- ct-etcpal-test
script:
- python C:\etcpal_testing\build_and_test_etcpal.py $env:CI_PROJECT_DIR zephyr
artifacts:
when: always
reports:
junit: test_results_*.xml
lint:
stage: build
tags:
- etc-linux-docker
image: etc-docker.artifactory.etcconnect.com/etc/common-tech/gcc-cmake:latest
variables:
CMAKE_DEFS: -DETCPAL_ENABLE_CLANG_TIDY=ON -DETCPAL_CLANG_TIDY_WERROR=ON
script:
- mkdir build
- cd build
- cmake -G "Unix Makefiles" ${COMMON_CMAKE_DEFS} ..
- make check_formatting
- make -j `nproc`
docs:
stage: build
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_PIPELINE_SOURCE == "web"'
tags:
- etc-linux-docker
image: etc-docker.artifactory.etcconnect.com/etc/common-tech/doxygen:1.9.1
variables:
GIT_DEPTH: 0
script:
- pip install --upgrade etcdevtool
- etcdevtool docs . 1.9.1
- mkdir docs-build
- mv docs/build/* docs-build/
artifacts:
paths:
- docs-build
deploy-docs:
stage: deploy
rules:
- if: '$CI_COMMIT_REF_NAME == "main"'
tags:
- etc-linux-docker
image: etc-docker.artifactory.etcconnect.com/etc/common-tech/doxygen:1.9.1
variables:
# Fetch all tags
GIT_DEPTH: 0
GH_REPO_NAME: EtcPalDocs
GH_REPO_REF: github.com/ETCLabs/EtcPalDocs.git
GH_REPO_TOKEN: $SVC_ETCLABS_REPO_TOKEN
script:
- pip install --upgrade etcdevtool
- chmod +x tools/ci/publish_docs.sh
- tools/ci/publish_docs.sh