-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
config.yml
240 lines (236 loc) · 6.91 KB
/
config.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
version: 2.1
references:
pre_checkout: &pre_checkout
run:
name: Pre Checkout
command: |
stat -c '%y' /opt/ros/$ROS_DISTRO/setup.sh | \
sha256sum | \
awk '{print "distro "$1}' > /opt/ros/$ROS_DISTRO/checksum.txt
cp $NAV2_WS/src/navigation2/tools/ros2_dependencies.repos $ROS_WS/
rm -rf $NAV2_WS/*
post_checkout: &post_checkout
run:
name: Post Checkout
command: |
rm $NAV2_WS/src/navigation2/nav2_system_tests/COLCON_IGNORE
if ! cmp $NAV2_WS/src/navigation2/tools/ros2_dependencies.repos $ROS_WS/ros2_dependencies.repos >/dev/null 2>&1
then
echo "Cleaning Upstream"
rm -rf $ROS_WS/*
mkdir -p $ROS_WS/src
vcs import $ROS_WS/src < $NAV2_WS/src/navigation2/tools/ros2_dependencies.repos
fi
install_upstream: &install_upstream
run:
name: Install Upstream
command: |
cat /opt/ros/$ROS_DISTRO/checksum.txt > $ROS_WS/checksum.txt
find $ROS_WS/src -not -iwholename '*.git/*' -type f -exec sha256sum {} \; | \
sort -k 2 | \
cut -d" " -f1 | \
sha256sum | \
awk '{print "upstream source "$1}' >> $ROS_WS/checksum.txt
apt-get update
dependencies=$(
rosdep install -q -y \
--from-paths \
$ROS_WS/src \
--ignore-src \
--verbose | \
awk '$1 ~ /^resolution\:/' | \
awk -F'[][]' '{print $2}' | \
tr -d \, | xargs -n1 | sort -u | xargs)
dpkg -s $dependencies | \
sha256sum | \
awk '{print "upstream dependencies "$1}' >> $ROS_WS/checksum.txt
restore_upstream_cache: &restore_upstream_cache
restore_cache:
name: Restore Upstream Cache
key: upstream-cache-v1-{{ arch }}-{{ checksum "/opt/ros_ws/checksum.txt" }}
build_upstream: &build_upstream
run:
name: Build Upstream
command: |
cd $ROS_WS
if [ -d install ]
then
echo "Skipping Build Upstream"
else
. /opt/ros/$ROS_DISTRO/setup.sh
colcon build \
--symlink-install \
--cmake-args \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE
fi
save_upstream_cache: &save_upstream_cache
save_cache:
name: Save Upstream Cache
key: upstream-cache-v1-{{ arch }}-{{ checksum "/opt/ros_ws/checksum.txt" }}
paths:
- /opt/ros_ws
install_dependencies: &install_dependencies
run:
name: Install Dependencies
command: |
cat $ROS_WS/checksum.txt > $NAV2_WS/checksum.txt
find $NAV2_WS/src -not -iwholename '*.git/*' -type f -exec sha256sum {} \; | \
sort -k 2 | \
cut -d" " -f1 | \
sha256sum | \
awk '{print "source "$1}' >> $NAV2_WS/checksum.txt
apt-get update
dependencies=$(
rosdep install -q -y \
--from-paths \
$ROS_WS/src \
src \
--ignore-src \
--verbose | \
awk '$1 ~ /^resolution\:/' | \
awk -F'[][]' '{print $2}' | \
tr -d \, | xargs -n1 | sort -u | xargs)
dpkg -s $dependencies | \
sha256sum | \
awk '{print "dependencies "$1}' >> $NAV2_WS/checksum.txt
store_build_checksum: &store_build_checksum
store_artifacts:
path: checksum.txt
restore_build_cache: &restore_build_cache
restore_cache:
name: Restore Build Cache
key: build-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "/opt/nav2_ws/checksum.txt" }}
source_build: &source_build
run:
name: Source Build
command: |
if [ -d install ]
then
echo "Skipping Source Build"
else
. $ROS_WS/install/setup.sh
colcon build \
--symlink-install \
--cmake-args \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
-DCOVERAGE_ENABLED=$COVERAGE_ENABLED
fi
save_build_cache: &save_build_cache
save_cache:
name: Save Build Cache
key: build-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "/opt/nav2_ws/checksum.txt" }}
paths:
- /opt/nav2_ws
copy_build_logs: ©_build_logs
run:
name: Copy Build Logs
when: always
command: cp -rH log/latest_build log/build
store_build_logs: &store_build_logs
store_artifacts:
path: log/build
test_build: &test_build
run:
name: Test Build
command: |
. install/setup.sh
src/navigation2/tools/run_test_suite.bash
copy_test_logs: ©_test_logs
run:
name: Copy Test Logs
when: always
command: cp -rH log/latest_test log/test
store_test_logs: &store_test_logs
store_artifacts:
path: log/test
report_code_coverage: &report_code_coverage
run:
name: Report Code Coverage
command: |
if [ "$COVERAGE_ENABLED" = "True" ]
then
. install/setup.sh
src/navigation2/tools/code_coverage_report.bash codecovio
else
echo "Skipping Code Coverage Report"
fi
commands:
checkout_source:
description: "Checkout Source"
steps:
- *pre_checkout
- checkout:
path: src/navigation2
- *post_checkout
setup_upstream:
description: "Setup Upstream"
steps:
- *install_upstream
- *restore_upstream_cache
- *build_upstream
- *save_upstream_cache
build_source:
description: "Build Source"
steps:
- *install_dependencies
- *store_build_checksum
- *restore_build_cache
- *source_build
- *save_build_cache
- *copy_build_logs
- *store_build_logs
test_source:
description: "Test Source"
steps:
- *test_build
- *copy_test_logs
- *store_test_logs
report_coverage:
description: "Report Coverage"
steps:
- *report_code_coverage
executors:
docker_exec:
docker:
- image: rosplanning/navigation2:master
working_directory: /opt/nav2_ws
environment:
MAKEFLAGS: "-j 1 -l 1"
jobs:
debug_build:
executor: docker_exec
environment:
CMAKE_BUILD_TYPE: "Debug"
COVERAGE_ENABLED: "True"
steps:
- checkout_source
- setup_upstream
- build_source
- test_source
- report_coverage
release_build:
executor: docker_exec
environment:
CMAKE_BUILD_TYPE: "Release"
COVERAGE_ENABLED: "False"
steps:
- checkout_source
- setup_upstream
- build_source
- test_source
workflows:
version: 2
build-test:
jobs:
- debug_build
- release_build
# nightly:
# triggers:
# - schedule:
# cron: "0 0 * * *"
# filters:
# branches:
# only:
# - master
# jobs:
# - build