Skip to content

feat(ros2agnocast): add topic info cmd base #500

feat(ros2agnocast): add topic info cmd base

feat(ros2agnocast): add topic info cmd base #500

Workflow file for this run

name: build test
on:
pull_request:
types:
- labeled
env:
CARGO_TERM_COLOR: always
jobs:
build_and_test:
if: ${{ github.event.label.name == 'run-build-test' }}
runs-on: ubuntu-22.04
steps:
- name: Set PR fetch depth
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
- name: Check for .cpp or .hpp file changes
id: check_changes_cpp
run: |
if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -E '(agnocastlib|agnocast_ioctl_wrapper)/.*\.(cpp|hpp)$'; then
echo ".cpp or .hpp files changed"
echo "cpp_changed=true" >> $GITHUB_OUTPUT
else
echo "No .cpp or .hpp files changed"
echo "cpp_changed=false" >> $GITHUB_OUTPUT
fi
# TODO: Cache
- name: Setup ROS 2 environment
if: steps.check_changes_cpp.outputs.cpp_changed == 'true' || steps.check_changes_rust.outputs.rust_changed == 'true'
run: |
sudo apt update
sudo apt install -y software-properties-common curl gcovr
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update
sudo DEBIAN_FRONTEND=noninteractive apt upgrade -y
sudo apt install -y ros-humble-desktop python3-colcon-common-extensions ros-humble-ament-cmake python3-colcon-mixin
- name: Install dependencies
if: steps.check_changes_cpp.outputs.cpp_changed == 'true' || steps.check_changes_rust.outputs.rust_changed == 'true'
run: |
source /opt/ros/humble/setup.bash
sudo apt install -y python3-rosdep
sudo rosdep init
rosdep update
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
- name: Build src
if: steps.check_changes_cpp.outputs.cpp_changed == 'true' || steps.check_changes_rust.outputs.rust_changed == 'true'
run: |
source /opt/ros/humble/setup.bash
colcon build --cmake-args -DCOVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=1
- name: Run clang-tidy for agnocastlib
if: steps.check_changes_cpp.outputs.cpp_changed == 'true'
run: |
export FILES=($(find src/agnocastlib/ -name '*.cpp' -not -path '*/test/*'))
run-clang-tidy -j $(nproc) -p build/ "${FILES[@]}"
- name: Test for agnocastlib
if: steps.check_changes_cpp.outputs.cpp_changed == 'true' || steps.check_changes_rust.outputs.rust_changed == 'true'
id: test
uses: autowarefoundation/autoware-github-actions/colcon-test@v1
with:
rosdistro: humble
target-packages: agnocastlib
- name: Display coverage report in PR comment
if: ${{ steps.test.outputs.coverage-report-files != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gcovr -r . --exclude ".*/test/.*" --exclude ".*/_deps/.*" --txt > coverage.txt
coverage_text=$(<coverage.txt)
gh pr comment ${{ github.event.pull_request.number }} --body "$(echo -e '```\n'"$coverage_text"'\n```')"