SE-2737 (#23) #176
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 --event-handlers console_direct+ | |
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 python3-venv python3-pip | |
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 | |
pip install -r test_requirements.txt | |
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 --event-handlers console_direct+ --packages-select bottlenose_camera_driver --ctest-args -R cpplint_test --rerun-failed --output-on-failure | |
colcon test-result | |
cd .. | |
- name: Evaluate test results | |
if: failure() | |
run: | | |
cd driver | |
cat build/bottlenose_camera_driver/Testing/Temporary/LastTest.log | |
cd .. |