-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild_test.sh
executable file
·57 lines (52 loc) · 983 Bytes
/
build_test.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
#!/bin/bash
set -em
APPLICATION_CONFIG='
{
"server": {
"port": 8081
},
"yggdrasil": {
"token": {
"timeToPartiallyExpired": "2s",
"timeToFullyExpired": "4s"
},
"core": {
"url": "http://localhost:8081/"
}
}
}
'
log(){
echo -e "\e[93m\e[1m[build]\e[0m $*"
}
pushd server >/dev/null
log "Building yggdrasil server"
gradle clean bootJar
popd >/dev/null
pushd test >/dev/null
log "Initialize npm"
npm install .
log "npm test"
npm test
log "Starting yggdrasil server"
../server/build/libs/*.jar "--spring.application.json=$APPLICATION_CONFIG" &
onexit(){
set +e
if jobs -rp|grep -P "\d+">/dev/null;then
log "Stopping server"
pkill -15 -P $(jobs -rp)
fg 1
fi
}
trap onexit EXIT
# wait for application to start
while ! lsof -i:8081>/dev/null;do
if ! jobs -r|grep '\[1\]'>/dev/null;then
log "Server didn't start"
exit 1
fi
sleep 1
done
log "Server started"
log "Running integration test"
npm --api_root="http://localhost:8081" run integration-test