Skip to content

Commit

Permalink
Merge pull request #584 from mayeut/travis-matrix
Browse files Browse the repository at this point in the history
Add Travis-ci build matrix
  • Loading branch information
mayeut committed Oct 8, 2015
2 parents 9b437b0 + 5b6ff10 commit bbef2a9
Show file tree
Hide file tree
Showing 10 changed files with 654 additions and 22 deletions.
67 changes: 45 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,52 @@
language: c
os:
- linux
- osx
compiler:
- gcc
- clang
- x86_64-w64-mingw32-gcc
env:
- OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release
- OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
- OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1
- OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug

matrix:
exclude:
- os: osx
compiler: gcc
- os: osx
compiler: x86_64-w64-mingw32-gcc
- compiler: clang
env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
- compiler: clang
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug
- os: linux
compiler: clang
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release
- compiler: gcc
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1
- compiler: x86_64-w64-mingw32-gcc
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1
- compiler: x86_64-w64-mingw32-gcc
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug
- os: osx
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1

addons:
apt:
packages:
- gcc-multilib
- gcc-mingw-w64-base
- binutils-mingw-w64-i686
- binutils-mingw-w64-x86-64
- gcc-mingw-w64-i686
- gcc-mingw-w64-x86-64
- gcc-mingw-w64

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
26 changes: 26 additions & 0 deletions tools/ctest_scripts/toolchain-mingw32.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# http://www.cmake.org/Wiki/CmakeMingw
#
# Copyright (c) 2006-2014 Mathieu Malaterre <mathieu.malaterre@voxxl.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#

# the name of the target operating system
set(CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
set(CMAKE_RC_COMPILER i686-w64-mingw32-windres)

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
26 changes: 26 additions & 0 deletions tools/ctest_scripts/toolchain-mingw64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# http://www.cmake.org/Wiki/CmakeMingw
#
# Copyright (c) 2006-2014 Mathieu Malaterre <mathieu.malaterre@voxxl.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#

# the name of the target operating system
set(CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C and C++
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)

# here is the target environment located
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
134 changes: 134 additions & 0 deletions tools/ctest_scripts/travis-ci.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# -----------------------------------------------------------------------------
# Travis-ci ctest script for OpenJPEG project
# This will compile/run tests/upload to cdash OpenJPEG
# Results will be available at: http://my.cdash.org/index.php?project=OPENJPEG
# -----------------------------------------------------------------------------

cmake_minimum_required(VERSION 2.8)

set( ENV{LANG} en_US.UTF-8)
set( CTEST_DASHBOARD_ROOT "$ENV{PWD}/build" )
set( CTEST_CMAKE_GENERATOR "Unix Makefiles") # Always makefile in travis-ci environment

if ("$ENV{OPJ_BUILD_CONFIGURATION}" STREQUAL "")
set( CTEST_BUILD_CONFIGURATION "Release")
else()
set( CTEST_BUILD_CONFIGURATION "$ENV{OPJ_BUILD_CONFIGURATION}")
endif()

if ("$ENV{OPJ_SITE}" STREQUAL "")
set( CTEST_SITE "Unknown")
else()
set( CTEST_SITE "$ENV{OPJ_SITE}")
endif()

if ("$ENV{OPJ_BUILDNAME}" STREQUAL "")
set( CTEST_BUILD_NAME "Unknown-${CTEST_BUILD_CONFIGURATION}")
else()
set( CTEST_BUILD_NAME "$ENV{OPJ_BUILDNAME}")
endif()

if (NOT "$ENV{OPJ_CI_ARCH}" STREQUAL "")
if (APPLE)
set(CCFLAGS_ARCH "-arch $ENV{OPJ_CI_ARCH}")
else()
if ("$ENV{OPJ_CI_ARCH}" MATCHES "^i[3-6]86$")
set(CCFLAGS_ARCH "-m32 -march=$ENV{OPJ_CI_ARCH}")
elseif ("$ENV{OPJ_CI_ARCH}" STREQUAL "x86_64")
set(CCFLAGS_ARCH "-m64")
endif()
endif()
endif()

if ("$ENV{OPJ_CI_ASAN}" STREQUAL "1")
set(OPJ_HAS_MEMCHECK TRUE)
set(CTEST_MEMORYCHECK_TYPE "AddressSanitizer")
set(CCFLAGS_ARCH "${CCFLAGS_ARCH} -O1 -g -fsanitize=address -fno-omit-frame-pointer")
endif()

if("$ENV{CC}" MATCHES ".*mingw.*")
# We are trying to use mingw
if ("$ENV{OPJ_CI_ARCH}" MATCHES "^i[3-6]86$")
set(CTEST_CONFIGURE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CTEST_SCRIPT_DIRECTORY}/toolchain-mingw32.cmake")
else()
set(CTEST_CONFIGURE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CTEST_SCRIPT_DIRECTORY}/toolchain-mingw64.cmake")
endif()
endif()

if(NOT "$ENV{OPJ_CI_SKIP_TESTS}" STREQUAL "1")
# To execute part of the encoding test suite, kakadu binaries are needed to decode encoded image and compare
# it to the baseline. Kakadu binaries are freely available for non-commercial purposes
# at http://www.kakadusoftware.com.
# 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 ("$ENV{OPJ_NONCOMMERCIAL}" STREQUAL "1" )
set(KDUPATH $ENV{PWD}/kdu)
set(ENV{LD_LIBRARY_PATH} ${KDUPATH})
set(ENV{PATH} $ENV{PATH}:${KDUPATH})
endif()
set(BUILD_TESTING "TRUE")
else()
set(BUILD_TESTING "FALSE")
endif(NOT "$ENV{OPJ_CI_SKIP_TESTS}" STREQUAL "1")

# Options
set( CACHE_CONTENTS "
# Build kind
CMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION}
# Warning level
CMAKE_C_FLAGS:STRING= ${CCFLAGS_ARCH} -Wall -Wextra -Wconversion -Wno-unused-parameter -Wdeclaration-after-statement
# Use to activate the test suite
BUILD_TESTING:BOOL=${BUILD_TESTING}
# Build Thirdparty, useful but not required for test suite
BUILD_THIRDPARTY:BOOL=TRUE
# JPEG2000 test files are available with git clone https://github.com/uclouvain/openjpeg-data.git
OPJ_DATA_ROOT:PATH=$ENV{PWD}/data
# jpylyzer is available with on GitHub: https://github.com/openpreserve/jpylyzer
JPYLYZER_EXECUTABLE=$ENV{PWD}/jpylyzer/jpylyzer/jpylyzer.py
" )

#---------------------
#1. openjpeg specific:
set( CTEST_PROJECT_NAME "OPENJPEG" )
if(NOT EXISTS $ENV{OPJ_SOURCE_DIR})
message(FATAL_ERROR "OPJ_SOURCE_DIR not defined or does not exist:$ENV{OPJ_SOURCE_DIR}")
endif()
set( CTEST_SOURCE_DIRECTORY "$ENV{OPJ_SOURCE_DIR}")
set( CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}")

#---------------------
# Files to submit to the dashboard
set (CTEST_NOTES_FILES
${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}
${CTEST_BINARY_DIRECTORY}/CMakeCache.txt )

ctest_empty_binary_directory( "${CTEST_BINARY_DIRECTORY}" )
file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "${CACHE_CONTENTS}")

