Skip to content

ROS2 Tests

ROS2 Tests #79

Workflow file for this run

# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
# Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# 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.
#
# SPDX-License-Identifier: Apache-2.0
name: ROS2 Tests
on:
push:
branches: [ "**" ] # Run on all branches
env:
ROS_LOCALHOST_ONLY: 1
ROS_AUTOMATIC_DISCOVERY_RANGE: LOCALHOST
jobs:
test:
name: Test ROS2 ${{ matrix.ros_distro }}
runs-on: ubuntu-latest
container:
image: ros:${{ matrix.ros_distro }}-ros-base-${{ matrix.ubuntu_distro }}
credentials:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
include:
- ros_distro: humble
ubuntu_distro: jammy
- ros_distro: iron
ubuntu_distro: jammy
- ros_distro: jazzy
ubuntu_distro: noble
- ros_distro: kilted
ubuntu_distro: noble
- ros_distro: rolling
ubuntu_distro: noble
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup ROS environment
run: |
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
apt-get update -qq && apt-get install -y build-essential python3-pip
shell: bash
- name: Install Python dependencies
run: |
if [[ "${{ matrix.ros_distro }}" == "jazzy" || \
"${{ matrix.ros_distro }}" == "kilted" || \
"${{ matrix.ros_distro }}" == "rolling" ]]; then
pip3 install --break-system-packages -I pygments textual
else
pip3 install textual
fi
shell: bash
- name: Build packages
run: |
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
echo "Building and testing on ROS2 ${{ matrix.ros_distro }}"
colcon build --packages-up-to r2s_gw
shell: bash
- name: Smoke test README commands
run: |
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
source install/setup.bash
set -e
timeout 10s bash -lc "script -qfec 'ros2 run greenwave_monitor ncurses_dashboard' /dev/null <<< \$'q'" || true
timeout 10s bash -lc "script -qfec 'ros2 run greenwave_monitor r2s_gw_dashboard' /dev/null <<< \$'q'" || true
timeout 5s ros2 launch greenwave_monitor hz.launch.py topics:='["/topic1"]' || true
shell: bash
- name: Run tests
run: |
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
colcon test --event-handlers console_direct+ --return-code-on-test-failure --packages-up-to r2s_gw
shell: bash
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.ros_distro }}
path: build/*/test_results/**/*.xml
retention-days: 7