Add CI for ROS2. #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Test | |
on: | |
push: | |
branches: [ jazzy ] | |
pull_request: | |
branches: [ jazzy ] | |
jobs: | |
Linting: | |
name: Lint Code Base | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup | |
run: | | |
sudo apt-get update && sudo apt-get install -y clang-format cppcheck libxml2-utils | |
- name: Lint C++ | |
run: | | |
clang-format -Werror -n -style=file $(find . -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -o -name '*.c' -o -name '*.cc') | |
- name: Check C++ | |
run: | | |
cppcheck --force --quiet --error-exitcode=1 . | |
- name: Lint package.xml | |
run: | | |
xmllint --noout --schema http://download.ros.org/schema/package_format3.xsd $(find . -name 'package.xml') | |
build-and-test: | |
needs: Linting | |
runs-on: ubuntu-latest | |
# Disable asan new-delete-type-mismatch to workaround rcutils issue | |
# https://github.com/ros2/rclcpp/issues/2220 | |
env: | |
ASAN_OPTIONS: new_delete_type_mismatch=0 | |
strategy: | |
matrix: | |
ros_distro: [humble, jazzy] | |
container: | |
image: ros:${{matrix.ros_distro}}-ros-base | |
steps: | |
- uses: ros-tooling/[email protected] | |
with: | |
required-ros-distributions: ${{ matrix.ros_distro }} | |
- uses: ros-tooling/[email protected] | |
with: | |
target-ros2-distro: ${{ matrix.ros_distro }} | |
colcon-defaults: | # Use asan to find memory issues | |
{ | |
"build": { | |
"mixin": ["asan-gcc"] | |
} | |
} |