Skip to content

Feature CI (#1)

Feature CI (#1) #3

name: CI Pipeline
on:
push:
branches:
- ros2
pull_request:
branches:
- ros2
defaults:
run:
shell: bash
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++ code
run: |
echo "Linting C++ code..."
clang-format -Werror -n -style=file $(find . -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -o -name '*.c' -o -name '*.cc')
- name: Run cppcheck on C++ code
run: |
echo "Running cppcheck on C++ code..."
cppcheck --force --quiet --error-exitcode=1 --language=c++ $(find . -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -o -name '*.c' -o -name '*.cc')
- 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
container:
image: ros:jazzy-ros-base
steps:
- name: install build tools
run: |
sudo apt-get update
sudo apt-get install -y ros-dev-tools
- uses: actions/checkout@v4
with:
path: src/e_stop_manager
- name: rosdep
run: |
rosdep update --rosdistro jazzy --include-eol-distros
rosdep install -y --from-paths src --ignore-src --rosdistro jazzy
- name: build
run: |
source /opt/ros/jazzy/setup.bash
colcon build
- name: test
run: |
source /opt/ros/jazzy/setup.bash
colcon test --packages-select e_stop_manager
colcon test-result --verbose