forked from GoogleCloudPlatform/cloud-bigtable-examples
-
Notifications
You must be signed in to change notification settings - Fork 2
/
travis.sh
executable file
·127 lines (115 loc) · 2.93 KB
/
travis.sh
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/env bash
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Note: travis currently does not support listing more than one language so
# this cheats and claims to only be cpp. If they add multiple language
# support, this should probably get updated to install steps and/or
# rvm/gemfile/jdk/etc. entries rather than manually doing the work.
# Modeled after:
# https://github.com/google/protobuf/blob/master/travis.sh
add_ppa() {
ppa=$1
# Install the apt-add-repository command.
sudo apt-get -qqy install \
software-properties-common
sudo apt-add-repository -y "${ppa}"
sudo apt-get -qq update || true
}
use_java() {
version=$1
case "$version" in
jdk8)
add_ppa 'ppa:openjdk-r/ppa'
sudo apt-get -qqy install openjdk-8-jdk
export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH
;;
oracle8)
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | \
sudo debconf-set-selections
add_ppa 'ppa:webupd8team/java'
sudo apt-get -o Dpkg::Options::="--force-overwrite" -qqy install \
oracle-java8-installer
export PATH=/usr/lib/jvm/java-8-oracle/bin:$PATH
;;
esac
which java
java -version
}
build_java() {
(
cd java
mvn --batch-mode clean verify -DskipTests -Dexec.skip=true | egrep -v "(^\[INFO\] Download|^\[INFO\].*skipping)"
)
}
build_node() {
echo "travis_fold:start:node_setup"
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
export NVM_DIR="$HOME/.nvm"
source $NVM_DIR/nvm.sh
nvm install 8
nvm use 8
echo "travis_fold:end:node_setup"
(
cd node
npm install
npm run lint
npm run doctoc
if git status --porcelain | grep -q README.md; then
echo "TOC need to be regenerated: \"npm run doctoc\"."
exit 1
fi
)
}
build_python() {
sudo pip install --upgrade pip wheel virtualenv
sudo pip install --upgrade nox-automation
(
cd python
nox --stop-on-first-error --session lint
)
}
print_usage() {
echo "
Usage: $0 { java_jdk8 |
java_oracle8 |
python }
"
}
# -------- main --------
if [ "$#" -ne 1 ]; then
print_usage
exit 1
fi
set -e # exit immediately on error
set -x # display all commands
case $1 in
java_jdk8)
use_java jdk8
build_java
;;
java_oracle8)
use_java oracle8
build_java
;;
node)
build_node
;;
python)
build_python
;;
*)
print_usage
exit 1
;;
esac