-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
235 lines (208 loc) · 6 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
# Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <[email protected]>
#
# This file is part of Taproot.
#
# Taproot is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Taproot is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Taproot. If not, see <https://www.gnu.org/licenses/>.
default:
image: aruw/mcb-2020-gitlab-ci:2021-06-02.1
variables:
GIT_SUBMODULE_STRATEGY: recursive
NUM_JOBS: 4
ADDITIONAL_CI_BUILD_ARGS: -j${NUM_JOBS} additional-ccflags=-Werror
.default_only: &default_only
- merge_requests
- master
- develop
- schedules
.verification_only: &verification_only
- merge_requests
- master
- develop
.verification_except: &verification_except
- schedules
stages:
- Initial Verification
- Generate Test Project
- Build all Targets
- Deploy Pages
before_script:
- python3 -V # Print out python version for debugging
# Initial verification
"Clang Format":
stage: Initial Verification
needs: []
script:
- python3 /run-clang-format.py --clang-format-executable clang-format-10 -r src/ test/
only: *verification_only
except: *verification_except
"Policy Checks":
stage: Initial Verification
needs: []
script:
- python3 ./taproot-scripts/check_singleton_drivers.py DoNotUse_getDrivers -p src
- python3 ./taproot-scripts/check_license_headers.py
-p Taproot
-o 'Advanced Robotics at the University of Washington'
-i './modm/**/*'
'./test-project/taproot/**/*'
'./taproot-scripts/**/*'
'./**/__init__.py'
'./docs/**/*.py'
'./src/tap/algorithms/MahonyAHRS.*'
'./ext/**/*'
- python3 ./taproot-scripts/check_header_guard.py
src test
-p TAPROOT_
-i src/tap/algorithms/MahonyAHRS.h
src/tap/display/sh1106_impl.hpp
src/tap/display/sh1106_mock_impl.hpp
variables:
GIT_SUBMODULE_STRATEGY: normal
only: *verification_only
except: *verification_except
.run_lbuild:
script:
- cd test-project && lbuild build && cd ..
artifacts:
paths:
- test-project
.type_a_config_dependencies:
needs: ["Type A: Generate Test Project"]
dependencies: ["Type A: Generate Test Project"]
.type_c_config_dependencies:
needs: ["Type C: Generate Test Project"]
dependencies: ["Type C: Generate Test Project"]
.mcb_build:
stage: "Build all Targets"
only: *default_only
script:
- cd test-project
- scons build $ADDITIONAL_CI_BUILD_ARGS
.sim_build:
stage: "Build all Targets"
only: *default_only
script:
- cd test-project
- scons build-sim profile=fast $ADDITIONAL_CI_BUILD_ARGS
.tests_build:
stage: "Build all Targets"
only: *default_only
variables:
GIT_SUBMODULE_STRATEGY: normal
script:
- cd test-project
- scons run-tests-gcov profile=fast $ADDITIONAL_CI_BUILD_ARGS
- valgrind --leak-check=full --error-exitcode=1 --show-leak-kinds=all build/tests/scons-fast/test-project-tests.elf
- cd .. && gcovr -g --xml > cobertura.xml
- 'sed -i "s;filename=\"taproot/;filename=\";g" cobertura.xml'
- python3 ./taproot-scripts/shift_cobertura_line_numbers.py --shift-lines -4 --package-names 'taproot.(src|test).*' --out-file cobertura.xml
coverage: '/\s+Total:\|(\d+.\d+\%).+\|.+\|.+/'
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-tests"
reports:
coverage_report:
coverage_format: cobertura
path: cobertura.xml
expire_in: 2 weeks
"Type A: Generate Test Project":
needs: []
only: *default_only
stage: Generate Test Project
extends:
- .run_lbuild
variables:
BOARD_TYPE: type_a
"Type C: Generate Test Project":
needs: []
stage: Generate Test Project
only: *default_only
extends:
- .run_lbuild
before_script:
- cd test-project
- sed -i '/<!-- For RoboMaster Development Board Type A -->/,/<!-- End For RoboMaster Development Board Type A -->/c\' project.xml
- sed -i '/<!-- For RoboMaster Development Board Type C --> <!--/c\' project.xml
- sed -i '/--> <!-- End For RoboMaster Development Board Type C -->/c\' project.xml
- cd ..
variables:
BOARD_TYPE: type_c
# Type A CI
"Type A: MCB Build":
extends:
- .type_a_config_dependencies
- .mcb_build
"Type A: Sim Build":
extends:
- .type_a_config_dependencies
- .sim_build
"Type A: Tests Build":
extends:
- .type_a_config_dependencies
- .tests_build
# Type C CI
"Type C: MCB Build":
extends:
- .type_c_config_dependencies
- .mcb_build
"Type C: Sim Build":
extends:
- .type_c_config_dependencies
- .sim_build
"Type C: Tests Build":
extends:
- .type_c_config_dependencies
- .tests_build
# Pages deploy
"Generate Docs":
image: alpine
needs: []
stage: Deploy Pages
before_script:
- apk update
- apk add py-pip python3-dev
- apk add make
- apk add --no-cache g++ gcc libxml2-dev libxslt-dev
- python3 -m venv .venv
- source .venv/bin/activate
- python3 -m pip install lxml
- python3 -m pip install sphinx breathe exhale
- python3 -m pip install sphinx_rtd_theme
- apk add doxygen
script:
- cd docs && make html
- mv _build/html/ ../public/
artifacts:
paths:
- public
only:
- develop
- merge_requests
environment:
name: "docs preview ${CI_COMMIT_REF_SLUG}"
url: "https://aruw.gitlab.io/-/controls/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/index.html"
pages:
image: alpine
needs: ["Generate Docs"]
dependencies: ["Generate Docs"]
stage: Deploy Pages
before_script:
- "true"
script: "true"
artifacts:
paths:
- public
only:
- develop
except:
- schedules