Skip to content
Open
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,8 @@ CATKIN_IGNORE

# ignore mac DS files
*.DS_Store

# pytest cache
.pytest_cache/
__pycache__/
*.pyc
171 changes: 45 additions & 126 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,142 +1,61 @@
# Copyright (c) 2016, Felix Duvallet
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of this package nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.#
#
# FROM: https://github.com/felixduvallet/ros-travis-integration
# Travis CI configuration for ROS 2 (Humble) on Ubuntu 22.04
#
# Generic .travis.yml file for running continuous integration on Travis-CI with
# any ROS package.
#
# This installs ROS on a clean Travis-CI virtual machine, creates a ROS
# workspace, resolves all listed dependencies, and sets environment variables
# (setup.bash). Then, it compiles the entire ROS workspace (ensuring there are
# no compilation errors), and runs all the tests. If any of the compilation/test
# phases fail, the build is marked as a failure.
#
# We handle two types of package dependencies:
# - packages (ros and otherwise) available through apt-get. These are installed
# using rosdep, based on the information in the ROS package.xml.
# - dependencies that must be checked out from source. These are handled by
# 'wstool', and should be listed in a file named dependencies.rosinstall.
#
# There are two variables you may want to change:
# - ROS_DISTRO (default is indigo). Note that packages must be available for
# ubuntu 14.04 trusty.
# - ROSINSTALL_FILE (default is dependencies.rosinstall inside the repo
# root). This should list all necessary repositories in wstool format (see
# the ros wiki). If the file does not exists then nothing happens.
#
# See the README.md for more information.
#
# Author: Felix Duvallet <felixd@gmail.com>

# NOTE: The build lifecycle on Travis.ci is something like this:
# before_install
# install
# before_script
# script
# after_success or after_failure
# after_script
# OPTIONAL before_deploy
# OPTIONAL deploy
# OPTIONAL after_deploy

################################################################################
# Builds the sailing_robot and xsens_driver packages with colcon, then runs
# the pure-Python unit tests (no ROS master required) via pytest.

# Use ubuntu trusty (14.04) with sudo privileges.
dist: trusty
sudo: required
language:
- generic
dist: jammy
language: generic
cache:
- apt

# Configuration variables. All variables are global now, but this can be used to
# trigger a build matrix for different ROS distributions if desired.
env:
global:
- ROS_DISTRO=indigo
- ROS_CI_DESKTOP="`lsb_release -cs`" # e.g. [precise|trusty|...]
- ROS_DISTRO=humble
- CI_SOURCE_PATH=$(pwd)
- ROSINSTALL_FILE=$CI_SOURCE_PATH/dependencies.rosinstall
- CATKIN_OPTIONS=$CI_SOURCE_PATH/catkin.options
- ROS_PARALLEL_JOBS='-j8 -l6'

################################################################################

# Install system dependencies, namely a very barebones ROS setup.
before_install:
- sudo sh -c "echo \"deb http://packages.ros.org/ros/ubuntu $ROS_CI_DESKTOP main\" > /etc/apt/sources.list.d/ros-latest.list"
- wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
# Add the ROS 2 apt repository
- sudo apt-get update -qq
- sudo apt-get install -y python-catkin-pkg python-rosdep python-wstool ros-$ROS_DISTRO-catkin ros-$ROS_DISTRO-dynamic-reconfigure python-dev python-numpy libgeos-dev
- source /opt/ros/$ROS_DISTRO/setup.bash
# Prepare rosdep to install dependencies.
- sudo rosdep init
- rosdep update
- sudo apt-get install -y curl gnupg2 lsb-release
- sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key \
-o /usr/share/keyrings/ros-archive-keyring.gpg
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" \
| sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
- sudo apt-get update -qq
- sudo apt-get install -y \
python3-colcon-common-extensions \
python3-rosdep \
python3-pip \
ros-$ROS_DISTRO-ros-base \
ros-$ROS_DISTRO-ament-cmake \
ros-$ROS_DISTRO-ament-cmake-python \
ros-$ROS_DISTRO-rosidl-default-generators \
ros-$ROS_DISTRO-rosidl-default-runtime \
ros-$ROS_DISTRO-std-msgs \
ros-$ROS_DISTRO-sensor-msgs \
ros-$ROS_DISTRO-geometry-msgs \
ros-$ROS_DISTRO-visualization-msgs \
ros-$ROS_DISTRO-diagnostic-msgs \
ros-$ROS_DISTRO-tf2-ros \
libgeos-dev
- pip3 install --user LatLon23 shapely pynmea2 scipy numpy pyproj

# Create a catkin workspace with the package under integration.
install:
- mkdir -p ~/catkin_ws/src
- cd ~/catkin_ws/src
- catkin_init_workspace
# Create the devel/setup.bash (run catkin_make with an empty workspace) and
# source it to set the path variables.
- cd ~/catkin_ws
# Travis adds a non-system Python. Put /usr/bin/python before it on PATH.
- export PATH=$(echo "$PATH" | sed -r "s|/opt/python/2.7.[0-9]+/bin|/usr/bin:&|" )
- echo $PATH
- which python
- catkin_make
- source devel/setup.bash
# Add the package under integration to the workspace using a symlink.
- cd ~/catkin_ws/src
- ln -s $CI_SOURCE_PATH .
- pip install --user LatLon shapely pynmea2

# Install all dependencies, using wstool and rosdep.
# wstool looks for a ROSINSTALL_FILE defined in the environment variables.
before_script:
# source dependencies: install using wstool.
- cd ~/catkin_ws/src
- wstool init
- if [[ -f $ROSINSTALL_FILE ]] ; then wstool merge $ROSINSTALL_FILE ; fi
- wstool up
# package depdencies: install using rosdep.
- cd ~/catkin_ws
- rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
- sudo rosdep init || true
- rosdep update
- mkdir -p ~/ros2_ws/src
- ln -s $CI_SOURCE_PATH/src/sailing_robot ~/ros2_ws/src/sailing_robot
- ln -s $CI_SOURCE_PATH/src/xsens_driver ~/ros2_ws/src/xsens_driver
- source /opt/ros/$ROS_DISTRO/setup.bash
- cd ~/ros2_ws
- rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO || true

# Compile and test. If the CATKIN_OPTIONS file exists, use it as an argument to
# catkin_make.
script:
- source /opt/ros/$ROS_DISTRO/setup.bash
- cd ~/catkin_ws
- catkin_make $( [ -f $CATKIN_OPTIONS ] && cat $CATKIN_OPTIONS )
- source ~/catkin_ws/devel/setup.bash
- catkin_make run_tests
- catkin_test_results
# Testing: Use both run_tests (to see the output) and test (to error out).
- cd ~/ros2_ws
# Build
- colcon build --symlink-install --packages-select sailing_robot xsens_driver
# Run pure-Python unit tests (no ROS daemon needed)
- source install/setup.bash
- cd $CI_SOURCE_PATH
- python3 -m pytest src/sailing_robot/tests/ -v
Loading