Browse Source

Travis CI config file & related required changes

Strahinja Val Markovic 12 years ago
parent
commit
484c5f7241
3 changed files with 34 additions and 2 deletions
  1. 8 0
      .travis.yml
  2. 5 1
      cpp/CMakeLists.txt
  3. 21 1
      install.sh

+ 8 - 0
.travis.yml

@@ -0,0 +1,8 @@
+language: cpp
+compiler:
+  - gcc
+  - clang
+script: ./install.sh
+env:
+  - YCM_TESTRUN=1 EXTRA_CMAKE_ARGS=""
+  - YCM_TESTRUN=1 EXTRA_CMAKE_ARGS="-DUSE_CLANG_COMPLETER=ON"

+ 5 - 1
cpp/CMakeLists.txt

@@ -41,7 +41,11 @@ endif()
 
 if ( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
   set( COMPILER_IS_CLANG true )
-  set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
+
+  # The Travis CI build machines don't have libc++ installed
+  if ( NOT DEFINED ENV{TRAVIS} )
+    set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
+  endif()
 endif()
 
 if ( CMAKE_GENERATOR STREQUAL Xcode )

+ 21 - 1
install.sh

@@ -82,6 +82,20 @@ function install {
   rm -rf $build_dir
 }
 
+function testrun {
+  ycm_dir=`pwd`
+  build_dir=`mktemp -d -t ycm_build.XXXXXX`
+  pushd $build_dir
+
+  cmake -G "Unix Makefiles" $1 . $ycm_dir/cpp
+  make -j $(num_cores) ycm_core_tests
+  cd ycm/tests
+  LD_LIBRARY_PATH=$ycm_dir/python ./ycm_core_tests
+
+  popd
+  rm -rf $build_dir
+}
+
 function linux_cmake_install {
   echo "Please install CMake using your package manager and retry."
   exit 1
@@ -112,4 +126,10 @@ if ! command_exists cmake; then
   echo "CMake is required to build YouCompleteMe."
   cmake_install
 fi
-install $cmake_args
+
+if [ -z "$YCM_TESTRUN" ]; then
+  install $cmake_args $EXTRA_CMAKE_ARGS
+else
+  testrun $cmake_args $EXTRA_CMAKE_ARGS
+fi
+