-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
441 lines (381 loc) · 11.1 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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <robomstr@uw.edu>
#
# This file is part of aruw-mcb.
#
# aruw-mcb 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.
#
# aruw-mcb 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 aruw-mcb. 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
BUILD_PATH: aruw-mcb-project/build
NUM_JOBS: 4
ADDITIONAL_CI_BUILD_ARGS: -j${NUM_JOBS} additional-ccflags=-Werror
.default_only: &default_only
- merge_requests
- develop
- schedules
.default_except: &default_except
variables:
- $UPDATE_SUBMODULE
.verification_only: &verification_only
- merge_requests
- develop
.verification_except: &verification_except
- schedules
stages:
- Quality
- Build Libraries
- Tests
- Build
- Deploy Pages
before_script:
- python3 -V # Print out python version for debugging
# Quality
"Clang Format":
stage: Quality
script:
- python3 /run-clang-format.py --clang-format-executable clang-format-10 -r aruw-mcb-project/src/ aruw-mcb-project/test/
only: *verification_only
except: *verification_except
"Policy Checks":
stage: Quality
variables:
GIT_SUBMODULE_STRATEGY: recursive
script:
- python3 ./taproot-scripts/check_singleton_drivers.py DoNotUse_getDrivers
-p ./aruw-mcb-project/src/
-w aruwsrc/drivers_singleton.cpp
aruwsrc/drivers_singleton.hpp
aruwsrc/robot/engineer/engineer_control.cpp
aruwsrc/robot/sentry/sentry_control.cpp
aruwsrc/robot/standard/standard_control.cpp
aruwsrc/robot/drone/drone_control.cpp
aruwsrc/robot/dart/dart_control.cpp
aruwsrc/robot/hero/hero_control.cpp
aruwsrc/robot/testbed/testbed_control.cpp
aruwsrc/robot/blank/blank_control.cpp
aruwsrc/robot/motor_tester/motor_tester_control.cpp
main.cpp
- python3 ./taproot-scripts/check_license_headers.py
-p aruw-mcb
-i './**/__init__.py' 'taproot/**/*' 'taproot-scripts/**/*' 'aruw-mcb-project/taproot/**/*' 'docs/**/*' 'aruw-mcb-project/robot-type/robot_type.hpp'
-o 'Advanced Robotics at the University of Washington'
- python3 ./taproot-scripts/check_header_guard.py aruw-mcb-project/src aruw-mcb-project/test/
- ./taproot-scripts/check_taproot_submodule.sh ./aruw-mcb-project ./taproot "release develop"
only: *verification_only
except: *verification_except
# Hidden jobs to be extended for each robot
.mcb_build:
stage: Build
only: *default_only
except: *default_except
needs: ["MCB Lib Build"]
script:
- cd aruw-mcb-project
- scons build robot=$ROBOT $ADDITIONAL_CI_BUILD_ARGS
- scons size robot=$ROBOT $ADDITIONAL_CI_BUILD_ARGS > size.txt
- python3 ../taproot-scripts/parse_metrics.py -i size.txt -o metrics.txt --identifier $ROBOT
- cp build/hardware/scons-release/TARGET_$ROBOT/aruw-mcb.elf ../$ARTIFACT_PATH/aruw-mcb-$ROBOT.elf
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-$ROBOT-mcb"
paths:
- $ARTIFACT_PATH/*
expire_in: 2 weeks
reports:
metrics: metrics.txt
cache:
- key: mcb-libs-$CI_COMMIT_REF_SLUG
paths:
- aruw-mcb-project/build/hardware/scons-release/modm/
- aruw-mcb-project/build/hardware/scons-release/src/tap/
- aruw-mcb-project/build/hardware/scons-release/.sconsign
policy: pull
- key: robot-$ROBOT-$CI_COMMIT_REF_SLUG
paths:
- aruw-mcb-project/build/hardware/scons-release/TARGET_$ROBOT/
fallback_keys:
- robot-$ROBOT-develop
when: 'always'
.test_build:
stage: Tests
only: *default_only
except: *default_except
needs: ["Test Lib Build"]
script:
- cd aruw-mcb-project
- scons build-tests profile=fast robot=$ROBOT -j${NUM_JOBS}
- valgrind --leak-check=full --error-exitcode=1 --show-leak-kinds=all build/tests/scons-fast/TARGET_$ROBOT/aruw-mcb-tests.elf
cache:
- key: mcb-test-libs-$CI_COMMIT_REF_SLUG
paths:
- aruw-mcb-project/build/tests/scons-fast/modm/
- aruw-mcb-project/build/tests/scons-fast/src/tap/
- aruw-mcb-project/build/tests/scons-fast/test/tap/
- aruw-mcb-project/build/tests/scons-fast/.sconsign
policy: pull
- key: robot-$ROBOT-$CI_COMMIT_REF_SLUG-test
paths:
- aruw-mcb-project/build/tests/scons-fast/TARGET_$ROBOT/
fallback_keys:
- robot-$ROBOT-develop-test
when: 'always'
# Generic build, done before other builds which then use shared cache to build faster
"MCB Lib Build":
stage: Build Libraries
only: *default_only
except: *default_except
needs: []
variables:
GIT_SUBMODULE_STRATEGY: none
script:
- cd aruw-mcb-project
- scons build robot=STANDARD_SPIDER compile_lib_only=mcb $ADDITIONAL_CI_BUILD_ARGS
cache:
key: mcb-libs-$CI_COMMIT_REF_SLUG
paths:
- aruw-mcb-project/build/hardware/scons-release/modm/
- aruw-mcb-project/build/hardware/scons-release/src/tap/
- aruw-mcb-project/build/hardware/scons-release/.sconsign
fallback_keys:
- mcb-libs-develop
when: 'always'
"Test Lib Build":
stage: Build Libraries
only: *default_only
except: *default_except
needs: []
script:
- cd aruw-mcb-project
- scons build robot=STANDARD_SPIDER compile_lib_only=test profile=fast -j${NUM_JOBS}
cache:
key: mcb-test-libs-$CI_COMMIT_REF_SLUG
paths:
- aruw-mcb-project/build/tests/scons-fast/modm/
- aruw-mcb-project/build/tests/scons-fast/src/tap/
- aruw-mcb-project/build/tests/scons-fast/test/tap/
- aruw-mcb-project/build/tests/scons-fast/.sconsign
fallback_keys:
- mcb-test-libs-develop
when: 'always'
# Standard (Spider) build
"Standard (Spider): MCB Build":
extends:
- .mcb_build
variables:
ROBOT: STANDARD_SPIDER
# Test build script is different from the others since we use this one to track test coverage for the repo
"Standard (Spider): Test Build":
stage: Tests
needs: []
only: *default_only
except: *default_except
script:
- cd aruw-mcb-project
- scons run-tests-gcov profile=fast robot=STANDARD_SPIDER -j${NUM_JOBS}
- valgrind --leak-check=full --error-exitcode=1 --show-leak-kinds=all build/tests/scons-fast/TARGET_STANDARD_SPIDER/aruw-mcb-tests.elf
- cd .. && gcovr -g --xml > cobertura.xml
- 'sed -i "s=<source>.</source>=<source>./aruw-mcb-project</source>=g" cobertura.xml'
- 'sed -i "s;filename=\";filename=\"aruw-mcb-project/;g" cobertura.xml'
coverage: '/\s+Total:\|(\d+.\d+\%).+\|.+\|.+/'
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-standard-tests"
reports:
coverage_report:
coverage_format: cobertura
path: cobertura.xml
expire_in: 2 weeks
cache:
key: robot-STANDARD_SPIDER-$CI_COMMIT_REF_SLUG-tests
paths:
- aruw-mcb-project/build/tests/scons-fast/
fallback_keys:
- robot-STANDARD_SPIDER-develop-tests
when: 'always'
# Standard (Orion) build
"Standard (Orion): MCB Build":
extends:
- .mcb_build
variables:
ROBOT: STANDARD_ORION
"Standard (Orion): Test Build":
extends:
- .test_build
variables:
ROBOT: STANDARD_ORION
# Standard (Cygnus) build
"Standard (Cygnus): MCB Build":
extends:
- .mcb_build
variables:
ROBOT: STANDARD_CYGNUS
"Standard (Cygnus): Test Build":
extends:
- .test_build
variables:
ROBOT: STANDARD_CYGNUS
# Drone build
"Drone: MCB Build":
extends:
- .mcb_build
variables:
ROBOT: DRONE
"Drone: Test Build":
extends:
- .test_build
variables:
ROBOT: DRONE
# Engineer build
"Engineer: MCB Build":
extends:
- .mcb_build
variables:
ROBOT: ENGINEER
"Engineer: Test Build":
extends:
- .test_build
variables:
ROBOT: ENGINEER
# Hero build
"Hero: MCB Build":
extends:
- .mcb_build
variables:
ROBOT: HERO_PERSEUS
"Hero: Test Build":
extends:
- .test_build
variables:
ROBOT: HERO_PERSEUS
# Sentry (Beehive) build
"Sentry: MCB Build":
extends:
- .mcb_build
variables:
ROBOT: SENTRY_HYDRA
"Sentry: Test Build":
extends:
- .test_build
variables:
ROBOT: SENTRY_HYDRA
# Dart Build
"Dart: MCB Build":
extends:
- .mcb_build
variables:
ROBOT: DART
"Dart: Test Build":
extends:
- .test_build
variables:
ROBOT: DART
# Testbed Build
"Testbed: MCB Build":
extends:
- .mcb_build
variables:
ROBOT: TESTBED
"Testbed: Test Build":
extends:
- .test_build
variables:
ROBOT: TESTBED
# Blank Build
"Blank: MCB Build":
extends:
- .mcb_build
variables:
ROBOT: BLANK
"Blank: Test Build":
extends:
- .test_build
variables:
ROBOT: BLANK
# Motor Tester Build
"Motor Tester: MCB Build":
extends:
- .mcb_build
variables:
ROBOT: MOTOR_TESTER
# Pages deploy
"Generate Docs":
image: alpine
needs: []
variables:
GIT_SUBMODULE_STRATEGY: none
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
except:
- schedules
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"]
variables:
GIT_SUBMODULE_STRATEGY: none
stage: Deploy Pages
before_script:
- "true"
script: "true"
artifacts:
paths:
- public
only:
- develop
except:
- schedules
"Update Submodule":
stage: Quality
needs: []
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- apt-get update -y && apt-get install -yqqf curl openssh-client git unzip sshpass rsync --fix-missing
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY_TOOLKIT" | base64 -d | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git config --global user.email "robomstr@uw.edu"
- git config --global user.name "Gitlab Runner"
- git remote rm origin
- git remote add origin git@gitlab.com:aruw/controls/aruw-mcb.git
script:
- ./taproot-scripts/update_taproot_submodule.sh ./aruw-mcb-project 20675733 develop
only:
variables:
- $UPDATE_SUBMODULE