Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #216 from amroamroamro/appveyor_ci
Browse files Browse the repository at this point in the history
continuous integration using AppVeyor
  • Loading branch information
kyamagu committed Nov 22, 2015
2 parents b04e97f + 3cbdc17 commit 342a3ec
Show file tree
Hide file tree
Showing 6 changed files with 400 additions and 24 deletions.
44 changes: 29 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#
# Travis CI build script
# Travis CI build script.
# https://travis-ci.org/kyamagu/mexopencv
#

#TODO:
Expand All @@ -19,18 +20,29 @@ os: linux
# Ubuntu 14.04 LTS Server Edition 64-bit (trusty)
#dist: trusty

# whitelisted branches to build
branches:
only:
- master
- v3.0

# global environment variables
env:
global:
- MCV_ROOT=$(pwd)
- OCTAVE=octave --no-gui --no-window-system
- OCTAVERC=$HOME/.octaverc
- OCTAVE_OPTS="--no-gui --no-window-system"
# whether to install Octave Forge packages. They are optional, tests will
# simply skip if needed packages are not detected. Note that the latest
# octave-image fails to compile with gcc-4.6 as it needs C++11 support.
- OCT_STATS=yes
- OCT_IMAGE=no
# common options for make
- MAKE_OPTS="NO_CV_PKGCONFIG_HACK=1 TEST_CONTRIB=false WITH_OCTAVE=1"
# Extra make arguments
# (avoid using too many parallel jobs, as it could starve memory!)
- MAKE_EXTRA=-j2
# whether to generate doxygen HTML documentation
- DOXY=yes

before_install:
Expand All @@ -41,44 +53,46 @@ before_install:
- sudo apt-get install -y octave liboctave-dev octave-pkg-dev
- sudo apt-get install -y libopencv3-dev
- if [ "$DOXY" = "yes" ]; then sudo apt-get install -y doxygen ; fi
# show current environment
# install image and statistics packages used by some tests
- if [ "$OCT_STATS" = "yes" ]; then octave $OCTAVE_OPTS --eval "try, pkg install -forge -local io statistics, end" ; fi
- if [ "$OCT_IMAGE" = "yes" ]; then octave $OCTAVE_OPTS --eval "try, pkg install -forge -local image, end" ; fi
# show info about build tools
- printenv
- lsb_release -a
- uname -a
- dpkg -s octave liboctave-dev libopencv3-dev
- $CXX --version
- make --version
- pkg-config --version
- $OCTAVE --version
- octave $OCTAVE_OPTS --version
- octave $OCTAVE_OPTS --eval "pkg list"
- pkg-config --modversion opencv
- pkg-config --cflags --libs opencv
- if [ "$DOXY" = "yes" ]; then doxygen --version ; fi

install:
# compile mexopencv
# (avoid using too many parallel jobs, as it could starve memory!)
- make WITH_OCTAVE=1 NO_CV_PKGCONFIG_HACK=1 -j2 all
- make $MAKE_OPTS $MAKE_EXTRA all
# build docs
- if [ "$DOXY" = "yes" ]; then make WITH_OCTAVE=1 doc ; fi
- if [ "$DOXY" = "yes" ]; then make $MAKE_OPTS doc ; fi

before_script:
# some tests use functions from image and statistics toolboxes
# they are optional, tests will simply skip if packages are not detected
# (latest octave-image fails to compile with gcc-4.6 as it needs C++11 support)
- if [ "$OCT_STATS" = "yes" ]; then $OCTAVE --eval "pkg install -forge -local io statistics" ; fi
- if [ "$OCT_IMAGE" = "yes" ]; then $OCTAVE --eval "pkg install -forge -local image" ; fi
# create .octaverc file (where we setup path and load required packages on start)
# (due to bug in Octave, we must also add private directories on path)
- touch $OCTAVERC
- echo "crash_dumps_octave_core(false);" >> $OCTAVERC
- echo "more off" >> $OCTAVERC
- if [ "$OCT_STATS" = "yes" ]; then echo "pkg load statistics" >> $OCTAVERC ; fi
- if [ "$OCT_IMAGE" = "yes" ]; then echo "pkg load image" >> $OCTAVERC ; fi
- if [ "$OCT_STATS" = "yes" ]; then echo "try, pkg load statistics, end" >> $OCTAVERC ; fi
- if [ "$OCT_IMAGE" = "yes" ]; then echo "try, pkg load image, end" >> $OCTAVERC ; fi
- echo "cd('$MCV_ROOT');" >> $OCTAVERC
- echo "addpath('$MCV_ROOT');" >> $OCTAVERC
- echo "addpath(fullfile('$MCV_ROOT','+cv','private'));" >> $OCTAVERC
- echo "%addpath(fullfile('$MCV_ROOT','opencv_contrib'));" >> $OCTAVERC
- echo "%addpath(fullfile('$MCV_ROOT','opencv_contrib','+cv','private'));" >> $OCTAVERC
- cat $OCTAVERC
# print cv build info
- octave $OCTAVE_OPTS --eval "path, disp(cv.getBuildInformation())"

