Commit d8824733 authored by Rashad Kanavath's avatar Rashad Kanavath

TEST: auto switch travis to develop and release XDK

parent 1c699ff9
language: cpp
sudo: false
dist: trusty
compiler:
- clang
addons:
apt:
packages:
- libqt4-dev
- libqtcore4
- libqtgui4
cache: false
before_script:
- export MAKE_CMD=/tmp/ninja
- export CMAKE_GEN='Ninja'
- cd /tmp
- wget https://cmake.org/files/v3.4/cmake-3.4.1-Linux-x86_64.tar.gz --no-check-certificate
- tar -xzf cmake-3.4.1-Linux-x86_64.tar.gz
- wget https://github.com/martine/ninja/releases/download/v1.6.0/ninja-linux.zip --no-check-certificate
- unzip ninja-linux.zip
- wget https://www.orfeo-toolbox.org/packages/xdk/OTB-5.2/OTB-5.2.0-xdk-Linux64.run --no-check-certificate
- chmod +x /tmp/OTB-5.2.0-xdk-Linux64.run
- /tmp/OTB-5.2.0-xdk-Linux64.run
script: /tmp/cmake-3.4.1-Linux-x86_64/bin/ctest -VV -S /home/travis/build/orfeotoolbox/OTB/Utilities/Maintenance/TravisBuild.cmake
script: Utilities/Maintenance/TravisBuild.sh
#TravisBuild.cmake - custom cmake scripts for travis build
#before running this script you need to set the below env variables
set(ENV{LC_ALL} C)
set(CTEST_PROJECT_NAME "OTB")
set(CTEST_BUILD_CONFIGURATION Release)
set(CTEST_DASHBOARD_ROOT "/home/travis/build")
if(NOT DEFINED CTEST_GIT_COMMAND)
find_program(CTEST_GIT_COMMAND NAMES git git.cmd)
endif()
# Just check if required variables are defined.
foreach(req
CTEST_DASHBOARD_ROOT
CMAKE_MAKE_PROGRAM
CTEST_CMAKE_GENERATOR
OTB_INSTALL_DIR
CTEST_COMMAND
)
if(NOT DEFINED ENV{${req}})
message(FATAL_ERROR "you must set ${req} environment variable is not defined")
endif()
set(${req} "$ENV{${req}}")
endforeach()
set(BUILD_NAME_PREFIX "travis-$ENV{TRAVIS_BUILD_NUMBER}")
if(NOT "$ENV{TRAVIS_PULL_REQUEST}" MATCHES "false")
......@@ -17,22 +31,6 @@ set(CTEST_SITE "travis-ci.org")
set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/orfeotoolbox/OTB")
set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/orfeotoolbox/build")
if(NOT DEFINED CTEST_GIT_COMMAND)
find_program(CTEST_GIT_COMMAND NAMES git git.cmd)
endif()
if(DEFINED ENV{MAKE_CMD})
set(CMAKE_MAKE_PROGRAM "$ENV{MAKE_CMD}")
else()
message(FATAL_ERROR "MAKE_CMD environment variable is not defined")
endif()
if(DEFINED ENV{CMAKE_GEN})
set(CTEST_CMAKE_GENERATOR "$ENV{CMAKE_GEN}")
else()
message(FATAL_ERROR "CMAKE_GEN environment variable is not defined")
endif()
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 1000)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 300)
#set(CTEST_BUILD_FLAGS -j2)
......@@ -41,13 +39,17 @@ message(STATUS "CTEST_SOURCE_DIRECTORY: ${CTEST_SOURCE_DIRECTORY}")
message(STATUS "CTEST_BINARY_DIRECTORY: ${CTEST_BINARY_DIRECTORY}")
set(INITIAL_CACHE
"CMAKE_PREFIX_PATH:PATH=/tmp/OTB-5.2.0-xdk-Linux64
"
BUILD_TESTING:BOOL=ON
CMAKE_INSTALL_PREFIX:PATH=${OTB_INSTALL_DIR}
CMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}
OTB_USE_OPENCV:BOOL=ON
OTB_USE_LIBSVM:BOOL=ON
OTB_USE_MUPARSER:BOOL=ON
OTB_USE_MUPARSERX:BOOL=ON
OTB_USE_QT4:BOOL=ON
OTB_USE_OPENGL:BOOL=ON
OTB_USE_GLEW:BOOL=ON
CMAKE_C_FLAGS:STRING=-Wextra
CMAKE_CXX_FLAGS:STRING=-Wextra -Wno-gnu-static-float-init -Wno-\\#warnings
CMAKE_BUILD_TYPE=Release"
......@@ -64,7 +66,11 @@ ctest_read_custom_files(${CTEST_BINARY_DIRECTORY})
ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE _build_rv)
ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" INCLUDE New RETURN_VALUE _test_rv)
execute_process(
COMMAND ${CTEST_COMMAND} "-R" "Tu" "."
WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
)
#ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" INCLUDE Tu RETURN_VALUE _test_rv)
# if(NOT _configure_rv EQUAL 0 OR NOT _build_rv EQUAL 0)
# endif ()
......
#!/usr/bin/env bash
#variables required
CTEST_COMMAND="/tmp/cmake-3.4.1-Linux-x86_64/bin/ctest"
CMAKE_MAKE_PROGRAM=/tmp/ninja
CTEST_CMAKE_GENERATOR="Ninja"
CTEST_DASHBOARD_ROOT=$HOME/build
WGET=`which wget`
SED=`which sed`
#develop xdk is used for all branches whose name does not contains release-X.Y
XDK_VERSION="develop"
if [[ -z "$TRAVIS_BRANCH" ]]; then
TRAVIS_BRANCH='develop'
TRAVIS_BUILD_NUMBER=1
TRAVIS_PULL_REQUEST='false'
export TRAVIS_BRANCH
export TRAVIS_BUILD_NUMBER
export TRAVIS_PULL_REQUEST
mkdir -p $CTEST_DASHBOARD_ROOT/orfeotoolbox/build
git clone --depth=1 --branch=$TRAVIS_BRANCH https://github.com/orfeotoolbox/OTB
fi
#if a branch contains release-X.Y then xdk is taken from packages/xdk/OTB-X.Y
if [[ "$TRAVIS_BRANCH" =~ release-* ]]; then
VERSION_SMALL=$(echo $TRAVIS_BRANCH| sed 's/.*release-//'| cut -d'-' -f 1)
XDK_VERSION="OTB-$VERSION_SMALL"
fi
VERSION_STRING=$($WGET -q -O- "https://www.orfeo-toolbox.org/packages/xdk/$XDK_VERSION/"| \
$SED -n 's,.*OTB-\([0-9][^<]*\).*-xdk-Linux.*,\1,p')
XDK_FILE=OTB-$VERSION_STRING-xdk-Linux64.run
CMAKE_PREFIX_PATH=/tmp/OTB-$VERSION_STRING-xdk-Linux64
OTB_INSTALL_DIR=$CTEST_DASHBOARD_ROOT/orfeotoolbox/install
#export variables for later use in cmake file
export CTEST_COMMAND
export OTB_VERSION
export XDK_VERSION
export CTEST_DASHBOARD_ROOT
export CTEST_CMAKE_GENERATOR
export CMAKE_MAKE_PROGRAM
export CMAKE_PREFIX_PATH
export OTB_INSTALL_DIR
#print
echo "VERSION_STRING=$VERSION_STRING"
echo "TRAVIS_BRANCH=$TRAVIS_BRANCH"
echo "CTEST_DASHBOARD_ROOT=$CTEST_DASHBOARD_ROOT"
echo "CTEST_COMMAND=$CTEST_COMMAND"
echo "XDK_VERSION=$XDK_VERSION"
echo "XDK_FILE=$XDK_FILE"
echo "OTB_INSTALL_DIR=$OTB_INSTALL_DIR"
echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH"
#change to /tmp
cd /tmp
#download, extract cmake binaries
wget https://cmake.org/files/v3.4/cmake-3.4.1-Linux-x86_64.tar.gz --no-check-certificate
tar -xzf cmake-3.4.1-Linux-x86_64.tar.gz
#download, extract ninja binaries
wget https://github.com/martine/ninja/releases/download/v1.6.0/ninja-linux.zip --no-check-certificate
unzip ninja-linux.zip
#download, extract OTB XDK
wget https://www.orfeo-toolbox.org/packages/xdk/$XDK_VERSION/$XDK_FILE --no-check-certificate
chmod +x /tmp/$XDK_FILE
/tmp/$XDK_FILE
echo "Running ctest -VV -S TravisBuild.cmake"
$CTEST_COMMAND -VV -S $CTEST_DASHBOARD_ROOT/orfeotoolbox/OTB/Utilities/Maintenance/TravisBuild.cmake
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment