Skip to content

push ros2-master to ros2-development (#3543) #1393

push ros2-master to ros2-development (#3543)

push ros2-master to ros2-development (#3543) #1393

Workflow file for this run

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 }}
container:
image: ros:${{ matrix.ros_distro }}-ros-core
env:
ROS_DISTRO: ${{ matrix.ros_distro }}
strategy:
fail-fast: false
matrix:
ros_distro: [humble, jazzy, kilted]
include:
- ros_distro: 'kilted'
os: ubuntu-24.04
- ros_distro: 'jazzy'
os: ubuntu-24.04
- ros_distro: 'humble'
os: ubuntu-22.04
steps:
- name: Install build tools
run: |
apt-get update
apt-get install -y python3-rosdep python3-colcon-common-extensions \
git cmake build-essential libusb-1.0-0-dev sudo file
rosdep init || true
rosdep update --rosdistro ${{ matrix.ros_distro }} --include-eol-distros
- name: Setup ROS2 Workspace
run: |
mkdir -p $GITHUB_WORKSPACE/ros2/src
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #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
- name: Check package.xml dependency completeness
shell: bash
run: |
cd $GITHUB_WORKSPACE/ros2/src/realsense-ros/scripts
./check_package_deps.sh $GITHUB_WORKSPACE/ros2/src/realsense-ros
- name: Build librealsense2 from development branch
run: |
cd /tmp
git clone --depth 1 --branch development https://github.com/realsenseai/librealsense.git
cd librealsense
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=false -DBUILD_GRAPHICAL_EXAMPLES=false
make -j$(nproc)
make install
ldconfig
- name: Install declared dependencies only (strict, like build farm)
shell: bash
run: |
source /opt/ros/${ROS_DISTRO}/setup.bash
cd $GITHUB_WORKSPACE/ros2
echo "================= ROSDEP INSTALL ===================="
rosdep install -i --reinstall --from-path src --rosdistro ${{ matrix.ros_distro }} --skip-keys=librealsense2 -y
- name: Build RealSense ROS2 Wrapper from source
shell: bash
run: |
set -e
# Source ROS environment
source /opt/ros/${ROS_DISTRO}/setup.bash
cd $GITHUB_WORKSPACE/ros2
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
# Set PYTHONPATH to ensure CMake-spawned Python processes can find ament_package
PYTHONPATH=/opt/ros/${ROS_DISTRO}/lib/python3/dist-packages:$PYTHONPATH \
colcon build --symlink-install --merge-install --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://realsenseai.com/rs-tests/TestData/outdoors_1color.bag";
# wget $bag_filename -P "records/"
# bag_filename="https://realsenseai.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 Humble/Jazzy/Kilted Tests
shell: bash
run: |
apt-get install -y python3-pip python3-venv
# 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
# 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
pip3 install typing_extensions
pip3 install empy
pip install lark-parser
- name: Run Tests
shell: bash
run: |
source /opt/ros/${ROS_DISTRO}/setup.bash
cd $GITHUB_WORKSPACE/ros2
. install/local_setup.bash
source $GITHUB_WORKSPACE/.venv/bin/activate
python3 src/realsense-ros/realsense2_camera/scripts/rs2_test.py non_existent_file
# tf_ros_py are not avaialble
# TODO: check when we can run integration tests on rolling
- name: Run integration tests
shell: bash
run: |
source /opt/ros/${ROS_DISTRO}/setup.bash
cd $GITHUB_WORKSPACE/ros2
. install/local_setup.bash
#export ROSBAG_FILE_PATH=$GITHUB_WORKSPACE/ros2/records/
colcon test --merge-install --packages-select realsense2_camera --event-handlers console_direct+
colcon test-result --all --test-result-base build/realsense2_camera/test_results/ --verbose