Skip to content
Permalink
Browse files
Enable osx tests
  • Loading branch information
m-kuhn committed Apr 26, 2017
1 parent 4cc4a27 commit 23cb825c244a06866b4450a43490ecfb47fa3f99
@@ -64,11 +64,15 @@ matrix:
- expect-dev # unbuffer
- coreutils
# OSX based build with QT4 and Python 2
# - os: osx
# env:
# - BUILD=osx
# - IGNORE_BUILD_FAILURES=YES

- os: osx
osx_image: xcode8.3 # MacOS 10.12: Sierra
cache:
pip: true
directories:
- $HOME/.ccache
env:
- TRAVIS_CONFIG=macos
- IGNORE_BUILD_FAILURES=YES

git:
depth: 30
@@ -0,0 +1 @@
ccache -s
@@ -13,29 +13,49 @@
# #
###########################################################################

# Remove default gdal provided by travis (we will replace it with gdal 2)
brew remove gdal || true

brew tap osgeo/osgeo4mac
brew update
brew install osgeo/osgeo4mac/qgis-214 --without-postgresql --only-dependencies
brew install spawn-fcgi
brew install lighttpd
brew install poppler
brew install bison
brew install expat
brew install python3

pip3 install \
numpy \
psycopg2 \
numpy \
nose2 \
pyyaml \
mock \
future \
termcolor

brew install \
qscintilla2 \
qt \
qt5-webkit \
qca \
qwtpolar \
gsl \
sqlite \
expat \
proj \
gdal2-python --with-python3 \
spawn-fcgi \
lighttpd \
poppler \
bison \
expat \
bison \
flex \
ninja \
ccache \
spatialindex \
fastcgi \
qtkeychain \
gnu-sed

brew ln bison --force
brew ln sqlite --force
brew ln openssl --force
brew ln expat --force
brew ln libxml2 --force
brew ln gettext --force
brew ln libffi --force
brew link bison --force
brew link flex --force

mkdir -p ${HOME}/Library/Python/2.7/lib/python/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> ${HOME}/Library/Python/2.7/lib/python/site-packages/homebrew.pth
echo 'import site; site.addsitedir("/usr/local/opt/gdal-20/lib/python2.7/site-packages")' >> ${HOME}/Library/Python/2.7/lib/python/site-packages/gdal2.pth

# Needed for Processing
pip install psycopg2 numpy nose2 pyyaml mock future
# Fix qscintilla typo
wget https://gist.githubusercontent.com/m-kuhn/f70e4b160dd7b18eb8d637ed2a75df6d/raw/6eb8a0c8601ec52ad9ad41c01d0fad68fe967aa1/qsci.patch
patch -p1 /usr/local/share/sip/QSci/qscilexer.sip qsci.patch
File renamed without changes.
@@ -0,0 +1,63 @@
qgis_openstreetmaptest
qgis_wcsprovidertest
PyQgsServer
ProcessingGdalAlgorithmsTest
ProcessingScriptAlgorithmsTest
ProcessingToolsTest
ProcessingModelerTest
ProcessingParametersTest
ProcessingGrass7AlgorithmsImageryTest
ProcessingGrass7AlgorithmsRasterTest
PyQgsOfflineEditingWFS
ProcessingGrass7AlgorithmsImageryTest
ProcessingGrass7AlgorithmsRasterTest
qgis_composerhtmltest
PyQgsOfflineEditingWFS
qgis_authconfigtest
qgis_atlascompositiontest
qgis_composerlabeltest
qgis_composerrotationtest
qgis_composerscalebartest
qgis_composerutilstest
qgis_composertablev2test
qgis_distanceareatest
qgis_diagramtest
qgis_expressiontest
qgis_fontmarkertest
qgis_labelingenginetest
qgis_legendrenderertest
qgis_maprotationtest
qgis_composerhtmltest
qgis_mapcanvastest
qgis_filedownloader
PyQgsAnnotation
PyQgsAtlasComposition
PyQgsComposerLegend
PyQgsComposerMapGrid
PyQgsDistanceArea
PyQgsJSONUtils
PyQgsOGRProviderGpkg
PyQgsOGRProviderSqlite
PyQgsPalLabelingBase
PyQgsPalLabelingPlacement
PyQgsPalLabelingComposer
ProcessingQgisAlgorithmsTest
qgis_composermapgridtest
qgis_composerpicturetest
qgis_taskmanagertest
PyQgsPalLabelingCanvas
PyQgsShapefileProvider
PyQgsTabfileProvider
PyQgsTextRenderer
PyQgsOGRProvider
PyQgsSpatialiteProvider
PyQgsSymbolLayer
PyQgsVectorFileWriter
PyQgsVirtualLayerProvider
PyQgsWFSProvider
PyQgsWFSProviderGUI
PyQgsLayerDependencies
PyQgsDBManagerGpkg
PyQgsFileDownloader
PyQgsSettings
PyQgsConsole
@@ -14,23 +14,51 @@
###########################################################################

