-
Notifications
You must be signed in to change notification settings - Fork 29
/
.travis.yml
108 lines (100 loc) · 4.39 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#-----------------------------------------------------------------------------
#
# Configuration for continuous integration service at travis-ci.org
#
#-----------------------------------------------------------------------------
language: cpp
matrix:
include:
# Coverage
- os: osx
compiler: clang
env: NODE_VERSION="0.10.36" COVERAGE=true RUN_BUILD="shared_build"
# Linux
- os: linux
compiler: clang
env: NODE_VERSION="0.10.36" RUN_BUILD="static_build"
- os: linux
compiler: clang
env: NODE_VERSION="0.10.36" RUN_BUILD="shared_build"
# OS X
- os: osx
compiler: clang
env: NODE_VERSION="0.10.36" RUN_BUILD="shared_build"
- os: osx
compiler: clang
env: NODE_VERSION="0.10.36" RUN_BUILD="static_build"
# static_build == portable, statically linked node-osmium and deps
# shared_build == non-portable, shared libraries via package manager
env:
global:
- JOBS: "8"
- secure: Ac0sNxaMmm/4NLJwjB5W74wNNrXH2cFz4qADJSJwGr+p78NVrp+3B70Nlffg6sf6sq57KeoQi5EbUNSa4fjLS2FqJJDr5U8cOA4nt5tPGm8cucdAyr4VCREEddtV4jfIcNN0/I/DKIK4d744SmpqomVYqTUFOVK8LOT4vAX3tTo=
- secure: bsD0VyN6F6+ratG/C2AB1GrbmaPGyvaAgjZXd7tsQPYl+TR3BT643T9GikgN5IJdbjVBOJDfSqk76g/UlfLl9bRnoybP8tJsZJhCyMYKyRNGJZBIOyEVe6j5FrcT5ejBO0EIGaw2fXwSkG92pg7CFQOAPkVNgcl/H0XNdMa3Q/8=
before_install:
- export COVERAGE=${COVERAGE:-false}
# check if tag exists and matches package.json
- scripts/validate_tag.sh
# get commit message
- COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')
# put node-pre-gyp on path
- export PATH=./node_modules/.bin/:$PATH
# here we set up the node version on the fly based on the matrix value.
# This is done manually so that it is easy to flip the 'language' to
# objective-c in another branch (to run the same travis.yml on OS X)
- git clone https://github.com/creationix/nvm.git ../.nvm
- source ../.nvm/nvm.sh
- nvm install $NODE_VERSION
- nvm use $NODE_VERSION
- node --version
- npm --version
- 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;
fi;
install:
# set a few env settings for the static build script
- NODE_MODULE_ROOT=$(pwd)
- TMP_DEPS_DIR=$(mktemp -d -t XXXXXXXXXXX)
# WARNING: this script modifies the environment
- source ./scripts/${RUN_BUILD}.sh
- cd ${NODE_MODULE_ROOT}
before_script:
# install from source, ensure this works first
- git clone https://github.com/osmcode/libosmium.git ../libosmium
- if [[ ${COVERAGE} == true ]]; then
make coverage;
else
npm install --build-from-source --clang=1;
fi;
- if [[ `uname -s` == 'Darwin' ]]; then otool -L ./lib/binding/* || true; fi
- if [[ `uname -s` == 'Linux' ]]; then readelf -d ./lib/binding/* || true; fi
- npm test
- node-pre-gyp package
- node-pre-gyp testpackage
- if [[ ${COVERAGE} == true ]]; then cpp-coveralls --exclude src/node_osmium.hpp --exclude src/apply.hpp --exclude src/include_v8.hpp --exclude node_modules --exclude tests --build-root build --gcov-options '\-lp' --exclude doc --exclude build/Release/obj/gen; fi;
script:
# now we publish the binary, if needed
- PUBLISH_BINARY=false
# or check if we are manually requesting binary publishing via a commit keyword
- if [[ $RUN_BUILD == "static_build" ]] && [[ ${COVERAGE} == false ]] && test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true; fi;
# if either are true, then publish the binary
# Note: this publishing is done here, in the 'script' section, instead of the 'after_success'
# since we want any failure here to stop the build immediately
- if [[ $PUBLISH_BINARY == true ]]; then node-pre-gyp publish; fi
# now clean up to prepare to re-install from remote binary
- node-pre-gyp clean
# now install from published binary
# Note: we capture the error here so that if the install fails we can unpublish
- 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
# If success then we arrive here so let's test again
- if [[ $PUBLISH_BINARY == true ]]; then npm test; fi