forked from cer/event-sourcing-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_build-and-test-all.sh
executable file
·70 lines (50 loc) · 1.52 KB
/
_build-and-test-all.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
#! /bin/bash
set -e
if [ -z "$DOCKER_HOST_IP" ] ; then
if [ -z "$DOCKER_HOST" ] ; then
export DOCKER_HOST_IP=`hostname`
else
echo using ${DOCKER_HOST?}
XX=${DOCKER_HOST%\:*}
export DOCKER_HOST_IP=${XX#tcp\:\/\/}
fi
echo set DOCKER_HOST_IP $DOCKER_HOST_IP
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DOCKER_COMPOSE="docker-compose -p event-sourcing-examples"
if [ "$1" = "-f" ] ; then
shift;
DOCKER_COMPOSE="$DOCKER_COMPOSE -f ${1?}"
shift
fi
if [ "$1" = "--use-existing" ] ; then
shift;
else
${DOCKER_COMPOSE?} stop
${DOCKER_COMPOSE?} rm -v --force
fi
NO_RM=false
if [ "$1" = "--no-rm" ] ; then
NO_RM=true
shift
fi
${DOCKER_COMPOSE?} up -d mongodb $EXTRA_INFRASTRUCTURE_SERVICES
if [ -z "$SPRING_DATA_MONGODB_URI" ] ; then
export SPRING_DATA_MONGODB_URI=mongodb://${DOCKER_HOST_IP?}/mydb
echo Set SPRING_DATA_MONGODB_URI $SPRING_DATA_MONGODB_URI
fi
export SERVICE_HOST=$DOCKER_HOST_IP
./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS $* build -x :e2e-test:test
if [ -z "$EVENTUATE_LOCAL" ] && [ -z "$EVENTUATE_API_KEY_ID" -o -z "$EVENTUATE_API_KEY_SECRET" ] ; then
echo You must set EVENTUATE_API_KEY_ID and EVENTUATE_API_KEY_SECRET
exit -1
fi
${DOCKER_COMPOSE?} build
${DOCKER_COMPOSE?} up -d
$DIR/wait-for-services.sh $DOCKER_HOST_IP 8080 8081 8082 8083 8084
set -e
./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS -a $* :e2e-test:cleanTest :e2e-test:test -P ignoreE2EFailures=false
if [ $NO_RM = false ] ; then
${DOCKER_COMPOSE?} stop
${DOCKER_COMPOSE?} rm -v --force
fi