.travis.yml
2.79 KB
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
language: objective-c
env:
global:
- secure: "gve1nkeKkwFEG1VAT3i+JwYyAdF0gKXwKx0uxbkBTsmm2M+0MDusohQdFLoEIkSIFktXBIDefoa7iGpLKRfG2VsZLpwJgnvnD0HqbnuR+k+W+bu7BHt4CAaR6GTllsDCjyq9zNyhUThzSnf2WNIpOEF5kHspZlbGfawURuUJH/U="
- secure: "jqVpmWxxBVXu2X8+XJMpKH0cooc2EKz9xKL2znBfYdNafJORSXcFAVbjCX5mZmVDcgIMwDtm2+gIG4P73hzJ2e3S+y2Z9ROJGyXHa3AxUTvXHQsxqzH8coHHqB8vTvfr0t2O5aKfpvpICpSea39r0hzNoMv6Ie5SwBdqj1YY9K0="
matrix:
- NODE_VERSION="v11"
- NODE_VERSION="v10"
- NODE_VERSION="v9"
- NODE_VERSION="v8"
- NODE_VERSION="v7"
- NODE_VERSION="v6"
- NODE_VERSION="v5"
- NODE_VERSION="v4"
before_install:
- echo $TRAVIS_OS_NAME
# commit
# ------------------------
# The commit message is used to determine the whether to manually
# invoke a binary publish
- COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')
# node
# ------------------------
- export PATH=./node_modules/.bin/:$PATH
- rm -rf ~/.nvm && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm
- source ~/.nvm/nvm.sh
- nvm install $NODE_VERSION
- nvm use $NODE_VERSION
- npm install -g npm@3
- node --version
- npm --version
- nvm --version
# publish dependencies
# ------------------------
- npm install node-gyp -g
- npm install aws-sdk
install:
# in the first instance we build from source to create the initial binary
# which can then be used to create a package
- npm install --build-from-source
- npm test
before_script:
# Detemine if a publish is required.
#
# a) we are building a tag
# b) we put [publish binary] in the commit message
- PUBLISH_BINARY=false
- if [[ $TRAVIS_BRANCH == `git describe --tags --always HEAD` ]]; then PUBLISH_BINARY=true; fi; # a
- if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true; fi; # b
# package & publish
# ------------------------
- if [[ $PUBLISH_BINARY == true ]]; then npm run node-pre-gyp package publish; fi;
# clean-up
# ------------------------
- npm run node-pre-gyp clean
- node-gyp clean
script:
# validate
# ------------------------
# Post publishing a release verify that installing will pull down latest
# binary from remote host
- INSTALL_RESULT=0
- if [[ $PUBLISH_BINARY == true ]]; then INSTALL_RESULT=$(npm install --fallback-to-build=false > /dev/null)$? || true; fi;
- npm run node-pre-gyp clean
# failure?
# ------------------------
# 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 npm run node-pre-gyp unpublish; fi;
- if [[ $INSTALL_RESULT != 0 ]]; then echo "returned $INSTALL_RESULT";false; fi;
after_success:
# display all published binaries
- npm run node-pre-gyp info