From feca3e5e37380229c49062eff380c2ea512e1aa4 Mon Sep 17 00:00:00 2001 From: Peter Braden Date: Wed, 11 Feb 2015 21:39:52 +0100 Subject: [PATCH] OSX travis build --- .travis.yml | 70 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 61 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 52ec0ef..218daf4 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,63 @@ -language: node_js -node_js: - - "0.10" - - "0.11" - - "0.12" +language: objective-c +#compiler: clang + +env: + matrix: + - export NODE_VERSION="0.10" + - export NODE_VERSION="0.11" + global: + - secure: # Add keys here + - secure: # Add keys here before_install: - - sudo apt-get update - - sudo apt-get install libcv-dev - - sudo apt-get install libopencv-dev - - sudo apt-get install libhighgui-dev + - git clone https://github.com/creationix/nvm.git ./.nvm + - source ./.nvm/nvm.sh + - nvm install $NODE_VERSION + - nvm use $NODE_VERSION + - brew tap homebrew/science + - brew update + - brew install opencv + # get commit message + - COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n') + # put local node-pre-gyp on PATH + - export PATH=./node_modules/.bin/:$PATH + # install node-pre-gyp so it is available for packaging and publishing + - npm install node-gyp -g + # install node-pre-gyp so it is available for packaging and publishing + - npm install node-pre-gyp + # install aws-sdk so it is available for publishing to AS3 + - npm install aws-sdk + # figure out if we should publish + - PUBLISH_BINARY=false + # if we are building a tag then publish + - if [[ $TRAVIS_BRANCH == `git describe --tags --always HEAD` ]]; then PUBLISH_BINARY=true; fi; + # or if we put [publish binary] in the commit message + - if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true; fi; + - platform=$(uname -s | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/") + +install: + # ensure source install works + - npm install --build-from-source + # test our module + - npm test + - node lib/opencv.js + +before_script: + - echo "Publishing native platform Binary Package? ->" $PUBLISH_BINARY + # if publishing, do it + - if [[ $PUBLISH_BINARY == true ]]; then node-pre-gyp package publish || true; fi; + # cleanup + - node-pre-gyp clean + - node-gyp clean + +script: + # if publishing, test installing from remote + - INSTALL_RESULT=0 + - if [[ $PUBLISH_BINARY == true ]]; then INSTALL_RESULT=$(npm install --fallback-to-build=false > /dev/null)$? || true; fi; + # if install returned non zero (errored) then we first unpublish and then call false so travis will bail at this line + - if [[ $INSTALL_RESULT != 0 ]]; then echo "returned $INSTALL_RESULT";node-pre-gyp unpublish;false; fi + # there is no need for 32bit binaries on Mac OSx since those machines are ancient + +after_success: + # if success then query and display all published binaries + - node-pre-gyp info