Skip to content

Commit

Permalink
Add coverage reports for python packages and manually install python3…
Browse files Browse the repository at this point in the history
…-boto3 (#49)

* Add coverage reports for python packages and manually install python3-boto3

* Install coverage via pip3

* Disable coverage for ROS2 Python packages
  • Loading branch information
AAlon authored Aug 30, 2019
1 parent 87cb0d7 commit 9c770f4
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions ros2_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ set -xe
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 lcov cmake && rosdep update
apt update && apt install -y python3-rosinstall python3-colcon-common-extensions && pip3 install -U setuptools
apt update && apt install -y python3-rosinstall python3-colcon-common-extensions && pip3 install -U setuptools coverage
# Manually install python3-boto3 (temporary measure until this dependency is available via rosdep).
apt install -y python3-boto3
apt list --upgradable 2>/dev/null | awk {'print $1'} | sed 's/\/.*//g' | grep $ROS_DISTRO | xargs apt install -y

REPO_NAME=$(basename -- ${TRAVIS_BUILD_DIR})
Expand Down Expand Up @@ -40,9 +42,20 @@ if [ -z "${NO_TEST}" ]; then
colcon test-result --all --verbose

# get unit test code coverage result
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info
cd "/${ROS_DISTRO}_ws/"
mv coverage.info /shared
case ${PACKAGE_LANG} in
"cpp")
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info
cd "/${ROS_DISTRO}_ws/"
mv coverage.info /shared
;;
"python")
# this doesn't actually support multiple packages
cd "/${ROS_DISTRO}_ws/build/${PACKAGE_NAMES}"
# No Python coverage support through ament/colcon yet.
# coverage xml
# cp coverage.xml /shared/coverage.info
;;
esac
fi

0 comments on commit 9c770f4

Please sign in to comment.