Skip to content

Feat whell class

Feat whell class #48

Workflow file for this run

name: ROS Tests
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
ros-tests:
name: Run ROS Tests
runs-on: ubuntu-24.04
env:
ROS_DISTRO: jazzy
COLCON_PACKAGES: >
littlebot
littlebot_base
littlebot_bringup
littlebot_control
littlebot_description
littlebot_localization
littlebot_navigation
littlebot_teleop
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
path: ros_ws/src
- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Setup ROS 2
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: ${{ env.ROS_DISTRO }}
skip-rosdep: true
- name: Install Python dependencies for ROS
shell: bash
run: |
python3 -m pip install --upgrade pip
python3 -m pip install catkin_pkg
- name: Install dependencies
run: |
source /opt/ros/$ROS_DISTRO/setup.sh
cd ros_ws
./src/install_dependencies.sh
- name: Build workspace
run: |
source /opt/ros/$ROS_DISTRO/setup.sh
cd ros_ws
colcon build \
--symlink-install \
--packages-select $COLCON_PACKAGES \
--cmake-args -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="--coverage" -DCMAKE_C_FLAGS="--coverage" \
- name: Run tests
run: |
source /opt/ros/$ROS_DISTRO/setup.sh
cd ros_ws
source install/setup.bash
colcon test \
--packages-select $COLCON_PACKAGES \
--event-handlers console_direct+ \
- name: Generate code coverage report
run: |
source /opt/ros/$ROS_DISTRO/setup.sh
cd ros_ws
lcov \
--capture \
--directory . \
--base-directory src \
--output-file coverage.info \
--ignore-errors mismatch,mismatch,gcov
lcov \
--extract coverage.info "littlebot*" \
--output-file coverage.info.cleaned \
--ignore-errors unused
lcov \
--remove coverage.info.cleaned \
"*/install/*" \
"*/build/*" \
--output-file coverage.info.cleaned \
--ignore-errors unused
- name: Upload coverage to Codecov (optional)
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: codecov/codecov-action@v4
with:
file: ./coverage.info.cleaned
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}