diff --git a/.travis.yml b/.travis.yml index 08fcbeef5..658d0a29c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,4 @@ -# Prevent Travis from exporting CXX after matrix env -language: c - -sudo: false +language: generic matrix: include: @@ -13,15 +10,19 @@ matrix: - os: linux compiler: clang env: CXX=clang++-3.5 NODE_VERSION=5 + sudo: false - os: linux compiler: clang env: CXX=clang++-3.5 NODE_VERSION=4 + sudo: false - os: linux compiler: clang env: CXX=clang++-3.5 NODE_VERSION=0.12 + sudo: false - os: linux compiler: clang env: CXX=clang++-3.5 NODE_VERSION=0.10 + sudo: false # OS X - os: osx osx_image: xcode7 @@ -52,17 +53,16 @@ env: before_install: - export COVERAGE=${COVERAGE:-false} +- export PYTHONUSERBASE=$(pwd)/.local +- mkdir -p ${PYTHONUSERBASE} - if [[ ${COVERAGE} == true ]]; then - brew update; - brew install pyenv; - eval "$(pyenv init -)"; - pyenv install 2.7.6; - pyenv global 2.7.6; - pyenv rehash; - pip install cpp-coveralls; - pyenv rehash; + if [[ $(uname -s) == 'Linux' ]]; then + pip install --user cpp-coveralls; + else + easy_install --user cpp-coveralls; + fi; fi; -- ./scripts/install_node.sh +- source ./scripts/install_node.sh ${NODE_VERSION} install: - ./scripts/install.sh diff --git a/scripts/install.sh b/scripts/install.sh index 67999b9d8..021d9018f 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -5,9 +5,6 @@ set -o pipefail source ./scripts/install_mason.sh -source ~/.nvm/nvm.sh -nvm use ${NODE_VERSION} - if [[ ${COVERAGE} == true ]]; then npm install --build-from-source --debug --clang; else diff --git a/scripts/install_node.sh b/scripts/install_node.sh index 6ed19a800..679b1fc46 100755 --- a/scripts/install_node.sh +++ b/scripts/install_node.sh @@ -3,14 +3,24 @@ set -e set -o pipefail -if [ ! -d ~/.nvm ]; then - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.28.0/install.sh | bash +if [[ ${1:-false} == 'false' ]]; then + echo "Error: pass node version as first argument" + exit 1 fi -source ~/.nvm/nvm.sh +NODE_VERSION=$1 -nvm install ${NODE_VERSION} -nvm alias default ${NODE_VERSION} +# if an existing nvm is already installed we need to unload it +nvm unload || true +# here we set up the node version on the fly based on the matrix value. +# This is done manually so that the build works the same on OS X +rm -rf ./__nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ./__nvm +set +e +set +u +source ./__nvm/nvm.sh +nvm install ${NODE_VERSION} +nvm use ${NODE_VERSION} node --version npm --version +which node diff --git a/scripts/test.sh b/scripts/test.sh index f82017218..149894d3b 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -3,11 +3,8 @@ set -e set -o pipefail -source ~/.nvm/nvm.sh -nvm use ${NODE_VERSION} - npm test if [[ ${COVERAGE} == true ]]; then - cpp-coveralls --exclude node_modules --exclude tests --build-root build --gcov-options '\-lp' --exclude doc --exclude build/Debug/obj/gen + ${PYTHONUSERBASE}/bin/cpp-coveralls --exclude node_modules --exclude mason_packages --exclude tests --build-root build --gcov-options '\-lp' --exclude doc --exclude build/Debug/obj/gen fi diff --git a/scripts/travis_publish.sh b/scripts/travis_publish.sh index 8d618b1c8..5c70a704b 100755 --- a/scripts/travis_publish.sh +++ b/scripts/travis_publish.sh @@ -14,8 +14,6 @@ COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n') PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)") if [[ ${TRAVIS_TAG} == v${PACKAGE_JSON_VERSION} ]] || test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE" && [[ ${COVERAGE} == false ]]; then - source ~/.nvm/nvm.sh - nvm use $NODE_VERSION npm install aws-sdk