mkdir build
cd build
pushd build

export PATH=/usr/local/opt/ccache/libexec:$PATH
HB=$(brew --prefix)

# force looking in HB/opt paths first, so headers in HB/include are not found first
prefixes="qt5
qt5-webkit
qscintilla2
qwt
qwtpolar
qca
qtkeychain
gdal2
gsl
geos
proj
libspatialite
spatialindex
fcgi
expat
sqlite
flex
bison"

full_prefixes=""
for p in ${prefixes}; do
full_prefixes+="${HB}/opt/${p};"
done

#no PGTEST for OSX - can't get postgres to start with brew install
#no APIDOC for OSX - doxygen tests and warnings are covered by linux build
#no deprecated-declarations warnings... requires QGIS ported to Cocoa
cmake \
-DWITH_SERVER=ON \
-G 'Ninja' \
-DCMAKE_FIND_FRAMEWORK:STRING=LAST \
-DCMAKE_PREFIX_PATH:STRING=${full_prefixes} \
-DWITH_SERVER=OFF \
-DWITH_DESKTOP=OFF \
-DWITH_STAGED_PLUGINS=ON \
-DWITH_GRASS=OFF \
-DSUPPRESS_SIP_WARNINGS=ON \
-DSUPPRESS_QT_WARNINGS=ON \
-DENABLE_MODELTEST=ON \
-DENABLE_PGTEST=OFF \
-DWITH_QWTPOLAR=OFF \
-DWITH_PYSPATIALITE=ON \
-DQWT_INCLUDE_DIR=/usr/local/opt/qwt/lib/qwt.framework/Headers/ \
-DQWT_LIBRARY=/usr/local/opt/qwt/lib/qwt.framework/qwt \
-DGDAL_CONFIG=/usr/local/opt/gdal-20/bin/gdal-config \
-DGRASS_PREFIX7=/usr/local/opt/grass-70/grass-7.0.4 \
-DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" \
..

popd
@@ -13,8 +13,26 @@
# #
###########################################################################

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo $PATH

export PATH=/usr/bin:${PATH}

ctest -V -E "$(cat ${DIR}/blacklist.txt | sed -r '/^(#.*?)?$/d' | paste -sd '|' -)" -S ./qgis-test-travis.ctest --output-on-failure
ccache -s
ccache -M 1G

# Allow a maximum of 25 minutes for the tests to run in order to timeout before
# travis does and in order to have some time left to upload the ccache to have
# a chance to finish a rebuild in time.
#
# Travis will kill the job after approx 48 minutes, so this leaves us 23 minutes
# for setup and cache uploading
gtimeout 25m ctest -V -E "$(cat ${DIR}/blacklist.txt | gsed -r '/^(#.*?)?$/d' | gpaste -sd '|' -)" -S ${DIR}/travis.ctest --output-on-failure

rv=$?

if [ $? -eq 124 ] ; then
echo '\033[0;33mBuild and test timeout. Please restart the build for useful results.\033[0m'
fi

exit $rv
@@ -0,0 +1,106 @@
SET (CTEST_SOURCE_DIRECTORY $ENV{TRAVIS_BUILD_DIR})
SET (CTEST_BINARY_DIRECTORY "$ENV{TRAVIS_BUILD_DIR}/build")
#SET (CTEST_SOURCE_DIRECTORY /usr/src/QGIS)
#SET (CTEST_BINARY_DIRECTORY /usr/src/qgis-build)

SET (CTEST_CMAKE_GENERATOR "Ninja")
SET (CTEST_CMAKE_COMMAND "cmake")
SET (CTEST_BUILD_COMMAND "/usr/local/bin/ninja")
SET (CTEST_SITE "travis-ci.org")
IF ($ENV{TRAVIS_PULL_REQUEST} STREQUAL "false")
# No pull request
SET (CTEST_BUILD_NAME "$ENV{TRAVIS_BRANCH} ($ENV{BUILD}) ($ENV{TRAVIS_COMMIT})")
ELSE()
SET (CTEST_BUILD_NAME "PR: $ENV{TRAVIS_PULL_REQUEST} / $ENV{TRAVIS_BRANCH} ($ENV{BUILD}) ($ENV{TRAVIS_COMMIT})")
ENDIF()
SET (CTEST_BUILD_CONFIGURATION "Release")
SET (CTEST_TEST_TIMEOUT 60) # 60 seconds
IF(DEFINED ENV{CTEST_PARALLEL_LEVEL})
SET(PARALLEL_LEVEL $ENV{CTEST_PARALLEL_LEVEL})
ELSE(DEFINED ENV{CTEST_PARALLEL_LEVEL})
SET(PARALLEL_LEVEL 2)
ENDIF(DEFINED ENV{CTEST_PARALLEL_LEVEL})

