This is just to get some ideas of what can be done.
Update uclouvain/openjpeg#581
language: c
+os:
+ - linux
+ - osx
compiler:
- gcc
+ - clang
+
+matrix:
+ exclude:
+ - os: osx
+ - compiler: gcc
-before_install:
- - cmake --version
- - git clone --depth=1 --branch=master git://github.com/uclouvain/openjpeg-data.git data
- - wget -qO - https://github.com/openpreserve/jpylyzer/archive/1.14.2.tar.gz | tar -xvz
-# When OPJ_NONCOMMERCIAL=1, kakadu trial binaries are used for testing. Here's the copyright notice from kakadu:
-# Copyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney.
-# You are free to trial these executables and even to re-distribute them,
-# so long as such use or re-distribution is accompanied with this copyright notice and is not for commercial gain.
-# Note: Binaries can only be used for non-commercial purposes.
- - if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ]; then wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_Linux-x86-64_150710.zip; fi
install:
- - chmod +x jpylyzer-1.14.2/jpylyzer/jpylyzer.py
- - if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ]; then cmake -E tar -xf KDU77_Demo_Apps_for_Linux-x86-64_150710.zip; fi
- - export LD_LIBRARY_PATH=${PWD}/KDU77_Demo_Apps_for_Linux-x86-64_150710:${LD_LIBRARY_PATH}
- - export PATH=${PWD}/KDU77_Demo_Apps_for_Linux-x86-64_150710:${PATH}
+ - ./tools/travis-ci/install.sh
script:
- - if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ]; then echo -e "\nTesting will use Kakadu trial binaries. Here's the copyright notice from kakadu:\nCopyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney.\nYou are free to trial these executables and even to re-distribute them,\nso long as such use or re-distribution is accompanied with this copyright notice and is not for commercial gain.\nNote:\ Binaries can only be used for non-commercial purposes.\n"; fi
- - mkdir build
- - cd build
- - cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_CODEC=ON -DBUILD_THIRDPARTY=ON -DBUILD_TESTING=ON -DOPJ_DATA_ROOT=${PWD}/../data -DJPYLYZER_EXECUTABLE=${PWD}/../jpylyzer-1.14.2/jpylyzer/jpylyzer.py -DSITE=travis-ci.org -DBUILDNAME=${TRAVIS_OS_NAME}-${CC}$(${CC} -dumpversion)-x86_64-${TRAVIS_BRANCH}$( [[ "${TRAVIS_PULL_REQUEST}" != "false" ]] && echo "-pr${TRAVIS_PULL_REQUEST}" )-Release-3rdP ..
- - ctest -D ExperimentalStart
- - ctest -D ExperimentalBuild -V
- - ctest -D ExperimentalTest -j2 || true
- - ctest -D ExperimentalSubmit || true
+ - ./tools/travis-ci/run.sh
--- /dev/null
+#!/bin/bash
+
+# This script executes the install step when running under travis-ci
+
+# Set-up some error handling
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o pipefail ## Fail on error in pipe
+
+function exit_handler ()
+{
+ local exit_code="$?"
+
+ test ${exit_code} == 0 && return;
+
+ echo -e "\nInstall failed !!!\nLast command at line ${BASH_LINENO}: ${BASH_COMMAND}";
+ exit "${exit_code}"
+}
+trap exit_handler EXIT
+trap exit ERR
+
+# travis-ci doesn't dump cmake version in system info, let's print it
+cmake --version
+
+# We need test data
+if [ "${TRAVIS_BRANCH:-}" == "" ]; then
+ TRAVIS_BRANCH=master #default to master
+fi
+echo "Cloning openjpeg-data from ${TRAVIS_BRANCH} branch"
+git clone --depth=1 --branch=${TRAVIS_BRANCH} git://github.com/uclouvain/openjpeg-data.git data
+
+# We need jpylyzer for the test suite
+echo "Retrieving jpylyzer"
+wget -qO - https://github.com/openpreserve/jpylyzer/archive/1.14.2.tar.gz | tar -xz
+mv jpylyzer-1.14.2 jpylyzer
+chmod +x jpylyzer/jpylyzer/jpylyzer.py
+
+# When OPJ_NONCOMMERCIAL=1, kakadu trial binaries are used for testing. Here's the copyright notice from kakadu:
+# Copyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney.
+# You are free to trial these executables and even to re-distribute them,
+# so long as such use or re-distribution is accompanied with this copyright notice and is not for commercial gain.
+# Note: Binaries can only be used for non-commercial purposes.
+if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ]; then
+ if [ "${TRAVIS_OS_NAME:-}" == "linux" ]; then
+ echo "Retrieving Kakadu"
+ wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_Linux-x86-64_150710.zip | tar -x
+ cmake -E tar -xf KDU77_Demo_Apps_for_Linux-x86-64_150710.zip
+ mv KDU77_Demo_Apps_for_Linux-x86-64_150710 kdu
+ fi
+fi
--- /dev/null
+#!/bin/bash
+
+# This script executes the script step when running under travis-ci
+
+# Set-up some bash options
+set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
+set -o errexit ## set -e : exit the script if any statement returns a non-true return value
+set -o pipefail ## Fail on error in pipe
+
+# Set-up some variables
+OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd)
+
+if [ "${TRAVIS_REPO_SLUG:-}" == "uclouvain/openjpeg" ]; then
+ OPJ_SITE="travis-ci.org"
+ OPJ_DO_SUBMIT=1
+else
+ OPJ_SITE="$(hostname)"
+ OPJ_DO_SUBMIT=0 # Do not flood cdash
+fi
+
+if [ "${TRAVIS_OS_NAME:-}" == "" ]; then
+ # Let's guess OS for testing purposes
+ echo "Guessing OS"
+ if uname -s | grep -i Darwin &> /dev/null; then
+ TRAVIS_OS_NAME=osx
+ elif uname -s | grep -i Linux &> /dev/null; then
+ TRAVIS_OS_NAME=linux
+ if [ "${CC:-}" == "" ]; then
+ # default to gcc
+ export CC=gcc
+ fi
+ else
+ echo "Failed to guess OS"; exit 1
+ fi
+ echo "${TRAVIS_OS_NAME}"
+fi
+
+if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
+ OPJ_OS_NAME=$(sw_vers -productName | tr -d ' ')$(sw_vers -productVersion | sed 's/\([^0-9]*\.[0-9]*\).*/\1/')
+ OPJ_CC_VERSION=$(xcodebuild -version | grep -i xcode)
+ OPJ_CC_VERSION=xcode${OPJ_CC_VERSION:6}
+elif [ "${TRAVIS_OS_NAME}" == "linux" ]; then
+ OPJ_OS_NAME=linux
+ if which lsb_release > /dev/null; then
+ OPJ_OS_NAME=$(lsb_release -si)$(lsb_release -sr | sed 's/\([^0-9]*\.[0-9]*\).*/\1/')
+ fi
+ if [ "${CC}" == "gcc" ]; then
+ OPJ_CC_VERSION=gcc$(${CC} --version | head -1 | sed 's/.*\ \([0-9.]*[0-9]\)/\1/')
+ elif [ "${CC}" == "clang" ]; then
+ OPJ_CC_VERSION=clang$(${CC} --version | grep version | sed 's/.*version \([^0-9.]*[0-9.]*\).*/\1/')
+ else
+ echo "Compiler not supported: ${CC}"
+ fi
+else
+ echo "OS not supported: ${TRAVIS_OS_NAME}"
+fi
+
+if [ "${TRAVIS_BRANCH:-}" == "" ]; then
+ echo "Guessing branch"
+ TRAVIS_BRANCH=$(git -C ../openjpeg branch | grep '*' | tr -d '*[[:blank:]]') #default to master
+fi
+
+OPJ_BUILDNAME=${OPJ_OS_NAME}-${OPJ_CC_VERSION}-${TRAVIS_BRANCH}
+if [ "${TRAVIS_PULL_REQUEST:-}" != "false" ] && [ "${TRAVIS_PULL_REQUEST:-}" != "" ]; then
+ OPJ_BUILDNAME=${OPJ_BUILDNAME}-pr${TRAVIS_PULL_REQUEST}
+fi
+OPJ_BUILDNAME=${OPJ_BUILDNAME}-Release-3rdP
+
+if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ] && [ -d kdu ]; then
+ echo "
+Testing will use Kakadu trial binaries. Here's the copyright notice from kakadu:
+Copyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney.
+You are free to trial these executables and even to re-distribute them,
+so long as such use or re-distribution is accompanied with this copyright notice and is not for commercial gain.
+Note: Binaries can only be used for non-commercial purposes.
+"
+fi
+
+set -x
+if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ] && [ -d kdu ]; then
+ if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
+ export LD_LIBRARY_PATH=${PWD}/kdu:${LD_LIBRARY_PATH}
+ fi
+ export PATH=${PWD}/kdu:${PATH}
+fi
+
+mkdir build
+cd build
+cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_CODEC=ON -DBUILD_THIRDPARTY=ON -DBUILD_TESTING=ON -DOPJ_DATA_ROOT=${PWD}/../data -DJPYLYZER_EXECUTABLE=${PWD}/../jpylyzer/jpylyzer/jpylyzer.py -DSITE=${OPJ_SITE} -DBUILDNAME=${OPJ_BUILDNAME} ${OPJ_SOURCE_DIR}
+ctest -D ExperimentalStart
+ctest -D ExperimentalBuild -V
+ctest -D ExperimentalTest -j2 || true
+ctest -D ExperimentalSubmit || true