Skip to content

Apache DataFusion SQL Query Engine

ARROW-42: Add Python tests to Travis CI build

Wes McKinney325dbf63971d
diff --git a/.travis.yml b/.travis.yml
index cb2d5cb1ba..9e858d7d98 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,9 @@ addons:
packages:
- gcc-4.9 # Needed for C++11
- g++-4.9 # Needed for C++11
+ - gdb
- gcov
+ - ccache
- cmake
- valgrind
@@ -17,11 +19,32 @@ matrix:
- compiler: gcc
language: cpp
os: linux
+ before_script:
+ - $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh
script:
+ - export CC="gcc-4.9"
+ - export CXX="g++-4.9"
- $TRAVIS_BUILD_DIR/ci/travis_script_cpp.sh
+ - $TRAVIS_BUILD_DIR/ci/travis_script_python.sh
- compiler: clang
language: cpp
os: osx
addons:
+ before_script:
+ - $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh
script:
- $TRAVIS_BUILD_DIR/ci/travis_script_cpp.sh
+ - $TRAVIS_BUILD_DIR/ci/travis_script_python.sh
+
+before_install:
+- ulimit -c unlimited -S
+- export CPP_BUILD_DIR=$TRAVIS_BUILD_DIR/cpp-build
+- export ARROW_CPP_INSTALL=$TRAVIS_BUILD_DIR/cpp-install
+- export LD_LIBRARY_PATH=$ARROW_CPP_INSTALL/lib:$LD_LIBRARY_PATH
+
+after_script:
+- rm -rf $CPP_BUILD_DIR
+
+after_failure:
+- COREFILE=$(find . -maxdepth 2 -name "core*" | head -n 1)
+- if [[ -f "$COREFILE" ]]; then gdb -c "$COREFILE" example -ex "thread apply all bt" -ex "set pagination 0" -batch; fi
diff --git a/ci/travis_before_script_cpp.sh b/ci/travis_before_script_cpp.sh
new file mode 100755
index 0000000000..4d5bef8bbd
--- /dev/null
+++ b/ci/travis_before_script_cpp.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+set -e
+
+: ${CPP_BUILD_DIR=$TRAVIS_BUILD_DIR/cpp-build}
+
+mkdir $CPP_BUILD_DIR
+pushd $CPP_BUILD_DIR
+
+CPP_DIR=$TRAVIS_BUILD_DIR/cpp
+
+# Build an isolated thirdparty
+cp -r $CPP_DIR/thirdparty .
+cp $CPP_DIR/setup_build_env.sh .
+
+source setup_build_env.sh
+
+echo $GTEST_HOME
+
+: ${ARROW_CPP_INSTALL=$TRAVIS_BUILD_DIR/cpp-install}
+
+cmake -DCMAKE_INSTALL_PREFIX=$ARROW_CPP_INSTALL -DCMAKE_CXX_FLAGS="-Werror" $CPP_DIR
+make -j4
+make install
+
+popd
diff --git a/ci/travis_script_cpp.sh b/ci/travis_script_cpp.sh
index 28f16cc021..3e843dd759 100755
--- a/ci/travis_script_cpp.sh
+++ b/ci/travis_script_cpp.sh
@@ -2,28 +2,11 @@
set -e
-mkdir $TRAVIS_BUILD_DIR/cpp-build
-pushd $TRAVIS_BUILD_DIR/cpp-build
+: ${CPP_BUILD_DIR=$TRAVIS_BUILD_DIR/cpp-build}
-CPP_DIR=$TRAVIS_BUILD_DIR/cpp
+pushd $CPP_BUILD_DIR
-# Build an isolated thirdparty
-cp -r $CPP_DIR/thirdparty .
-cp $CPP_DIR/setup_build_env.sh .
-
-if [ $TRAVIS_OS_NAME == "linux" ]; then
- # Use a C++11 compiler on Linux
- export CC="gcc-4.9"
- export CXX="g++-4.9"
-fi
-
-source setup_build_env.sh
-
-echo $GTEST_HOME
-
-cmake -DCMAKE_CXX_FLAGS="-Werror" $CPP_DIR
make lint
-make -j4
if [ $TRAVIS_OS_NAME == "linux" ]; then
valgrind --tool=memcheck --leak-check=yes --error-exitcode=1 ctest
@@ -32,4 +15,3 @@ else
fi
popd
-rm -rf cpp-build
diff --git a/ci/travis_script_python.sh b/ci/travis_script_python.sh
new file mode 100755
index 0000000000..9b0bd4f54c
--- /dev/null
+++ b/ci/travis_script_python.sh
@@ -0,0 +1,59 @@
+#!/usr/bin/env bash
+
+set -e
+
+PYTHON_DIR=$TRAVIS_BUILD_DIR/python
+
+# Share environment with C++
+pushd $CPP_BUILD_DIR
+source setup_build_env.sh
+popd
+
+pushd $PYTHON_DIR
+
+# Bootstrap a Conda Python environment
+
+if [ $TRAVIS_OS_NAME == "linux" ]; then
+ MINICONDA_URL="https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh"
+else
+ MINICONDA_URL="https://repo.continuum.io/miniconda/Miniconda-latest-MacOSX-x86_64.sh"
+fi
+
+curl $MINICONDA_URL > miniconda.sh
+MINICONDA=$TRAVIS_BUILD_DIR/miniconda
+bash miniconda.sh -b -p $MINICONDA
+export PATH="$MINICONDA/bin:$PATH"
+conda update -y -q conda
+conda info -a
+
+PYTHON_VERSION=3.5
+CONDA_ENV_NAME=pyarrow-test
+
+conda create -y -q -n $CONDA_ENV_NAME python=$PYTHON_VERSION
+source activate $CONDA_ENV_NAME
+
+python --version
+which python
+
+# faster builds, please
+conda install -y nomkl
+
+# Expensive dependencies install from Continuum package repo
+conda install -y pip numpy pandas cython
+
+# Other stuff pip install
+pip install -r requirements.txt
+
+export ARROW_HOME=$ARROW_CPP_INSTALL
+
+python setup.py build_ext --inplace
+
+py.test -vv -r sxX arrow
+
+# if [ $TRAVIS_OS_NAME == "linux" ]; then
+# valgrind --tool=memcheck py.test -vv -r sxX arrow
+# else
+# py.test -vv -r sxX arrow
+# fi
+
+popd