Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 45 additions & 8 deletions .ci_local_test/ros2_openvino_toolkit_test/docker_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,63 @@ export work_dir=$PWD

function run_container()
{
if docker images -q ros2_openvino_docker:01 &>/dev/null; then
if [ -n "$(docker images -q ros2_openvino_docker:01)" ]; then
echo "The container ros2_openvino_docker:01 image exists"
docker rmi -f ros2_openvino_docker:01
fi

docker ps -a | grep ros2_openvino_container
if docker ps -aq -f name=ros2_openvino_container; then
if [ -n "$(docker ps -aq -f name=ros2_openvino_container)" ]; then
echo "The container ros2_openvino_container exists. Removing the container..."
docker rm -f ros2_openvino_container
fi

# Removing some docker image ..
# Using jenkins server ros2_openvino_toolkit code instead of git clone code.
cd "$work_dir" && sed -i '/RUN git clone -b ros2/d' Dockerfile
# Removing ros2_openvino_toolkit git clone from Dockerfile
# We'll copy it from the host instead (to test local changes)
cd "$work_dir" && sed -i '/RUN git clone.*ros2_openvino_toolkit/d' Dockerfile
# add the jpg for test.
cd "$work_dir" && sed -i '$i COPY jpg /root/jpg' Dockerfile
cd "$work_dir" && sed -i '/^WORKDIR \/root\/ros2_ws$/a COPY jpg /root/jpg' Dockerfile || \
cd "$work_dir" && sed -i '/^WORKDIR \/root\/catkin_ws$/a COPY jpg /root/jpg' Dockerfile

cd "$work_dir" && docker build --build-arg ROS_PRE_INSTALLED_PKG=galactic-desktop --build-arg VERSION=galactic -t ros2_openvino_docker:01 .
# Detect ROS distro from Dockerfile
if grep -q "ros:jazzy" Dockerfile; then
ROS_DISTRO="jazzy"
WORKSPACE_DIR="ros2_ws"
elif grep -q "ros:humble" Dockerfile; then
ROS_DISTRO="humble"
WORKSPACE_DIR="ros2_ws"
elif grep -q "ros:galactic" Dockerfile; then
ROS_DISTRO="galactic"
WORKSPACE_DIR="catkin_ws"
else
ROS_DISTRO="galactic"
WORKSPACE_DIR="catkin_ws"
fi

cd "$work_dir" && docker build --build-arg ROS_PRE_INSTALLED_PKG=${ROS_DISTRO}-desktop --build-arg VERSION=${ROS_DISTRO} -t ros2_openvino_docker:01 .
cd "$work_dir" && docker images
docker run -i --privileged=true --device=/dev/dri -v "$work_dir"/ros2_openvino_toolkit:/root/catkin_ws/src/ros2_openvino_toolkit -v "$HOME"/.Xauthority:/root/.Xauthority -e GDK_SCALE -v "$work_dir"/test_cases:/root/test_cases --name ros2_openvino_container ros2_openvino_docker:01 bash -c "cd /root/test_cases && ./run.sh galactic"

# Create container in detached mode
docker create -i --privileged=true --device=/dev/dri \
-v "$work_dir"/ros2_openvino_toolkit:/root/${WORKSPACE_DIR}/src/ros2_openvino_toolkit \
-v "$HOME"/.Xauthority:/root/.Xauthority \
-e GDK_SCALE \
--name ros2_openvino_container \
ros2_openvino_docker:01 \
bash

# Copy test files into container
docker cp "$work_dir"/test_cases ros2_openvino_container:/root/

# Start container and fix permissions inside (critical for GitHub Actions)
docker start ros2_openvino_container
docker exec ros2_openvino_container chmod -R a+rx /root/test_cases

# Run tests
docker exec -i ros2_openvino_container bash -c "cd /root/test_cases && ./run.sh ${ROS_DISTRO}"

# Stop container (keeps it for debugging)
docker stop ros2_openvino_container
}

if ! run_container; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ else
export ros2_branch=$1
fi

export dynamic_vino_sample=/root/catkin_ws/install/openvino_node/share/openvino_node
# Detect workspace directory based on ROS distro
if [[ "$ros2_branch" == "jazzy" ]] || [[ "$ros2_branch" == "humble" ]]; then
export WORKSPACE_DIR=/root/ros2_ws
else
export WORKSPACE_DIR=/root/catkin_ws
fi

export dynamic_vino_sample=${WORKSPACE_DIR}/install/openvino_node/share/openvino_node


