-
Notifications
You must be signed in to change notification settings - Fork 1.8k
171 lines (151 loc) · 7.06 KB
/
main.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
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the ros2-development branch
push:
branches:
- ros2-development
- ros2-master
pull_request:
branches:
- ros2-development
- ros2-master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions: read-all
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
# This workflow contains a single job called "build"
jobs:
build:
name: Build on ROS2 ${{ matrix.ros_distro }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ros_distro: [rolling, iron, humble, foxy, jazzy]
include:
- ros_distro: 'rolling'
os: ubuntu-24.04
- ros_distro: 'jazzy'
os: ubuntu-24.04
- ros_distro: 'iron'
os: ubuntu-22.04
- ros_distro: 'humble'
os: ubuntu-22.04
- ros_distro: 'foxy'
os: ubuntu-20.04
steps:
- name: Setup ROS2 Workspace
run: |
mkdir -p ${{github.workspace}}/ros2/src
- uses: actions/checkout@v4
with:
path: 'ros2/src/realsense-ros'
- name: Check Copyright & Line-Endings
shell: bash
run: |
cd ${{github.workspace}}/ros2/src/realsense-ros/scripts
./pr_check.sh
# setup-ros@v0.6 is the last version supporting foxy (EOL)
# setup-ros@v0.7 is needed to support humble/iron/rolling/jazzy
# so, seperating steps with if conditions
- name: build ROS2 for foxy
if: ${{ matrix.ros_distro == 'foxy' }}
uses: ros-tooling/setup-ros@v0.6
with:
required-ros-distributions: ${{ matrix.ros_distro }}
- name: build ROS2 for humble/iron/rolling/jazzy
if: ${{ matrix.ros_distro != 'foxy' }}
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: ${{ matrix.ros_distro }}
- name: Checkout librealsense/development
uses: actions/checkout@v4
with:
repository: IntelRealSense/librealsense
path: librealsense
ref: development
- name: Build RealSense SDK 2.0 (development branch) from source
run: |
# libusb-1.0-0-dev is needed for librealsense build in ubuntu 20.04
# This apt install command will be ignored in ubuntu 22.04 as libusb-1.0-0-dev already installed there
sudo apt install -y libusb-1.0-0-dev
cd ${{github.workspace}}/librealsense
sudo mkdir build
cd build
sudo cmake ../ -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=false -DBUILD_GRAPHICAL_EXAMPLES=false
sudo make uninstall
sudo make clean
sudo make -j10
sudo make install
- name: Build RealSense ROS2 Wrapper from source
run: |
echo "source /opt/ros/${{ matrix.ros_distro }}/setup.bash" >> ${{github.workspace}}/.bashrc
source ${{github.workspace}}/.bashrc
cd ${{github.workspace}}/ros2
echo "================= ROSDEP UPDATE ====================="
rosdep update --rosdistro ${{ matrix.ros_distro }} --include-eol-distros
echo "================= ROSDEP INSTALL ===================="
rosdep install -i --reinstall --from-path src --rosdistro ${{ matrix.ros_distro }} --skip-keys=librealsense2 -y
echo "================== COLCON BUILD ======================"
# Enable 'BUILD_TOOLS' through cmake arguments. Since, this variable is available only in realsense2_camera package
# and not in realsense2_camera_msgs and realsense2_description packages, to avoid warnings from these packages,
# use '--no-warn-unused-cli'. Ref: https://cmake.org/cmake/help/v3.0/manual/cmake.1.html
colcon build --cmake-args '-DBUILD_TOOLS=ON' --no-warn-unused-cli
## This step is commented out since we don't use rosbag files in "Run Tests" step below.
## Please uncomment when "Run Tests" step is fixed to run all tests.
#- name: Download Data For Tests
# if: ${{ matrix.ros_distro != 'rolling'}}
# run: |
# cd ${{github.workspace}}/ros2
# bag_filename="https://librealsense.intel.com/rs-tests/TestData/outdoors_1color.bag";
# wget $bag_filename -P "records/"
# bag_filename="https://librealsense.intel.com/rs-tests/D435i_Depth_and_IMU_Stands_still.bag";
# wget $bag_filename -P "records/"
# sudo apt install ros-${{ matrix.ros_distro}}-launch-pytest
- name: Install Packages For Foxy Tests
if: ${{ matrix.ros_distro == 'foxy' }}
run: |
# To avoid mixing of 'apt' provided packages and 'pip' provided packages, one way is to create virtual env
# and manage python packages within it. Ref: https://peps.python.org/pep-0668/
python3 -m venv .venv
# Activate the virtual env such that following python related commands run within it.
source .venv/bin/activate
sudo apt-get install python3-pip
# numpy-quaternion needs numpy<2.0.0. Chose 1.24.1 as it is the highest version that support foxy.
pip3 install --force-reinstall numpy==1.24.1
pip3 install numpy-quaternion tqdm pyyaml
- name: Install Packages For Humble/Iron/Rolling/Jazzy Tests
if: ${{ matrix.ros_distro != 'foxy' }}
run: |
# To avoid mixing of 'apt' provided packages and 'pip' provided packages, one way is to create virtual env
# and manage python packages within it. Ref: https://peps.python.org/pep-0668/
python3 -m venv .venv
# Activate the virtual env such that following python related commands run within it.
source .venv/bin/activate
sudo apt-get install python3-pip
# numpy-quaternion needs numpy<2.0.0. Chose 1.26.4 as it is the lowest working version for ubuntu 24.04.
pip3 install --force-reinstall numpy==1.26.4
pip3 install numpy-quaternion tqdm pyyaml
- name: Run Tests
run: |
cd ${{github.workspace}}/ros2
source ${{github.workspace}}/.bashrc
. install/local_setup.bash
# the next command might be needed for foxy distro, since this package is not installed
# by default in ubuntu 20.04. For other distro, the apt install command will be ignored.
sudo apt install -y ros-${{matrix.ros_distro}}-sensor-msgs-py
source ../.venv/bin/activate
python3 src/realsense-ros/realsense2_camera/scripts/rs2_test.py non_existent_file
# don't run integration tests for foxy since some testing dependecies packages like
# tf_ros_py are not avaialble
# TODO: check when we can run integration tests on rolling
- name: Run integration tests
if: ${{ matrix.ros_distro != 'rolling' && matrix.ros_distro != 'foxy' }}
run: |
cd ${{github.workspace}}/ros2
source ${{github.workspace}}/.bashrc
. install/local_setup.bash
#export ROSBAG_FILE_PATH=${{github.workspace}}/ros2/records/
colcon test --packages-select realsense2_camera --event-handlers console_direct+
colcon test-result --all --test-result-base build/realsense2_camera/test_results/ --verbose