-
Notifications
You must be signed in to change notification settings - Fork 7
/
.gitlab-ci.yml
292 lines (244 loc) · 6.63 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
# Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <[email protected]>
#
# This file is part of aimbots-src.
#
# aimbots-src 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.
#
# aimbots-src 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 aimbots-src. If not, see <https://www.gnu.org/licenses/>.
default:
image: aruw/mcb-2020-gitlab-ci:2021-06-02.1
variables:
ARTIFACT_PATH: isolated-deploy
GIT_SUBMODULE_STRATEGY: normal
DEFAULT_BUILD_ELF_FILE: build/hardware/scons-release/aimbots-src.elf
DEFAULT_TESTS_BUILD_ELF_FILE: build/tests/scons-fast/aimbots-src-tests.elf
NUM_JOBS: 4
.verification_except: &verification_except
- schedules
stages:
- Build
- Test
- Quality
- Deploy Pages
before_script:
- python3 -V # Print out python version for debugging
# Quality
# Last stage, but configured to not depend on preceding jobs
clang-format:
stage: Quality
needs: []
script:
- python3 /run-clang-format.py --clang-format-executable clang-format-10 -r aimbots-dev/src/ aimbots-dev/test/
except: *verification_except
"Policy Checks":
stage: Quality
variables:
GIT_SUBMODULE_STRATEGY: recursive
script:
- python3 ./taproot-scripts/check_singleton_drivers.py DoNotUse_getDrivers
-p ./aimbots-dev/src/
-w drivers_singleton.cpp
drivers_singleton.hpp
main.cpp
- python3 ./taproot-scripts/check_license_headers.py
-p aimbots-dev
-i './**/__init__.py' 'taproot/**/*' 'taproot-scripts/**/*' 'aimbots-dev/taproot/**/*' 'docs/**/*' 'aimbots-dev/robot-type/robot_type.hpp'
-o 'Advanced Robotics at the University of Washington'
- python3 ./taproot-scripts/check_header_guard.py aimbots-dev/src aimbots-dev/test/
- ./taproot-scripts/check_taproot_submodule.sh ./aimbots-dev ./taproot
except: *verification_except
# Hidden jobs to be extended for each robot
.hw_build:
stage: Build
script:
- cd aimbots-src
- python3 $(which scons) build robot=TARGET_$ROBOT -j${NUM_JOBS} additional-ccflags=-Werror
- python3 $(which scons) size robot=TARGET_$ROBOT -j${NUM_JOBS} additional-ccflags=-Werror > size.txt
- python3 ../taproot-scripts/parse_metrics.py -i size.txt -o metrics.txt --identifier $ROBOT
- cp $DEFAULT_BUILD_ELF_FILE ../$ARTIFACT_PATH/aimbots-src-$ROBOT.elf
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-$ROBOT-mcb"
paths:
- $ARTIFACT_PATH/*
expire_in: 2 weeks
reports:
metrics: metrics.txt
.sim_build:
stage: Build
script:
- cd aimbots-src
- python3 $(which scons) build-sim profile=fast robot=TARGET_$ROBOT -j${NUM_JOBS}
.test_build:
stage: Build
script:
- cd aimbots-src
- python3 $(which scons) build-tests profile=fast robot=TARGET_$ROBOT -j${NUM_JOBS}
artifacts:
paths:
- aimbots-src/$DEFAULT_TESTS_BUILD_ELF_FILE
.test_run:
stage: Test
script:
- cd aimbots-src
- valgrind --leak-check=full --error-exitcode=1 --show-leak-kinds=all $DEFAULT_TESTS_BUILD_ELF_FILE
# Standard
"Standard: build for hardware":
extends:
- .hw_build
variables:
ROBOT: STANDARD
"Standard: build for sim":
extends:
- .sim_build
variables:
ROBOT: STANDARD
"Standard: build for tests":
extends:
- .test_build
variables:
ROBOT: STANDARD
"Standard: run tests":
# The Standard's test run is also evaluated for code coverage and used as the repo-level coverage report
needs: [ "Standard: build for tests" ]
dependencies: [ "Standard: build for tests" ]
extends:
- .test_run
variables:
ROBOT: STANDARD
script:
- cd aimbots-src
- valgrind --leak-check=full --error-exitcode=1 --show-leak-kinds=all $DEFAULT_TESTS_BUILD_ELF_FILE
- cd .. && gcovr -g --xml > cobertura.xml
- 'sed -i "s=<source>.</source>=<source>./aimbots-src</source>=g" cobertura.xml'
- 'sed -i "s;filename=\";filename=\"aimbots-src/;g" cobertura.xml'
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-standard-tests"
reports:
cobertura: cobertura.xml
expire_in: 2 weeks
# Drone
"Drone: build for hardware":
extends:
- .hw_build
variables:
ROBOT: DRONE
"Drone: build for sim":
extends:
- .sim_build
variables:
ROBOT: DRONE
"Drone: build for tests":
extends:
- .test_build
variables:
ROBOT: DRONE
"Drone: run tests":
needs: [ "Drone: build for tests" ]
dependencies: [ "Drone: build for tests" ]
extends:
- .test_run
variables:
ROBOT: DRONE
# Engineer
"Engineer: build for hardware":
extends:
- .hw_build
variables:
ROBOT: ENGINEER
"Engineer: build for sim":
extends:
- .sim_build
variables:
ROBOT: ENGINEER
"Engineer: build for tests":
extends:
- .test_build
variables:
ROBOT: ENGINEER
"Engineer: run tests":
needs: [ "Engineer: build for tests" ]
dependencies: [ "Engineer: build for tests" ]
extends:
- .test_run
variables:
ROBOT: ENGINEER
# Hero
"Hero: build for hardware":
extends:
- .hw_build
variables:
ROBOT: HERO
"Hero: build for sim":
extends:
- .sim_build
variables:
ROBOT: HERO
"Hero: build for tests":
extends:
- .test_build
variables:
ROBOT: HERO
"Hero: run tests":
needs: [ "Hero: build for tests" ]
dependencies: [ "Hero: build for tests" ]
extends:
- .test_run
variables:
ROBOT: HERO
# Sentry
"Sentry: build for hardware":
extends:
- .hw_build
variables:
ROBOT: SENTRY
"Sentry: build for sim":
extends:
- .sim_build
variables:
ROBOT: SENTRY
"Sentry: build for tests":
extends:
- .test_build
variables:
ROBOT: SENTRY
"Sentry: run tests":
needs: [ "Sentry: build for tests" ]
dependencies: [ "Sentry: build for tests" ]
extends:
- .test_run
variables:
ROBOT: SENTRY
# Pages deploy
pages:
image: alpine
stage: Deploy Pages
variables:
GIT_SUBMODULE_STRATEGY: none
before_script:
- apk update
- apk add py-pip python3-dev
- apk add make
- apk add --no-cache g++ gcc libxml2-dev libxslt-dev
- pip3 install lxml
- pip3 install sphinx breathe exhale
- pip install sphinx_rtd_theme
- apk add doxygen
script:
- cd docs && make html
- mv _build/html/ ../public/
artifacts:
paths:
- public
only:
- develop
except:
- schedules