# Perform a Experimental build
ctest_start(Experimental)
#ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}")
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" OPTIONS "${CTEST_CONFIGURE_OPTIONS}")
ctest_read_custom_files(${CTEST_BINARY_DIRECTORY})
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}")
if(NOT "$ENV{OPJ_CI_SKIP_TESTS}" STREQUAL "1")
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL 2)
if(OPJ_HAS_MEMCHECK)
ctest_memcheck(BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL 2)
endif()
endif()
if ("$ENV{OPJ_DO_SUBMIT}" STREQUAL "1")
ctest_submit()
endif()
# Do not clean, we'll parse the log for known failure
#ctest_empty_binary_directory( "${CTEST_BINARY_DIRECTORY}" )
85 changes: 85 additions & 0 deletions tools/travis-ci/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/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

# We don't need anything for coverity scan builds

if [ "${COVERITY_SCAN_BRANCH:-}" != "1" ]; then

if [ "${OPJ_CI_ASAN:-}" == "1" ]; then
# We need a new version of cmake than travis-ci provides
wget -qO - http://www.cmake.org/files/v3.3/cmake-3.3.1-Linux-x86_64.tar.gz | tar -xz
# copy to a directory that will not changed every version
mv cmake-3.3.1-Linux-x86_64 cmake-install
fi

if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then

OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd)

# We need test data
if [ "${TRAVIS_BRANCH:-}" == "" ]; then
TRAVIS_BRANCH=$(git -C ${OPJ_SOURCE_DIR} branch | grep '*' | tr -d '*[[:blank:]]') #default to same branch as we're setting up
fi
OPJ_DATA_HAS_BRANCH=$(git ls-remote --heads git://github.com/uclouvain/openjpeg-data.git ${TRAVIS_BRANCH} | wc -l)
if [ ${OPJ_DATA_HAS_BRANCH} -ne 0 ]; then
OPJ_DATA_BRANCH=${TRAVIS_BRANCH}
else
OPJ_DATA_BRANCH=master #default to master
fi
echo "Cloning openjpeg-data from ${OPJ_DATA_BRANCH} branch"
git clone --depth=1 --branch=${OPJ_DATA_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" ] || uname -s | grep -i Linux &> /dev/null; then
echo "Retrieving Kakadu"
wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_Linux-x86-64_150710.zip
cmake -E tar -xf KDU77_Demo_Apps_for_Linux-x86-64_150710.zip
mv KDU77_Demo_Apps_for_Linux-x86-64_150710 kdu
elif [ "${TRAVIS_OS_NAME:-}" == "osx" ] || uname -s | grep -i Darwin &> /dev/null; then
echo "Retrieving Kakadu"
wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_OSX109_150710.dmg_.zip
cmake -E tar -xf KDU77_Demo_Apps_for_OSX109_150710.dmg_.zip
wget -q http://downloads.sourceforge.net/project/catacombae/HFSExplorer/0.23/hfsexplorer-0.23-bin.zip
mkdir hfsexplorer && cmake -E chdir hfsexplorer tar -xf ../hfsexplorer-0.23-bin.zip
./hfsexplorer/bin/unhfs.sh -o ./ -fsroot Kakadu-demo-apps.pkg KDU77_Demo_Apps_for_OSX109_150710.dmg
pkgutil --expand Kakadu-demo-apps.pkg ./kdu
cd kdu
cat libkduv77r.pkg/Payload | gzip -d | cpio -id
cat kduexpand.pkg/Payload | gzip -d | cpio -id
cat kducompress.pkg/Payload | gzip -d | cpio -id
install_name_tool -id ${PWD}/libkdu_v77R.dylib libkdu_v77R.dylib
install_name_tool -change /usr/local/lib/libkdu_v77R.dylib ${PWD}/libkdu_v77R.dylib kdu_compress
install_name_tool -change /usr/local/lib/libkdu_v77R.dylib ${PWD}/libkdu_v77R.dylib kdu_expand
fi
fi
fi
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NR-ENC-Bretagne2.ppm-7-compare_dec-ref-out2base
Loading

0 comments on commit bbef2a9

Please sign in to comment.