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

ROS2 CI adjustments #42

Merged
merged 6 commits into from
Jul 15, 2019
Merged
Changes from 5 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
23 changes: 17 additions & 6 deletions ros2_build.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
#!/bin/bash
set -e
set -xe

# install dependencies
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116
echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list
apt update && apt install -y python3 python3-pip libgtest-dev lcov cmake && rosdep update
cd /usr/src/gtest && cmake CMakeLists.txt && make && cp *.a /usr/lib
apt update && apt install -y python3-colcon-common-extensions && pip3 install -U setuptools
apt update && apt install -y python3 python3-pip lcov cmake && rosdep update
apt update && apt install -y python3-rosinstall python3-colcon-common-extensions && pip3 install -U setuptools

REPO_NAME=$(basename -- ${TRAVIS_BUILD_DIR})
echo "repo: ${REPO_NAME} branch: ${TRAVIS_BRANCH}"

# use colcon as build tool to build the package, and optionally build tests
. "/opt/ros/${ROS_DISTRO}/setup.sh"
cd "/${ROS_DISTRO}_ws/"
rosdep install --from-paths src --ignore-src --rosdistro "${ROS_DISTRO}" -r -y
if [ "${TRAVIS_BRANCH}" == "master" ] && [ -f "./src/${REPO_NAME}/.rosinstall.master" ]; then
mkdir dep
cd "/${ROS_DISTRO}_ws/dep"
ln -s "../src/${REPO_NAME}/.rosinstall.master" .rosinstall
rosws update
cd "/${ROS_DISTRO}_ws/"
rosdep install --from-paths src dep --ignore-src --rosdistro "${ROS_DISTRO}" -r -y
else
rosdep install --from-paths src --ignore-src --rosdistro "${ROS_DISTRO}" -r -y
fi

colcon build --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_FLAGS='-fprofile-arcs -ftest-coverage' -DCMAKE_C_FLAGS='-fprofile-arcs -ftest-coverage'

Expand All @@ -23,7 +34,7 @@ if [ -z "${NO_TEST}" ]; then
# run unit tests
. ./install/setup.sh
colcon test
AAlon marked this conversation as resolved.
Show resolved Hide resolved
colcon test-result --all
colcon test-result --all --verbose

# get unit test code coverage result
lcov --capture --directory . --output-file coverage.info
Expand Down