Skip to content

Commit 613df5d

Browse files
authored
Merge pull request #67 from mintar/add-github-actions-ros2
CI: Add GitHub actions
2 parents 5b5feed + c0e24ca commit 613df5d

File tree

4 files changed

+65
-13
lines changed

4 files changed

+65
-13
lines changed

.flake8

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[flake8]
2+
# The line length here has to match the black config in pyproject.toml
3+
max-line-length = 120
4+
exclude =
5+
.git,
6+
__pycache__
7+
extend-ignore =
8+
# See https://github.com/PyCQA/pycodestyle/issues/373
9+
E203,

.github/workflows/github-actions.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build and run ROS tests
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
inputs:
7+
debug_enabled:
8+
type: boolean
9+
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
10+
required: false
11+
default: false
12+
jobs:
13+
build:
14+
strategy:
15+
matrix:
16+
rosdistro: [humble, iron, rolling]
17+
fail-fast: false
18+
runs-on: ubuntu-latest
19+
container:
20+
image: ros:${{ matrix.rosdistro }}-ros-core
21+
steps:
22+
# Enable tmate debugging of manually-triggered workflows if the input option was provided
23+
- name: Setup tmate session
24+
uses: mxschmitt/action-tmate@v3
25+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
26+
with:
27+
detached: true
28+
- name: Install apt dependencies
29+
run: |
30+
apt-get update
31+
apt-get install -y build-essential clang-format file git python3-pip python3-colcon-common-extensions python3-rosdep pre-commit
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
with:
35+
path: src/rospy_message_converter
36+
- name: Use rosdep to install remaining dependencies
37+
run: |
38+
rosdep init
39+
rosdep update
40+
rosdep install --from-paths src -i -y --rosdistro ${{ matrix.rosdistro }}
41+
- name: Build
42+
run: |
43+
. /opt/ros/${{ matrix.rosdistro }}/setup.sh
44+
colcon build --parallel-workers 1
45+
- name: Run tests
46+
run: |
47+
. install/setup.sh
48+
colcon test --parallel-workers 1
49+
colcon test-result
50+
- name: Run pre-commit hooks
51+
run: |
52+
cd src/rospy_message_converter
53+
pre-commit run -a

.pre-commit-config.yaml

-11
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,3 @@ repos:
4242
rev: 5.0.4
4343
hooks:
4444
- id: flake8
45-
46-
- repo: local
47-
hooks:
48-
- id: catkin_lint
49-
name: catkin_lint
50-
description: Check package.xml and cmake files
51-
entry: catkin_lint .
52-
language: system
53-
always_run: true
54-
pass_filenames: false
55-
args: [ "--strict" ]

rclpy_message_converter/test/test_message_converter.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -458,14 +458,15 @@ def test_dictionary_with_uint8_array_bytes_unencoded(self):
458458
'rclpy_message_converter_msgs/msg/Uint8ArrayTestMessage', dictionary
459459
)
460460
error_msg = context.exception.args[0]
461-
self.assertIn(error_msg, ['Incorrect padding', 'Non-base64 digit found'])
461+
self.assertIn(error_msg, ['Incorrect padding', 'Non-base64 digit found', 'Only base64 data is allowed'])
462462

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

470471
def test_dictionary_with_3uint8_array_bytes(self):
471472
from rclpy_message_converter_msgs.msg import Uint8Array3TestMessage

0 commit comments

Comments
 (0)