source /opt/ros/$ros2_branch/setup.bash
10 changes: 6 additions & 4 deletions .ci_local_test/ros2_openvino_toolkit_test/test_cases/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@ fi
#shellcheck source=/dev/null
source /root/test_cases/config.sh "$ros2_branch"

cd /root/catkin_ws && colcon build --symlink-install
# Clean build artifacts to avoid symlink conflicts
cd ${WORKSPACE_DIR} && rm -rf build install log
cd ${WORKSPACE_DIR} && colcon build
# shellcheck source=/dev/null
source ./install/local_setup.bash

apt-get update
# apt-get install -y ros-$ros2_branch-diagnostic-updater
apt-get install python3-defusedxml
apt-get install -y python3-defusedxml
apt-get install -y python3-pip
pip3 install XTestRunner==1.5.0
pip3 install XTestRunner==1.5.0 --break-system-packages

cd /root/test_cases && ./ros2_openvino_tool_model_download.sh
mkdir -p /root/test_cases/log
echo "===cat pipeline_people_ci.yaml"
cat /root/catkin_ws/install/openvino_node/share/openvino_node/param/pipeline_people_ci.yaml
cat ${WORKSPACE_DIR}/install/openvino_node/share/openvino_node/param/pipeline_people_ci.yaml

cd /root/test_cases/unittest && python3 run_all.py
result=$?
Expand Down
42 changes: 18 additions & 24 deletions .github/workflows/basic_func_tests.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,35 @@
# This is a basic workflow to help you get started with Actions
# GitHub Actions workflow file to run basic functional tests for ros2_openvino_toolkit on multiple Ubuntu versions

