Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Add GitHub actions #67

Merged
merged 3 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
# The line length here has to match the black config in pyproject.toml
max-line-length = 120
exclude =
.git,
__pycache__
extend-ignore =
# See https://github.com/PyCQA/pycodestyle/issues/373
E203,
53 changes: 53 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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: [humble, iron, rolling]
fail-fast: false
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: |
apt-get update
apt-get install -y build-essential clang-format file git python3-pip python3-colcon-common-extensions python3-rosdep pre-commit
- name: Checkout repository
uses: actions/checkout@v4
with:
path: src/rospy_message_converter
- name: Use rosdep to install remaining dependencies
run: |
rosdep init
rosdep update
rosdep install --from-paths src -i -y --rosdistro ${{ matrix.rosdistro }}
- name: Build
run: |
. /opt/ros/${{ matrix.rosdistro }}/setup.sh
colcon build --parallel-workers 1
- name: Run tests
run: |
. install/setup.sh
colcon test --parallel-workers 1
colcon test-result
- name: Run pre-commit hooks
run: |
cd src/rospy_message_converter
pre-commit run -a
11 changes: 0 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,3 @@ repos:
rev: 5.0.4
hooks:
- id: flake8

- repo: local
hooks:
- id: catkin_lint
name: catkin_lint
description: Check package.xml and cmake files
entry: catkin_lint .
language: system
always_run: true
pass_filenames: false
args: [ "--strict" ]
5 changes: 3 additions & 2 deletions rclpy_message_converter/test/test_message_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,14 +458,15 @@ def test_dictionary_with_uint8_array_bytes_unencoded(self):
'rclpy_message_converter_msgs/msg/Uint8ArrayTestMessage', dictionary
)
error_msg = context.exception.args[0]
self.assertIn(error_msg, ['Incorrect padding', 'Non-base64 digit found'])
self.assertIn(error_msg, ['Incorrect padding', 'Non-base64 digit found', 'Only base64 data is allowed'])

dictionary = {'data': bytes(bytearray([1, 97, 97, 2, 3, 97, 4, 97]))}
with self.assertRaises(binascii.Error) as context:
message_converter.convert_dictionary_to_ros_message(
'rclpy_message_converter_msgs/msg/Uint8ArrayTestMessage', dictionary
)
self.assertEqual('Non-base64 digit found', context.exception.args[0])
error_msg = context.exception.args[0]
self.assertIn(error_msg, ['Incorrect padding', 'Non-base64 digit found', 'Only base64 data is allowed'])

def test_dictionary_with_3uint8_array_bytes(self):
from rclpy_message_converter_msgs.msg import Uint8Array3TestMessage
Expand Down
Loading