-
Notifications
You must be signed in to change notification settings - Fork 1
245 lines (219 loc) · 7.69 KB
/
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
# Basic continous integration for sdk-samples
# Copyright 2023 Labforge Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# @author Thomas Reidemeister <[email protected]>
#
# To setup a self-hosted runner to test this on Linux
# (1) Setup a Windows 10 machine with autologin
# (2) Register a Github actions runner on that machine, run from startup (not as headless service runner)
# (3) Install eBus SDK, and ros humble
name: ContinousIntegration
on:
push:
branches: [ ]
tags:
- 'v*'
workflow_dispatch:
jobs:
build_hil:
runs-on: HIL
steps:
- name: Check out samples
uses: actions/checkout@v3
with:
lfs: true
submodules: true
path: driver
- name: Create environment script
run: |
source /opt/ros/humble/setup.sh
rosdep update
# If this fails, install the missing dependencies manually
rosdep install -i --from-path . --rosdistro humble -y
- name: Build driver
run: |
source /opt/ros/humble/setup.sh
export _colcon_cd_root=$(pwd)
colcon build --symlink-install
source install/local_setup.sh
cd driver
colcon build --symlink-install
cd ..
source install/local_setup.sh
- name: Test ROS tests
run: |
source /opt/ros/humble/setup.sh
export _colcon_cd_root=$(pwd)
source install/local_setup.sh
source /opt/pleora/ebus_sdk/Ubuntu-22.04-x86_64/bin/set_puregev_env.sh
cd driver
colcon test
colcon test-result
cd ..
- name: Evaluate test results
if: failure()
run: |
cd driver
cat build/bottlenose_camera_driver/Testing/Temporary/LastTest.log
cd ..
- name: Check out CI helpers
uses: actions/checkout@v3
with:
repository: labforge/ContinousIntegration
token: ${{ secrets.CITOKEN }}
path: .github/workflows/ci
- name: Lock HIL
uses: ./.github/workflows/ci/lock
with:
state: 'lock'
- name: Power off CI
uses: ./.github/workflows/ci/power
with:
state: 'off'
- name: Checkout sdk utilities for ftp-based updater
uses: actions/checkout@v3
with:
lfs: true
repository: labforge/sdk-demos
token: ${{ secrets.CITOKEN }}
path: ./demos
- name: "Download latest firmware"
uses: robinraju/[email protected]
with:
repository: "labforge/bottlenose"
latest: true
fileName: "firmware-bottlenose*.tar"
tarBall: false
zipBall: false
out-file-path: "firmware"
- name: Power on mono CI
uses: ./.github/workflows/ci/power
with:
state: 'on'
channel: 1
- name: Find Bottlenose sensor
uses: ./.github/workflows/ci/find
- name: Install utility requirements for updater and flash firware to mono
run: |
cd ./demos/utility/
rm -rf venv || true
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
source /opt/pleora/ebus_sdk/Ubuntu-22.04-x86_64/bin/set_puregev_env.sh
python uploader.py -t firmware -i "$(</tmp/bottlenose.ip)" -f ./../../firmware/firmware-bottlenose*.tar
- name: Power off CI for testing
uses: ./.github/workflows/ci/power
with:
state: 'off'
- name: Settle for power off
run: |
sleep 1
- name: Power on CI for testing
uses: ./.github/workflows/ci/power
with:
state: 'on'
channel: 1
- name: Find Bottlenose sensor
uses: ./.github/workflows/ci/find
- name: Run integration tests
run: |
export BOTTLENOSE=$(cat /tmp/bottlenose.ip)
echo "Bottlenose IP:" ${BOTTLENOSE}
source /opt/ros/humble/setup.sh
source /opt/pleora/ebus_sdk/Ubuntu-22.04-x86_64/bin/set_puregev_env.sh
source install/local_setup.sh
cd driver
./build/bottlenose_camera_driver/test_integration
cd ..
- name: Power off CI
uses: ./.github/workflows/ci/power
if: always()
with:
state: 'off'
- name: Unlock HIL
uses: ./.github/workflows/ci/lock
if: always()
with:
state: 'unlock'
- name: Clear artifact cache
if: always()
run: |
rm -rf firmware || true
rm -rf demos || true
build_foxy:
runs-on: ubuntu-20.04
steps:
- name: Install OS dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libopencv-dev locales \
software-properties-common curl libcurl4-openssl-dev
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
sudo add-apt-repository universe
sudo apt update
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update
sudo apt install -y ros-foxy-ros-base ros-dev-tools python3-rosdep
sudo rosdep init
source /opt/ros/foxy/setup.bash
sudo rosdep update --include-eol-distros
- name: Check out Pleora SDK backing
uses: actions/checkout@v3
with:
repository: labforge/pleora_backing
lfs: true
token: ${{ secrets.CITOKEN }}
submodules: true
path: pleora
- name: Install Pleora 20.04 SDK
run: |
sudo dpkg -i pleora/eBUS_SDK_Ubuntu-20.04-x86_64-6.3.0-6343.deb
sudo apt-get install -f -y
- name: Check out driver
uses: actions/checkout@v3
with:
lfs: true
submodules: true
path: driver
- name: Build ros2 driver for foxy
run: |
cd driver
source /opt/ros/foxy/setup.sh
rosdep update --include-eol-distros
rosdep install -i --from-path . --rosdistro foxy -y
export _colcon_cd_root=$(pwd)
colcon build --symlink-install
source install/local_setup.sh
cd ..
- name: Test driver
run: |
cd driver
source /opt/ros/foxy/setup.sh
export _colcon_cd_root=$(pwd)
source install/local_setup.sh
source /opt/pleora/ebus_sdk/Ubuntu-20.04-x86_64/bin/set_puregev_env.sh
colcon test
colcon test-result
cd ..
- name: Evaluate test results
if: failure()
run: |
cd driver
cat build/bottlenose_camera_driver/Testing/Temporary/LastTest.log
cd ..