script:
# run test suite
- make WITH_OCTAVE=1 test
- make $MAKE_OPTS test
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# CFLAGS Extra flags to give to the C/C++ MEX compiler.
# LDFLAGS Extra flags to give to compiler when it invokes the
# linker.
# TEST_CONTRIB Boolean, controls whether to run opencv_contrib tests
# as well as core opencv tests. false by default.
#
# The above settings can be defined as shell environment variables and/or
# specified on the command line as arguments to make:
Expand Down Expand Up @@ -50,7 +52,7 @@ MATLAB ?= $(MATLABDIR)/bin/matlab -nodisplay -noFigureWindows -nosplash
else
MATLABDIR ?= /usr
MEX ?= $(MATLABDIR)/bin/mkoctfile --mex
MATLAB ?= $(MATLABDIR)/bin/octave --no-gui --no-window-system --quiet
MATLAB ?= $(MATLABDIR)/bin/octave-cli --no-gui --no-window-system --quiet
endif
DOXYGEN ?= doxygen

Expand Down Expand Up @@ -172,9 +174,15 @@ clean:
doc:
$(DOXYGEN) Doxyfile

# controls opencv_contrib testing
TEST_CONTRIB ?= false

#TODO: https://savannah.gnu.org/bugs/?41699
# we can't always trust Octave's exit code on Windows! It throws 0xC0000005
# on exit (access violation), even when it runs just fine.
test:
ifndef WITH_OCTAVE
$(MATLAB) -r "addpath(pwd);cd test;try,UnitTest(false);catch e,disp(e.getReport);end;exit;"
$(MATLAB) -r "addpath(pwd);cd test;try,UnitTest($(TEST_CONTRIB));catch e,disp(e.getReport);end;exit;"
else
$(MATLAB) --eval "addpath(pwd);cd test;try,UnitTest(false);catch e,disp(e);exit(1);end;exit(0);"
$(MATLAB) --eval "addpath(pwd);cd test;try,UnitTest($(TEST_CONTRIB));catch e,disp(e);exit(1);end;exit(0);" || echo "Exit code: $$?"
endif
4 changes: 3 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
mexopencv
=========
[![Build Status](https://travis-ci.org/kyamagu/mexopencv.svg)](https://travis-ci.org/kyamagu/mexopencv)
[![Travis](https://img.shields.io/travis/kyamagu/mexopencv.svg)](https://travis-ci.org/kyamagu/mexopencv)
[![AppVeyor](https://img.shields.io/appveyor/ci/kyamagu/mexopencv.svg)](https://ci.appveyor.com/project/kyamagu/mexopencv)
[![License](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg)](LICENSE)

Collection and a development kit of MATLAB MEX functions for OpenCV library

Expand Down
154 changes: 154 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
#
# AppVeyor CI build script.
# https://ci.appveyor.com/project/kyamagu/mexopencv
#

# version format
version: 3.0.0.{build}

# clone directory
clone_folder: c:\projects\mexopencv

# whitelisted branches to build
branches:
only:
- master
- v3.0

# global environment variables
environment:
MCV_ROOT: c:\projects\mexopencv
OPENCV_DIR: c:\dev\build\install
OCTAVE_HOME: c:\dev\octave-4.0.0
#TODO: https://savannah.gnu.org/bugs/?41699
# we use octave-cli.exe here instead of octave.exe because of a bug
# in the MinGW/MXE build causing Octave to crash on exit with a segfault
# after having used any GraphicsMagick functions (imread, etc..).
# Even then, we can't always trust Octave's exit code on Windows! It throws
# 0xC0000005 on exit (access violation), even when it runs just fine.
#TODO: The YAML parser report errors if we use % as first char in a command,
# so we cannot just write %OCTAVE%, we must use: call %OCTAVE%
OCTAVE: octave-cli --no-gui --no-window-system
# whether to generate doxygen HTML documentation
DOXY: yes
# for pkg-config to find opencv.pc when using the makefile
PKG_CONFIG_PATH: /c/dev/build/install
# whether to run mexopencv.make() in Octave or use external makefile
WITH_MAKE: yes
# options in case of makefile (the quotes around the path are needed here!)
MAKE_OPTS: NO_CV_PKGCONFIG_HACK=1 TEST_CONTRIB=true WITH_OCTAVE=1 MATLABDIR='/c/dev/octave-4.0.0'
# Extra make arguments like number of parallel jobs (NPROC+1 is recommended).
# Note that GNU Make 3.81 bundled with Octave has poor parallel jobs support
# (make -jN freezes, make -j has no limit creating way too many processes!).
# So we download a newer GNU Make 4.1 for Windows (mingw32-make -jN works).
MAKE_EXTRA: -j2

# immediately finish build if one of the jobs fails
matrix:
fast_finish: true

# disable automatic building/testing/deploying phases, we use custom scripts
build: off
test: off
deploy: off

# keep build artifacts, which can be downloaded later
artifacts:
- path: test\UnitTest_*.log
name: tests-log

# enable debugging using an RDP connection
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

install:
# download and install dependencies
- if not exist "c:\dev" ( mkdir "c:\dev" )
- cd "c:\dev"
- if "%DOXY%" == "yes" ( choco install doxygen.portable -y )
- echo Installing GNU Make ...
- ps: Start-FileDownload "ftp://ftp.equation.com/make/32/make.exe" -FileName mingw32-make.exe
- set "PATH=c:\dev;%PATH%"
- echo Installing OpenCV ...
- ps: Start-FileDownload "https://github.com/amroamroamro/opencv/releases/download/3.0.0/build_mingw_x86.7z" -FileName build_mingw_x86.7z
- 7z x "c:\dev\build_mingw_x86.7z" -o"c:\dev\build" -y > nul
- set "PATH=%OPENCV_DIR%\x86\mingw\bin;%PATH%"
- echo Installing Octave ...
- ps: Start-FileDownload "https://ftp.gnu.org/gnu/octave/windows/octave-4.0.0_0.zip" -FileName octave-4.0.0_0.zip
- 7z x "c:\dev\octave-4.0.0_0.zip" -o"c:\dev" -y > nul
- copy /y "%OCTAVE_HOME%\bin\libopenblas.dll" "%OCTAVE_HOME%\bin\libblas.dll" > nul
- set "PATH=%OCTAVE_HOME%\bin;%PATH%"
- echo Installing Octave packages ...
- call %OCTAVE% --eval "try, pkg('install', fullfile(matlabroot,'src','image-2.4.0.tar.gz'), '-noauto'); end"
- call %OCTAVE% --eval "try, pkg('install', fullfile(matlabroot,'src','io-2.2.7.tar.gz'), '-noauto'); end"
- call %OCTAVE% --eval "try, pkg('install', fullfile(matlabroot,'src','statistics-1.2.4.tar.gz'), '-noauto'); end"
- dir "c:\dev"
# show info about build tools
- set
- ver
- systeminfo
- cmake --version
- mingw32-make --version
- g++ --version
- call %OCTAVE% --version
- call %OCTAVE% --eval "pkg list"
- if "%DOXY%" == "yes" ( doxygen --version )

before_build:
# create .octaverc file (where we setup path and load required packages on start)
#TODO: due to bug in Octave, we must also add private directories on path
- ps: |
$OctaveRC = @"
crash_dumps_octave_core(false);
more off
try, pkg load image, end
try, pkg load statistics, end
cd(getenv('MCV_ROOT'))
addpath(getenv('MCV_ROOT'))
addpath(fullfile(getenv('MCV_ROOT'),'+cv','private'))
addpath(fullfile(getenv('MCV_ROOT'),'opencv_contrib'))
addpath(fullfile(getenv('MCV_ROOT'),'opencv_contrib','+cv','private'))
"@
# one for SHELL=sh.exe and one for SHELL=cmd.exe
$HomeDirs = @(
(Join-Path (Join-Path $env:OCTAVE_HOME 'home') $env:USERNAME),
$env:USERPROFILE
)
$HomeDirs | ForEach-Object {
$OctaveRCFile = (Join-Path $_ '.octaverc')
New-Item -ItemType File -Path "$OctaveRCFile" -Force | Out-Null
$OctaveRC | Out-File -FilePath "$OctaveRCFile" -Encoding ASCII
}
cat "$OctaveRCFile"
build_script:
# compile mexopencv
- cd "%MCV_ROOT%"
- if "%WITH_MAKE%" == "yes" (
sh --login -c "cd \"$MCV_ROOT\" && mingw32-make $MAKE_OPTS $MAKE_EXTRA all contrib"
) else (
%OCTAVE% --eval "mexopencv.make('opencv_path',getenv('OPENCV_DIR'), 'opencv_contrib',true, 'progress',false, 'verbose',1);"
)
# generate HTML docs
- if "%DOXY%" == "yes" ( doxygen Doxyfile )

after_build:
# package all built MEX-files in a zip file
- pushd "%MCV_ROOT%" && 7z a -t7z "%APPVEYOR_BUILD_FOLDER%\mexopencv.7z" *.mex -r -y && popd
- appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\mexopencv.7z" -DeploymentName "binaries_octave_x86"
# package HTML docs
- if "%DOXY%" == "yes" ( 7z a -t7z "%APPVEYOR_BUILD_FOLDER%\mexopencv_doc.7z" "%MCV_ROOT%\doc\html\" -y > nul )
- if "%DOXY%" == "yes" ( appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\mexopencv_doc.7z" -DeploymentName "docs-cpp" )

before_test:
# print cv build info
- call %OCTAVE% --eval "path, disp(cv.getBuildInformation())"

test_script:
# run test suite
#TODO: we reset %ERRORLEVEL% because we can't rely on Octave exit code
- if "%WITH_MAKE%" == "yes" (
sh --login -c "cd \"$MCV_ROOT\" && mingw32-make $MAKE_OPTS test"
) else (
%OCTAVE% --eval "cd test;try,UnitTest(true);catch e,disp(e);exit(1);end;exit(0);" || ver > nul
)
Loading

0 comments on commit 342a3ec

Please sign in to comment.