SET (INITIAL_CACHE "
BUILDNAME:STRING=${CTEST_BUILD_NAME}
SITE:STRING=${CTEST_SITE}
CTEST_USE_LAUNCHERS:BOOL=ON
")

SET (CTEST_NOTES_FILES
${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}
${CTEST_BINARY_DIRECTORY}/CMakeCache.txt
)

IF(NOT WIN32)
STRING(ASCII 27 Esc)
SET(ColorReset "${Esc}[m")
SET(ColorBold "${Esc}[1m")
SET(Red "${Esc}[31m")
SET(Green "${Esc}[32m")
SET(Yellow "${Esc}[33m")
SET(Blue "${Esc}[34m")
SET(Magenta "${Esc}[35m")
SET(Cyan "${Esc}[36m")
SET(White "${Esc}[37m")
SET(BoldRed "${Esc}[1;31m")
SET(BoldGreen "${Esc}[1;32m")
SET(BoldYellow "${Esc}[1;33m")
SET(BoldBlue "${Esc}[1;34m")
SET(BoldMagenta "${Esc}[1;35m")
SET(BoldCyan "${Esc}[1;36m")
SET(BoldWhite "${Esc}[1;37m")
ENDIF(NOT WIN32)

# Requires a track on the CDash server
#ctest_start(Experimental TRACK Travis)
ctest_start(Experimental)
ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE BUILDRES NUMBER_WARNINGS NUMWARN NUMBER_ERRORS NUMERR)

# Create link to test results
# CDash on OTB requires the date to be set for the search to work and that's the timezone this requires
SET(ENV{TZ} "UTC-6")
EXECUTE_PROCESS(COMMAND date +%Y-%m-%d OUTPUT_VARIABLE CDASH_DATE)
SET(RESULT_LINK "http://dash.orfeo-toolbox.org/index.php?project=QGIS&filtercount=1&showfilters=1&field1=buildname/string&compare1=63&value1=$ENV{TRAVIS_COMMIT}&date=${CDASH_DATE}")
EXECUTE_PROCESS(COMMAND curl --data-urlencode "url=${RESULT_LINK}" -s http://tinyurl.com/api-create.php
OUTPUT_VARIABLE SHORTURL)

SET(IGNORE_BUILD_FAILURES $ENV{IGNORE_BUILD_FAILURES})
IF(NOT IGNORE_BUILD_FAILURES)
IF(NOT ${BUILDRES} EQUAL 0 OR NOT ${NUMERR} EQUAL 0)
ctest_submit (RETRY_COUNT 3 RETRY_DELAY 30)
MESSAGE("")
MESSAGE(" ${Yellow}Test results submitted to${ColorReset}")
MESSAGE(" ${BoldYellow}${SHORTURL}${ColorReset}")
MESSAGE("")
MESSAGE( FATAL_ERROR " ${Red}Build failed. Not running tests.${ColorReset}" )
MESSAGE("")
ENDIF(NOT ${BUILDRES} EQUAL 0 OR NOT ${NUMERR} EQUAL 0)
ENDIF(NOT IGNORE_BUILD_FAILURES)
ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL ${PARALLEL_LEVEL} RETURN_VALUE TESTRES)
IF(NOT ${NUMWARN} EQUAL 0 OR NOT ${TESTRES} EQUAL 0)
ctest_submit (RETRY_COUNT 3 RETRY_DELAY 30)
MESSAGE("")
MESSAGE(" ${Yellow}Test results submitted to${ColorReset}")
MESSAGE(" ${BoldYellow}${SHORTURL}${ColorReset}" )
MESSAGE("")
SET(LEVEL "")
IF(NOT ${TESTRES} EQUAL 0)
SET(TESTRES_MESSAGE " Tests failed.")
SET(LEVEL FATAL_ERROR)
ENDIF(NOT ${TESTRES} EQUAL 0)
IF(NOT ${NUMWARN} EQUAL 0)
SET(WARNING_MESSAGE " Build warnings found.")
IF(NOT IGNORE_BUILD_FAILURES)
SET(LEVEL FATAL_ERROR)
ENDIF(NOT IGNORE_BUILD_FAILURES)
ENDIF(NOT ${NUMWARN} EQUAL 0)
MESSAGE( ${LEVEL} " ${Red}${TESTRES_MESSAGE} ${WARNING_MESSAGE}${ColorReset}" )
ENDIF(NOT ${NUMWARN} EQUAL 0 OR NOT ${TESTRES} EQUAL 0)

IF(NOT ${TESTRES} EQUAL 0)
MESSAGE("")
MESSAGE(" ${BoldGreen}Success${ColorReset}")
MESSAGE(" ${Green}All tests passed successfully.${ColorReset}")
MESSAGE("")
ENDIF(NOT ${TESTRES} EQUAL 0)
Empty file.

This file was deleted.

0 comments on commit 23cb825

Please sign in to comment.