Skip to content

Commit 24b963c

Browse files
authored
Setup CI testing for Xenial and Bionic using Docker (#57)
1 parent 2c4fe0b commit 24b963c

11 files changed

+173
-42
lines changed

.ci/docker/env.list

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
TRAVIS_BRANCH
2+
TRAVIS_BUILD_DIR
3+
TRAVIS_OS_NAME
4+
TRAVIS_PULL_REQUEST
5+
6+
COMPILER
7+
BUILD_TYPE
8+
CODECOV
9+
SUDO

.ci/docker/ubuntu-bionic

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM ubuntu:bionic
2+
3+
RUN apt-get -y update
4+
RUN apt-get install -y software-properties-common
5+
RUN add-apt-repository ppa:dartsim/ppa -y
6+
RUN add-apt-repository ppa:personalrobotics/ppa -y
7+
RUN apt-get -y update
8+
RUN apt-get install -y \
9+
sudo \
10+
build-essential \
11+
cmake \
12+
pkg-config \
13+
wget \
14+
git \
15+
libboost-dev \
16+
libboost-python-dev \
17+
libdart6-all-dev \
18+
python3-dev \
19+
python3-numpy \
20+
python3-boost-numpy-eigen \
21+
chimera

.ci/docker/ubuntu-xenial

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM ubuntu:xenial
2+
3+
RUN apt-get -y update
4+
RUN apt-get install -y software-properties-common
5+
RUN add-apt-repository ppa:dartsim/ppa -y
6+
RUN add-apt-repository ppa:personalrobotics/ppa -y
7+
RUN apt-get -y update
8+
RUN apt-get install -y \
9+
sudo \
10+
build-essential \
11+
cmake \
12+
pkg-config \
13+
wget \
14+
git \
15+
libboost-dev \
16+
libboost-python-dev \
17+
libboost-python-numpy-dev \
18+
libdart6-all-dev \
19+
python3-dev \
20+
python3-numpy \
21+
python3-boost-numpy-eigen \
22+
chimera

.ci/install.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
set -ex
3+
4+
if [ "$TRAVIS_OS_NAME" = "linux" ]; then '.ci/install_linux.sh'; fi
5+
if [ "$TRAVIS_OS_NAME" = "osx" ]; then '.ci/install_macos.sh'; fi

.ci/install_linux.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/sh
2+
set -ex
3+
4+
# Install DART
5+
if [ `lsb_release -sc` = "trusty" ]; then
6+
sudo apt-add-repository ppa:libccd-debs -y
7+
sudo apt-add-repository ppa:fcl-debs -y
8+
fi
9+
sudo apt-add-repository ppa:dartsim -y
10+
sudo apt-add-repository ppa:personalrobotics -y
11+
sudo apt-get update -q
12+
sudo apt-get install cmake libboost-dev libboost-python-dev libboost-python-numpy-dev libdart6-all-dev
13+
sudo apt-get install python-dev python-numpy python-boost-numpy-eigen # for Python 2
14+
sudo apt-get install python3-dev python3-numpy python3-boost-numpy-eigen # for Python 3
15+
sudo apt-get install python3-pytest
16+
17+
# Install dartpy for running Python tests without building dartpy
18+
sudo apt-get install python3-dartpy
19+
20+
# Install Chimera
21+
if [ `lsb_release -sc` = "trusty" ]; then
22+
sudo add-apt-repository 'deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main' -y
23+
wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
24+
sudo apt-get update -q
25+
sudo apt-get install llvm-3.6-dev llvm-3.6-tools libclang-3.6-dev libedit-dev libyaml-cpp-dev libboost-dev -y
26+
27+
cd ..
28+
git clone https://github.com/personalrobotics/chimera.git
29+
cd chimera
30+
mkdir build
31+
cd build
32+
cmake -DLLVM_DIR="/usr/share/llvm-3.6/cmake/" ..
33+
make -j4
34+
sudo make install
35+
cd ../../dartpy
36+
else
37+
sudo apt-get install chimera -y
38+
fi
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#!/bin/sh
2+
set -ex
3+
14
#brew install boost [email protected]
25
#brew install yaml-cpp --with-static-lib
36
#export PKG_CONFIG_PATH=/usr/local/Cellar/yaml-cpp/0.5.2/lib/pkgconfig

.ci/script.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
set -ex
3+
4+
mkdir build
5+
cd build
6+
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
7+
cmake .. -DDARTPY_PYTHON_VERSION=$TRAVIS_PYTHON_VERSION
8+
fi
9+
10+
if [ "$TRAVIS_BRANCH" != "*-binding" ]; then
11+
make binding
12+
fi
13+
14+
# Don't actually build dartpy because the build time exceeds Travis CI time limit.
15+
# make -j4
16+
# $SUDO make install
17+
18+
# Run pytest for Python tests of dartpy
19+
make pytest

.travis.yml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,38 @@ sudo: required
44

55
dist: trusty
66

7-
python:
8-
- "2.7"
9-
- "3.4"
7+
matrix:
8+
include:
9+
- os: linux
10+
python: "3.4"
11+
env:
12+
- SUDO=sudo
13+
- PYTHON_VERSION=3.4
14+
- os: linux
15+
services: docker
16+
env:
17+
- DOCKER_FILE="ubuntu-xenial"
18+
- PYTHON_VERSION=3.5
19+
- os: linux
20+
services: docker
21+
env:
22+
- DOCKER_FILE="ubuntu-bionic"
23+
- PYTHON_VERSION=3.6
1024

1125
install:
12-
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then 'ci/install_linux.sh'; fi
13-
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then 'ci/install_macos.sh'; fi
26+
- if [ -n "$DOCKER_FILE" ]; then
27+
docker build -t "$DOCKER_FILE" -f ".ci/docker/$DOCKER_FILE" .;
28+
docker run -itd -v $TRAVIS_BUILD_DIR:$TRAVIS_BUILD_DIR --env-file .ci/docker/env.list --name dartpy-docker "$DOCKER_FILE";
29+
else
30+
'.ci/install.sh';
31+
fi
1432

1533
script:
16-
- mkdir build
17-
- cd build
18-
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake .. -DDARTPY_PYTHON_VERSION=$TRAVIS_PYTHON_VERSION; fi
19-
- if [ "$TRAVIS_BRANCH" != "*-binding" ]; then make binding; fi
20-
- make -j4
21-
- sudo make install
34+
- if [ -n "$DOCKER_FILE" ]; then
35+
docker exec dartpy-docker /bin/sh -c "cd $TRAVIS_BUILD_DIR && ./.ci/script.sh";
36+
else
37+
'.ci/script.sh';
38+
fi
2239

2340
after_failure:
2441
- cat Testing/Temporary/LastTest.log

CMakeLists.txt

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,33 @@ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
1616
OUTPUT_STRIP_TRAILING_WHITESPACE
1717
)
1818

