Skip to content

Commit

Permalink
Merge pull request #1 from InvincibleRMC/CI
Browse files Browse the repository at this point in the history
Create package and CI
  • Loading branch information
benjaminwp18 authored Mar 25, 2024
2 parents 84c4586 + fcf9f85 commit e8f8ede
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/industrial_ci_action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git).
# For troubleshooting, see README (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst)

name: Continuous Integration

on: # this determines when this workflow is run
push:
# branches: [ master, melodic-devel ] # when master or melodic-devel branch is pushed to
# pull_request:
# branches: [ master ] # when there is a pull request against master
# schedule: # uncomment to run periodically
# - cron: '0 4 * * *' # every day at 4 AM (UTC)
workflow_dispatch: # allow manually starting this workflow

jobs:
industrial_ci:
name: ROS ${{ matrix.ROS_DISTRO }} (${{ matrix.ROS_REPO }})
runs-on: ubuntu-latest
strategy:
fail-fast: false # uncomment if failing jobs should not cancel the others immediately
matrix: # matrix is the product of entries
ROS_DISTRO: [humble, iron]
ROS_REPO: [main]
# exclude: # specific configuration can be excludes
# - {ROS_DISTRO: melodic, ROS_REPO: testing}
# include: # add additional configurations
# - {ROS_DISTRO: kinetic, ROS_REPO: testing}
env:
CCACHE_DIR: "${{ github.workspace }}/.ccache" # directory for ccache (and how we enable ccache in industrial_ci)
steps:
- uses: actions/checkout@v4 # clone target repository
- uses: actions/cache@v4 # fetch/store the directory used by ccache before/after the ci run
with:
path: ${{ env.CCACHE_DIR }}
# This configuration will always create a new ccache cache starting off from the previous one (if any).
# In this simple version it will be shared between all builds of the same ROS_REPO and ROS_REPO
# and might need some fine-tuning to match the use case
key: ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-${{github.run_id}}
restore-keys: |
ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-
- uses: 'ros-industrial/industrial_ci@master' # run industrial_ci
env: # either pass all entries explicitly
# Added back so testing without Dockerfile can be done
ROS_DISTRO: ${{ matrix.ROS_DISTRO }}
ROS_REPO: ${{ matrix.ROS_REPO }}

Empty file added mqtt_ros_bridge/__init__.py
Empty file.
23 changes: 23 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>mqtt_ros_bridge</name>
<version>1.1.0</version>
<description>MQTT ROS Bridge</description>
<maintainer email="[email protected]">benjaminwp18</maintainer>
<maintainer email="[email protected]">InvincbleRMC</maintainer>
<license>Apache License 2.0</license>

<depend>rclpy</depend>

<exec_depend>ros2launch</exec_depend>

<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<test_depend>ament_mypy</test_depend>
<test_depend>python3-pytest</test_depend>

<export>
<build_type>ament_python</build_type>
</export>
</package>
Empty file added resource/mqtt_ros_bridge
Empty file.
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[develop]
script_dir=$base/lib/mqtt_ros_bridge
[install]
install_scripts=$base/lib/mqtt_ros_bridge
31 changes: 31 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
from glob import glob

from setuptools import setup

PACKAGE_NAME = 'mqtt_ros_bridge'

setup(
name=PACKAGE_NAME,
version='1.1.0',
packages=[PACKAGE_NAME],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + PACKAGE_NAME]),
('share/' + PACKAGE_NAME, ['package.xml']),
# Include all launch files.
(os.path.join('share', PACKAGE_NAME, 'launch'),
glob('launch/*launch.[pxy][yma]*'))
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='benjaminwp18, InvincibleRMC',
maintainer_email='[email protected], [email protected]',
description='MQTT ROS Bridge',
license='Apache License 2.0',
tests_require=['pytest'],
entry_points={
'console_scripts': [
],
},
)
27 changes: 27 additions & 0 deletions test/test_flake8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Test flake8 on this module."""
# Copyright 2017 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ament_flake8.main import main_with_errors
import pytest


@pytest.mark.flake8
@pytest.mark.linter
def test_flake8() -> None:
"""Tests flake8 on this module."""
error_code, errors = main_with_errors(argv=[])
assert error_code == 0, \
f'Found {len(errors)} code style errors / warnings:\n' + \
'\n'.join(errors)
12 changes: 12 additions & 0 deletions test/test_mypy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""Test mypy on this module."""

import pytest
from ament_mypy.main import main


@pytest.mark.mypy
@pytest.mark.linter
def test_mypy() -> None:
"""Tests mypy on this module."""
error_code = main()
assert error_code == 0, 'Found code style errors / warnings'
25 changes: 25 additions & 0 deletions test/test_pep257.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Test pep257 on this module."""
# Copyright 2015 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import pytest
from ament_pep257.main import main


@pytest.mark.linter
@pytest.mark.pep257
def test_pep257() -> None:
"""Tests pep257 on this module."""
error_code = main()
assert error_code == 0, 'Found code style errors / warnings'

0 comments on commit e8f8ede

Please sign in to comment.