CI: Add tmate debugging #3
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 and run ROS tests | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
jobs: | |
build: | |
strategy: | |
matrix: | |
rosdistro: [noetic] | |
runs-on: ubuntu-latest | |
container: | |
image: ros:${{ matrix.rosdistro }}-ros-core | |
steps: | |
# Enable tmate debugging of manually-triggered workflows if the input option was provided | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
with: | |
detached: true | |
- name: Install apt dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential clang-format-10 file git python3-catkin-lint python3-pip python3-rosdep | |
- name: Install pip dependencies | |
run: pip install pre-commit | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
path: src/rospy_message_converter | |
- name: Use rosdep to install remaining dependencies | |
run: | | |
sudo rosdep init | |
rosdep update | |
rosdep install --from-paths src -i -y --rosdistro ${{ matrix.rosdistro }} | |
- name: Build | |
run: | | |
. /opt/ros/${{ matrix.rosdistro }}/setup.sh | |
catkin_make install | |
- name: Run tests | |
run: | | |
. devel/setup.sh | |
CTEST_OUTPUT_ON_FAILURE=1 catkin_make test | |
cd src/rospy_message_converter | |
python3 src/rospy_message_converter/json_message_converter.py | |
python3 src/rospy_message_converter/message_converter.py | |
- name: Run pre-commit hooks | |
run: | | |
cd src/rospy_message_converter | |
pre-commit run -a |