19-
if(${PYTHON_VERSION_MAJOR} EQUAL 3)
20-
find_package(Boost COMPONENTS python-py${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} thread)
21-
set(DARTPY_Boost_PYTHON_LIBRARIES ${Boost_PYTHON-PY${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_LIBRARIES})
22-
if (NOT Boost_FOUND)
23-
find_package(Boost REQUIRED COMPONENTS python3 thread)
24-
set(DARTPY_Boost_PYTHON_LIBRARIES ${Boost_PYTHON3_LIBRARIES})
19+
# Find boost with python components. The name of python component varies
20+
# depending on the platform, boost version, and python version.
21+
if(APPLE)
22+
find_package(Boost REQUIRED
23+
COMPONENTS
24+
python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} thread
25+
)
26+
set(DARTPY_Boost_PYTHON_LIBRARIES
27+
${Boost_PYTHON${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_LIBRARIES}
28+
)
29+
else() # LINUX assumed
30+
if(${PYTHON_VERSION_MAJOR} EQUAL 3)
31+
find_package(Boost
32+
COMPONENTS
33+
python-py${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} thread
34+
)
35+
set(DARTPY_Boost_PYTHON_LIBRARIES
36+
${Boost_PYTHON-PY${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_LIBRARIES}
37+
)
38+
if(NOT Boost_FOUND)
39+
find_package(Boost REQUIRED COMPONENTS python3 thread)
40+
set(DARTPY_Boost_PYTHON_LIBRARIES ${Boost_PYTHON3_LIBRARIES})
41+
endif()
42+
else() # Python 2 assumed
43+
find_package(Boost REQUIRED COMPONENTS python thread)
44+
set(DARTPY_Boost_PYTHON_LIBRARIES ${Boost_PYTHON_LIBRARIES})
2545
endif()
26-
else()
27-
find_package(Boost REQUIRED COMPONENTS python thread)
28-
set(DARTPY_Boost_PYTHON_LIBRARIES ${Boost_PYTHON_LIBRARIES})
2946
endif()
3047

3148
find_package(DART 6.3.0 REQUIRED
@@ -37,6 +54,7 @@ find_package(DART 6.3.0 REQUIRED
3754
gui-osg
3855
CONFIG
3956
)
57+
4058
find_package(PythonLibs ${DARTPY_PYTHON_VERSION} REQUIRED)
4159
find_package(chimera QUIET)
4260

ci/install_linux.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

include/dartpy/pointers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#endif
1010

1111
#include "get_signature.h"
12+
#include <dart/dynamics/dynamics.hpp>
1213

1314
#include <dart/dynamics/dynamics.hpp>
1415
// TODO(JS): This includes Boost headers, which conflicts with

0 commit comments

Comments
 (0)