Files
PX4-Autopilot/.github/workflows/ros_integration_tests.yml
T
Ramon Roche b28ba0eedb ci(ros2): test PR firmware in the ROS development container
Build each PR firmware and matching ROS workspace from source against the digest-pinned Jazzy toolchain. Run the interface library unit and SIH integration suites without reusing stale firmware or generated messages.

Assisted-by: Copilot:gpt-6-astra
2026-09-10 16:07:58 -07:00

103 lines
3.2 KiB
YAML

name: ROS Integration Tests
on:
push:
branches: [main]
paths-ignore: ['docs/**']
pull_request:
branches: ['**']
paths-ignore: ['docs/**']
workflow_dispatch:
inputs:
px4_ros2_ref:
description: 'Interface-library commit SHA; empty uses Tools/ros2/ros2.repos'
type: string
default: ''
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
runs-on: [runs-on,runner=8cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache]
container:
image: ghcr.io/px4/px4-dev-ros2:main-jazzy@sha256:975ade27fd951721bc1ca96519b004998358fa289d27b8c967548b8ab83d8689
defaults:
run:
shell: bash
env:
PX4_SBOM_DISABLE: 1
CMAKE_BUILD_PARALLEL_LEVEL: 8
steps:
- uses: runs-on/action@v2
- uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Configure checkout ownership
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: ./.github/actions/setup-ccache
id: ccache
with:
cache-key-prefix: ccache-ros-integration-jazzy-${{ runner.arch }}
max-size: 1G
- name: Test ROS runner arguments
run: python3 -m unittest discover -s test -p 'test_ros_test_runner.py'
- name: Build PR firmware
run: |
git rev-parse HEAD
make px4_sitl_sih
test -x build/px4_sitl_sih/bin/px4
- name: Prepare matching ROS sources
env:
PX4_ROS2_REF: ${{ inputs.px4_ros2_ref }}
run: |
python3 Tools/ros2/prepare_workspace.py /opt/px4_ros2_ci "$PX4_ROS2_REF"
- name: Build ROS workspace
run: |
source /opt/ros/jazzy/setup.bash
cd /opt/px4_ros2_ci
sudo apt-get update -qq
rosdep update --rosdistro jazzy
rosdep install --from-paths src --ignore-src --rosdistro jazzy -y
colcon build --symlink-install --executor sequential --cmake-args \
-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
colcon test --packages-select px4_ros2_cpp --ctest-args -R unit_tests
colcon test-result --verbose
- name: Run SIH integration tests
run: |
source /opt/px4_ros2_ci/install/setup.bash
test/ros_test_runner.py --verbose --model quadx --force-color \
--config-file test/ros_tests/config-sih.json \
--build-dir build/px4_sitl_sih \
--px4-ros2-interface-lib-build-dir /opt/px4_ros2_ci/build/px4_ros2_cpp \
--log-dir logs/ros-sih
timeout-minutes: 45
- uses: ./.github/actions/save-ccache
if: always() && steps.ccache.outcome == 'success'
with:
cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }}
- name: Upload failed logs
if: failure()
uses: actions/upload-artifact@v7
with:
name: ros-integration-failed-logs
path: |
logs/**/**/**/*.log
logs/**/**/**/*.ulg
build/px4_sitl_sih/tmp_ros_tests/rootfs/fs/log/**/*.ulg
/opt/px4_ros2_ci/log