Skip to content

Commit

Permalink
Merge pull request #1 from aws-robotics/development
Browse files Browse the repository at this point in the history
create initial upload of scripts used in aws-robotics Travis CI
  • Loading branch information
ryanewel authored Feb 19, 2019
2 parents 64b343a + eacf9bf commit acf8397
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Travis Scripts
# Travis Scripts

contains scripts for building sample applications and AWS ROS cloud extensions.
## Overview
This repository contains scripts used in Travis CIs for [AWS RoboMaker] sample applications and [AWS RoboMaker] ROS Cloud Extensions.

## License

This library is licensed under the Apache 2.0 License.

[AWS RoboMaker]: https://github.com/aws-robotics
32 changes: 32 additions & 0 deletions ros1_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -e

# install dependencies
apt update && apt install -y lcov python3-pip libgtest-dev 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

# 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
colcon build --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_FLAGS='-fprofile-arcs -ftest-coverage' -DCMAKE_C_FLAGS='-fprofile-arcs -ftest-coverage'
if [ -z "${NO_TEST}" ];
then
if [ ! -z "${PACKAGE_NAME}" ];
then
colcon build --packages-select $PACKAGE_NAME --cmake-target tests
fi

# run unit tests
. ./install/setup.sh
colcon test
colcon test-result --all

# 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
fi
28 changes: 28 additions & 0 deletions ros1_sa_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -e

# install dependencies
apt update && apt install -y python3-pip python3-apt dpkg ros-$ROS_DISTRO-ros-base && rosdep update
apt update && apt install -y python3-colcon-common-extensions && pip3 install -U setuptools
pip3 install colcon-bundle colcon-ros-bundle
. /opt/ros/$ROS_DISTRO/setup.sh

# use colcon as build tool to build the robot workspace
cd /"$ROS_DISTRO"_ws/"$SA_NAME"/robot_ws/
rosws update
rosdep install --from-paths src --ignore-src -r -y
colcon build --build-base build --install-base install
colcon bundle --build-base build --install-base install --bundle-base bundle
mv ./bundle/output.tar.gz ./bundle/robot.tar.gz

# use colcon as build tool to build the simulation workspace
cd /"$ROS_DISTRO"_ws/"$SA_NAME"/simulation_ws/
rosws update
rosdep install --from-paths src --ignore-src -r -y
colcon build --build-base build --install-base install
colcon bundle --build-base build --install-base install --bundle-base bundle
mv ./bundle/output.tar.gz ./bundle/simulation.tar.gz

# move the artifacts to a shared mount point
mv /"$ROS_DISTRO"_ws/"$SA_NAME"/robot_ws/bundle/robot.tar.gz /shared/robot.tar.gz
mv /"$ROS_DISTRO"_ws/"$SA_NAME"/simulation_ws/bundle/simulation.tar.gz /shared/simulation.tar.gz
34 changes: 34 additions & 0 deletions ros2_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -e

# 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

# 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
colcon build --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_FLAGS='-fprofile-arcs -ftest-coverage' -DCMAKE_C_FLAGS='-fprofile-arcs -ftest-coverage'
if [ -z "${NO_TEST}" ];
then
if [ ! -z "${PACKAGE_NAME}" ] && [ "$ROS_VERSION" == "1" ];
then
colcon build --packages-select $PACKAGE_NAME --cmake-target tests
fi

# run unit tests
. ./install/setup.sh
colcon test
colcon test-result --all

# 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
fi

0 comments on commit acf8397

Please sign in to comment.