Skip to content

Commit

Permalink
Added CI (#8)
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
  • Loading branch information
ahcorde authored Jul 27, 2023
1 parent 14a51ad commit f281900
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 5 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build-and-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -ev

# Configuration.
export COLCON_WS=~/ws
export COLCON_WS_SRC=${COLCON_WS}/src
export DEBIAN_FRONTEND=noninteractive
export ROS_PYTHON_VERSION=3

apt update -qq
apt install -qq -y lsb-release wget curl build-essential

# Dependencies.
echo "deb http://packages.ros.org/ros2-testing/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-testing.list
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
apt-get update -qq
apt-get install -y python3-colcon-common-extensions \
python3-rosdep python3-vcstool python3-vcstools

rosdep init
rosdep update
rosdep install --from-paths ./ -i -y -r --rosdistro $ROS_DISTRO $ROSDEP_ARGS

# Build.
source /opt/ros/$ROS_DISTRO/setup.bash
mkdir -p $COLCON_WS_SRC
cp -r $GITHUB_WORKSPACE $COLCON_WS_SRC
cd $COLCON_WS
echo $1
wget $1
vcs import src < point_cloud_transport.repos
rosdep install --from-paths ./ -i -y -r --rosdistro $ROS_DISTRO $ROSDEP_ARGS
colcon build --event-handlers console_direct+

# Tests.
colcon test --event-handlers console_direct+
colcon test-result
24 changes: 24 additions & 0 deletions .github/workflows/ros2-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: ROS2 CI

on: [push, pull_request]

jobs:
point_cloud_transport_ci:
name: point_cloud_transport CI
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- docker-image: "ubuntu:22.04"
ros-distro: "rolling"
container:
image: ${{ matrix.docker-image }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build and Test
run: .github/workflows/build-and-test.sh https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/point_cloud_transport.repos
env:
DOCKER_IMAGE: ${{ matrix.docker-image }}
ROS_DISTRO: ${{ matrix.ros-distro }}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class DracoPublisher

class DracoPublisherConfig
{
public:
public:
int encode_speed = 7;
int decode_speed = 7;
int encode_method = 0;
Expand Down
2 changes: 1 addition & 1 deletion draco_point_cloud_transport/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<build_depend>draco</build_depend>
<build_depend>pluginlib</build_depend>

<exec_depend>draco</exec_depend>
<exec_depend>libdraco-dev</exec_depend>
<exec_depend>pluginlib</exec_depend>

<depend>point_cloud_interfaces</depend>
Expand Down
9 changes: 6 additions & 3 deletions draco_point_cloud_transport/src/draco_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
.set__from_value(0)
.set__to_value(10)
.set__step(1)});
declareParam<int>(encode_speed_paramDescriptor.name, config_.encode_speed,
declareParam<int>(
encode_speed_paramDescriptor.name, config_.encode_speed,
encode_speed_paramDescriptor);

rcl_interfaces::msg::ParameterDescriptor decode_speed_paramDescriptor;
Expand All @@ -98,7 +99,8 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
.set__from_value(0)
.set__to_value(10)
.set__step(1)});
declareParam<int>(decode_speed_paramDescriptor.name, config_.decode_speed,
declareParam<int>(
decode_speed_paramDescriptor.name, config_.decode_speed,
decode_speed_paramDescriptor);

rcl_interfaces::msg::ParameterDescriptor encode_method_paramDescriptor;
Expand All @@ -111,7 +113,8 @@ void DracoPublisher::declareParameters(const std::string & base_topic)
.set__from_value(0)
.set__to_value(2)
.set__step(1)});
declareParam<int>(encode_method_paramDescriptor.name, config_.encode_method,
declareParam<int>(
encode_method_paramDescriptor.name, config_.encode_method,
encode_method_paramDescriptor);

rcl_interfaces::msg::ParameterDescriptor deduplicate_paramDescriptor;
Expand Down
5 changes: 5 additions & 0 deletions point_cloud_transport.repos
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repositories:
point_cloud_transport:
type: git
url: https://github.com/john-maidbot/point_cloud_transport
version: ros2

0 comments on commit f281900

Please sign in to comment.