-
Notifications
You must be signed in to change notification settings - Fork 0
/
.runtests.sh
executable file
·121 lines (106 loc) · 3.89 KB
/
.runtests.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
#!/usr/bin/env bash
echo "Using GOPATH=$GOPATH"
echo "Getting github.com/EngoEngine/systems using 'go get'"
go get -t -v ./... || exit 1
# These can fail without us minding it
blacklist="github.com/EngoEngine/engo/demos/demoutils"
if [ "$TEST_TYPE" == "linux_test" ]
then
echo "Testing github.com/EngoEngine/engo using coveralls"
$HOME/gopath/bin/goveralls -service=travis-ci
echo "Testing and benchmarking github.com/EngoEngine/engo"
go test -v -bench=. ./... || exit 1
echo "Checking for unnecessary conversions using unconvert"
unconvert -v github.com/EngoEngine/engo
elif [ "$TEST_TYPE" == "linux_build" ]
then
for dir in `pwd`/demos/*/
do
# Formatting the directory to be usable by Go
dir=${dir%*/}
dir=${dir#$GOPATH/src/}
# Ignore the directory if it's in the blacklist
if [[ $blacklist == *"${dir}"* ]]
then
echo "Skipping ${dir}"
continue
fi
# Some debug output and output directory initialization
echo "Verifying ${dir} ..."
outdir="/tmp/go-builds"
# Creating the output directory, attempting to build and exit 1 if it failed
mkdir -p "$outdir/linux/"
go build -o "$outdir/linux/${dir}" -tags demo ${dir} || exit 1
done
elif [ "$TEST_TYPE" == "js_test" ]
then
echo "Getting and installing node.js"
wget https://raw.githubusercontent.com/creationix/nvm/v0.33.11/nvm.sh -O ~/.nvm/nvm.sh
source ~/.nvm/nvm.sh
nvm install 5
npm install -g source-map-support
echo "Setting up node.js for gopherjs testing"
cd $GOPATH/src/github.com/gopherjs/gopherjs/node-syscall/
npm install -g node-gyp
node-gyp rebuild
mkdir -p ~/.node_libraries/
cp build/Release/syscall.node ~/.node_libraries/syscall.node
echo "Testing engo using gopherjs test"
cd $GOPATH/src/github.com/EngoEngine/engo
gopherjs test -v --tags=jstesting --bench=. ./... || exit 1
elif [ "$TEST_TYPE" == "js_build" ]
then
for dir in `pwd`/demos/*/
do
# Formatting the directory to be usable by Go
dir=${dir%*/}
dir=${dir#$GOPATH/src/}
# Ignore the directory if it's in the blacklist
if [[ $blacklist == *"${dir}"* ]]
then
echo "Skipping ${dir}"
continue
fi
# Some debug output and output directory initialization
echo "Verifying ${dir} ..."
outdir="/tmp/go-builds"
# Creating the output directory, attempting to build and exit 1 if it failed
mkdir -p "$outdir/gopherjs/"
gopherjs build -o "$outdir/gopherjs/${dir}" --tags demo ${dir} || exit 1
done
elif [ "$TEST_TYPE" == "android_test" ]
then
echo "Skipping tests for github.com/EngoEngine/engo using 'gomobile' (no tools exist yet)"
elif [ "$TEST_TYPE" == "android_build" ]
then
for dir in `pwd`/demos/*/
do
# Formatting the directory to be usable by Go
dir=${dir%*/}
dir=${dir#$GOPATH/src/}
# Ignore the directory if it's in the blacklist
if [[ $blacklist == *"${dir}"* ]]
then
echo "Skipping ${dir}"
continue
fi
# Some debug output and output directory initialization
echo "Verifying ${dir} ..."
outdir="/tmp/go-builds"
# Creating the output directory, attempting to build and exit 1 if it failed
mkdir -p `dirname "$outdir/android/${dir}.apk"`
gomobile build -o "$outdir/android/${dir}.apk" -target android -tags demo ${dir} || exit 1
done
elif [ "$TEST_TYPE" == "traffic_manager" ]
then
branches='01-hello-world 02-first-system 03-camera-movement 04-hud'
cd $HOME/gopath/src/github.com/EngoEngine/TrafficManager
for branch in $branches
do
echo "Verifying ${branch} ..."
git checkout ${branch}
go build -o "tmp/go-builds/${branch}" || exit 1
done
else
echo "environment variable TEST_TYPE was not set"
fi