diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..644b8dfb2363673770c2556607bad2ef32683522 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,35 @@ +language: cpp +cache: ccache +sudo: required +dist: trusty +addons: + apt: + packages: + - gcc-4.8 + - g++-4.8 + - wget + - git + - build-essential + - libatlas-base-dev + - python + - python-pip + - python2.7-dev + - m4 + - libprotobuf-dev + - protobuf-compiler + - python-protobuf + - python-numpy + - python-wheel + - libgoogle-glog-dev + - libgflags-dev + - libgtest-dev +before_install: + - pip install wheel protobuf + - sudo paddle/scripts/travis/before_install.sh +script: + - paddle/scripts/travis/build.sh + - paddle/scripts/travis/unittest.sh +notifications: + email: + on_success: change + on_failure: always diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b83ab256e0c015b15c0dd466f1153f2c15b25f6..0d950e144ffdcc2f7ff619399f1f614d18f91146 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,7 @@ option(WITH_TIMER "Compile PaddlePaddle use timer" OFF) option(WITH_TESTING "Compile and run unittest for PaddlePaddle" ${GTEST_FOUND}) option(WITH_DOC "Compile PaddlePaddle with documentation" OFF) option(WITH_SWIG_PY "Compile PaddlePaddle with py PaddlePaddle prediction api" ${SWIG_FOUND}) +option(ON_TRAVIS "Running test on travis-ci or not." OFF) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel" diff --git a/README.md b/README.md index 7b948c9e893afaa901bc1bcaa869daa2f46096ff..cc2fc68ac3143578c7b81fc2aedcfca70d669a5f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # PaddlePaddle +[![Build Status](https://travis-ci.org/baidu/Paddle.svg?branch=master)](https://travis-ci.org/baidu/Paddle) Welcome to the PaddlePaddle GitHub. diff --git a/paddle/scripts/travis/before_install.sh b/paddle/scripts/travis/before_install.sh new file mode 100755 index 0000000000000000000000000000000000000000..ec2ac1f2240765d1c453ce50ec44286a551a37ba --- /dev/null +++ b/paddle/scripts/travis/before_install.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +pushd /usr/src/gtest +cmake . +make +sudo cp *.a /usr/lib +popd diff --git a/paddle/scripts/travis/build.sh b/paddle/scripts/travis/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..638b1bafb4398acd83870f5aba744cccf5da6f0a --- /dev/null +++ b/paddle/scripts/travis/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +cd `dirname $0` +cd ../../../ +set -e +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_GPU=OFF -DWITH_DOC=OFF -DWITH_TESTING=ON -DON_TRAVIS=ON +make -j `nproc` diff --git a/paddle/scripts/travis/unittest.sh b/paddle/scripts/travis/unittest.sh new file mode 100755 index 0000000000000000000000000000000000000000..a095e308f32eea159ec27ef96b5ea1368641739a --- /dev/null +++ b/paddle/scripts/travis/unittest.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e +cd `dirname $0` +cd ../../../build +env CTEST_OUTPUT_ON_FAILURE=1 make test ARGS="-j `nproc`" + diff --git a/paddle/trainer/tests/CMakeLists.txt b/paddle/trainer/tests/CMakeLists.txt index 370f0b4b4113a36290c9617153fa0db8a403cce2..aabf44d6512004a43e45740f609f3873b872c609 100644 --- a/paddle/trainer/tests/CMakeLists.txt +++ b/paddle/trainer/tests/CMakeLists.txt @@ -53,12 +53,13 @@ add_test(NAME test_CompareTwoOpts ################# test_CompareSparse ################## add_unittest_without_exec(test_CompareSparse test_CompareSparse.cpp) -add_test(NAME test_CompareSparse - COMMAND ${PROJ_ROOT}/paddle/.set_python_path.sh -d ${PROJ_ROOT}/python/ - ./.set_port.sh -p port -n 6 - ${CMAKE_CURRENT_BINARY_DIR}/test_CompareSparse +if(NOT ON_TRAVIS) + add_test(NAME test_CompareSparse + COMMAND ${PROJ_ROOT}/paddle/.set_python_path.sh -d ${PROJ_ROOT}/python/ + ./.set_port.sh -p port -n 6 + ${CMAKE_CURRENT_BINARY_DIR}/test_CompareSparse WORKING_DIRECTORY ${PROJ_ROOT}/paddle/) - +endif() ################# test_recurrent_machine_generation ############### add_unittest_without_exec(test_recurrent_machine_generation test_recurrent_machine_generation.cpp)