-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add follow tests using Ignition Gazebo's test fixture and run on GitH…
…ub actions (#40)
- Loading branch information
Showing
15 changed files
with
593 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
set -ev | ||
set -x | ||
|
||
# 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 | ||
|
||
# Fortres isn't on packages.ros.org yet, so we get it from packages.osrfoundation.org | ||
# Once it's on packages.ros.org, it can be installed with rosdep below | ||
if [ "$IGNITION_VERSION" == "fortress" ]; then | ||
echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list | ||
wget https://packages.osrfoundation.org/gazebo.key -O - | apt-key add - | ||
|
||
IGN_DEPS="ignition-fortress" | ||
fi | ||
|
||
# Tools and dependencies | ||
echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list | ||
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - | ||
apt-get update -qq | ||
apt-get install -y $IGN_DEPS \ | ||
python3-colcon-common-extensions \ | ||
python3-rosdep \ | ||
xvfb | ||
|
||
rosdep init | ||
rosdep update | ||
|
||
# Create workspace and copy Dolly code there | ||
mkdir -p $COLCON_WS_SRC | ||
cp -r $GITHUB_WORKSPACE $COLCON_WS_SRC | ||
|
||
# Install ROS dependencies | ||
rosdep install --from-paths $COLCON_WS_SRC -i -y -r --rosdistro $ROS_DISTRO | ||
|
||
# Rendering setup | ||
Xvfb :1 -ac -noreset -core -screen 0 1280x1024x24 & | ||
export DISPLAY=:1.0 | ||
export MESA_GL_VERSION_OVERRIDE=3.3 | ||
|
||
# Build | ||
source /opt/ros/$ROS_DISTRO/setup.bash | ||
cd $COLCON_WS | ||
colcon build --event-handlers console_direct+ | ||
|
||
# Test | ||
colcon test --event-handlers console_direct+ --packages-select-regex dolly | ||
colcon test-result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build and test | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build_and_test: | ||
name: Build and test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- docker-image: "ubuntu:20.04" | ||
ignition-version: "fortress" | ||
ros-distro: "rolling" | ||
container: | ||
image: ${{ matrix.docker-image }} | ||
steps: | ||
- name: Checkout dolly | ||
uses: actions/checkout@v2 | ||
with: | ||
path: main | ||
# Compiling ros_ign from source because Rolling isn't using Fortress yet | ||
- name: Checkout ros_ign | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: ignitionrobotics/ros_ign | ||
ref: ros2 | ||
path: ros_ign | ||
- name: Build and test | ||
run: main/.github/workflows/build-and-test.sh | ||
env: | ||
DOCKER_IMAGE: ${{ matrix.docker-image }} | ||
IGNITION_VERSION: ${{ matrix.ignition-version }} | ||
ROS_DISTRO: ${{ matrix.ros-distro }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__pycache__/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Changelog for package dolly_tests | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
project(dolly_tests) | ||
|
||
# Fortress | ||
if("$ENV{IGNITION_VERSION}" STREQUAL "fortress") | ||
find_package(ignition-gazebo6 REQUIRED) | ||
set(IGN_GAZEBO_VER 6) | ||
|
||
message(STATUS "Compiling against Ignition Fortress") | ||
# Default to Edifice | ||
else() | ||
find_package(ignition-gazebo5 QUIET) | ||
set(IGN_GAZEBO_VER 5) | ||
|
||
if(NOT ignition-gazebo5_FOUND) | ||
# Skip if Ignition not present | ||
message(WARNING "Ignition Gazebo 5 or 6 not found, proceeding without that simulator.") | ||
return() | ||
else() | ||
message(STATUS "Compiling against Ignition Edifice") | ||
endif() | ||
endif() | ||
|
||
find_package(ament_cmake REQUIRED) | ||
|
||
if(BUILD_TESTING) | ||
find_package(ament_lint_auto REQUIRED) | ||
ament_lint_auto_find_test_dependencies() | ||
|
||
find_package(ament_cmake_gtest REQUIRED) | ||
find_package(launch_testing_ament_cmake REQUIRED) | ||
ament_find_gtest() | ||
|
||
set("PROJECT_BINARY_PATH" ${CMAKE_CURRENT_BINARY_DIR}) | ||
set("PROJECT_SOURCE_PATH" ${CMAKE_CURRENT_SOURCE_DIR}) | ||
configure_file(test/constants.hh.in constants.hh @ONLY) | ||
|
||
set(TEST_NAME follow_ignition_TEST) | ||
ament_add_gtest_executable(${TEST_NAME} test/${TEST_NAME}.cpp) | ||
target_link_libraries(${TEST_NAME} | ||
ignition-gazebo${IGN_GAZEBO_VER}::ignition-gazebo${IGN_GAZEBO_VER} | ||
) | ||
include_directories(${CMAKE_CURRENT_BINARY_DIR}) | ||
install( | ||
TARGETS ${TEST_NAME} | ||
DESTINATION lib/${PROJECT_NAME} | ||
) | ||
add_launch_test(launch/${TEST_NAME}.launch.py | ||
TIMEOUT 200 | ||
) | ||
endif() | ||
|
||
install( | ||
DIRECTORY | ||
worlds | ||
DESTINATION | ||
share/${PROJECT_NAME}/ | ||
) | ||
|
||
ament_package() |
Oops, something went wrong.