name: Basic_Func_CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master", "ros2" ]
pull_request:
branches: [ "master", "ros2" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

permissions:
contents: read

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Removed the old artifacts
remove-old-artifacts:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: '15 days'
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job

runs-on: ${{ matrix.ubuntu-version }}
strategy:
fail-fast: false
matrix:
ubuntu-version: [ubuntu-22.04, ubuntu-24.04]
include:
- ubuntu-version: ubuntu-22.04
dockerfile: docker/ros2_ov202x/ros2_humble/Dockerfile
- ubuntu-version: ubuntu-24.04
dockerfile: docker/ros2_ov2025/ros2_jazzy/Dockerfile

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a set of commands using the runners shell
- name: Checkout repository
uses: actions/checkout@v4

- name: ros2_openvino_toolkit_test
run: |
df -h
Expand All @@ -45,8 +39,8 @@ jobs:
mkdir -p ../workspace
cp -r ${GITHUB_WORKSPACE}/.ci_local_test/ros2_openvino_toolkit_test ../workspace
cp -r ${GITHUB_WORKSPACE} ../workspace/ros2_openvino_toolkit_test
ls ${GITHUB_WORKSPACE}/docker/Dockerfile
cp ${GITHUB_WORKSPACE}/docker/Dockerfile ../workspace/ros2_openvino_toolkit_test
ls ${GITHUB_WORKSPACE}/${{ matrix.dockerfile }}
cp ${GITHUB_WORKSPACE}/${{ matrix.dockerfile }} ../workspace/ros2_openvino_toolkit_test/Dockerfile
ls ../workspace/ros2_openvino_toolkit_test/Dockerfile
cd ../workspace/ros2_openvino_toolkit_test && ./docker_run.sh

38 changes: 15 additions & 23 deletions .github/workflows/code_format.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,35 @@
# This workflow checks code formatting using clang-format on push and pull request events to the master and ros2 branches.

name: Code_Format_Check

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master", "ros2" ]
pull_request:
branches: [ "master", "ros2" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

permissions:
contents: read

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Removed the old artifacts
remove-old-artifacts:
code-format-check:
runs-on: ubuntu-22.04
timeout-minutes: 10

steps:
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: '15 days'
pre-commit:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a set of commands using the runners shell
- name: code_format_check
- name: Checkout repository
uses: actions/checkout@v4

- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format-14

- name: Run clang-format check
run: |
sudo apt-get install clang-format -y
find . -name '*.h' -or -name '*.hpp' -or -name '*.cpp' | xargs clang-format -i -style=file
git diff --exit-code
FILES=$(find . -type f \( -name '*.h' -o -name '*.hpp' -o -name '*.cpp' \) \
! -path "*/build/*" ! -path "*/install/*" ! -path "*/log/*")

clang-format --dry-run --Werror -style=file $FILES

55 changes: 55 additions & 0 deletions .github/workflows/ubuntu-22.04-humble.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Ubuntu-22.04-Humble-CI

on:
push:
branches: [ "ros2" ]
pull_request:
branches: [ "ros2" ]

permissions: read-all

jobs:
build:
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: install ros2 humble
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: humble
- run: "source /opt/ros/humble/setup.bash && ros2 run --help"

- name: install openvino 2024.6
run: |
# https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-archive-linux.html
sudo apt update && sudo apt install -y curl wget gnupg2 lsb-release
wget https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.6/linux/l_openvino_toolkit_ubuntu22_2024.6.0.17404.4c0f47d2335_x86_64.tgz
tar -xf l_openvino_toolkit_ubuntu22_2024.6.0.17404.4c0f47d2335_x86_64.tgz
sudo mkdir -p /opt/intel
sudo mv l_openvino_toolkit_ubuntu22_2024.6.0.17404.4c0f47d2335_x86_64 /opt/intel/openvino_2024
source /opt/intel/openvino_2024/setupvars.sh
ls -lh /opt/intel/openvino_2024

- name: install librealsense2
run: |
# https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md
sudo mkdir -p /etc/apt/keyrings
curl -sSf https://librealsense.realsenseai.com/Debian/librealsense.pgp | sudo tee /etc/apt/keyrings/librealsense.pgp > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/librealsense.pgp] https://librealsense.realsenseai.com/Debian/apt-repo `lsb_release -cs` main" | sudo tee /etc/apt/sources.list.d/librealsense.list
sudo apt-get update && sudo apt-get install -y librealsense2-dev librealsense2-utils
dpkg -l |grep realsense

- name: build ros2 openvino toolkit
run: |
mkdir -p ~/ros2_ws/src
env
cp -rf ${GITHUB_WORKSPACE} ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/intel/ros2_object_msgs.git
cd ros2_object_msgs && git checkout ros2 && cd ~/ros2_ws/
source /opt/ros/humble/setup.bash
source /opt/intel/openvino_2024/setupvars.sh
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
55 changes: 55 additions & 0 deletions .github/workflows/ubuntu-24.04-jazzy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Ubuntu-24.04-Jazzy-CI

on:
push:
branches: [ "ros2" ]
pull_request:
branches: [ "ros2" ]

permissions: read-all

jobs:
build:
runs-on: ubuntu-24.04

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: install ros2 jazzy
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: jazzy
- run: "source /opt/ros/jazzy/setup.bash && ros2 run --help"

- name: install openvino 2025.4
run: |
# https://docs.openvino.ai/2025/get-started/install-openvino/install-openvino-archive-linux.html
sudo apt update && sudo apt install -y curl wget gnupg2 lsb-release
wget https://storage.openvinotoolkit.org/repositories/openvino/packages/2025.4/linux/openvino_toolkit_ubuntu24_2025.4.0.20398.8fdad55727d_x86_64.tgz
tar -xf openvino_toolkit_ubuntu24_2025.4.0.20398.8fdad55727d_x86_64.tgz
sudo mkdir -p /opt/intel
sudo mv openvino_toolkit_ubuntu24_2025.4.0.20398.8fdad55727d_x86_64 /opt/intel/openvino_2025
source /opt/intel/openvino_2025/setupvars.sh
ls -lh /opt/intel/openvino_2025

- name: install librealsense2
run: |
# Install from Intel apt repository for Ubuntu 24.04 (noble)
sudo mkdir -p /etc/apt/keyrings
curl -sSf https://librealsense.realsenseai.com/Debian/librealsense.pgp | sudo tee /etc/apt/keyrings/librealsense.pgp > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/librealsense.pgp] https://librealsense.realsenseai.com/Debian/apt-repo `lsb_release -cs` main" | sudo tee /etc/apt/sources.list.d/librealsense.list
sudo apt-get update
sudo apt-get install -y librealsense2-dev librealsense2-utils

- name: build ros2 openvino toolkit
run: |
mkdir -p ~/ros2_ws/src
env
cp -rf ${GITHUB_WORKSPACE} ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/intel/ros2_object_msgs.git
cd ros2_object_msgs && git checkout ros2 && cd ~/ros2_ws/
source /opt/ros/jazzy/setup.bash
source /opt/intel/openvino_2025/setupvars.sh
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
*.vscode
microsoft.gpg
*.swp
/install
/log
/build
__pycache__/
*.pyc
*.pyo
Loading