forked from microservices-patterns/ftgo-application
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-and-test-all.sh
executable file
·104 lines (65 loc) · 1.73 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
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
#! /bin/bash -e
KEEP_RUNNING=
ASSEMBLE_ONLY=
USE_EXISTING_CONTAINERS=
DATABASE_SERVICES="dynamodblocal mysql dynamodblocal-init"
if [ -z "$DOCKER_COMPOSE" ] ; then
DOCKER_COMPOSE=docker-compose
fi
while [ ! -z "$*" ] ; do
case $1 in
"--keep-running" )
KEEP_RUNNING=yes
;;
"--assemble-only" )
ASSEMBLE_ONLY=yes
;;
"--use-existing-containers" )
USE_EXISTING_CONTAINERS=yes
;;
"--help" )
echo ./build-and-test-all.sh --keep-running --assemble-only --use-existing-containers
exit 0
;;
esac
shift
done
echo KEEP_RUNNING=$KEEP_RUNNING
. ./set-env.sh
# TODO Temporarily
./gradlew buildContracts
./gradlew compileAll
if [ -z "$USE_EXISTING_CONTAINERS" ] ; then
${DOCKER_COMPOSE?} down --remove-orphans -v
fi
${DOCKER_COMPOSE?} up -d --build ${DATABASE_SERVICES?}
./gradlew waitForMySql
echo mysql is started
# Test ./mysql-cli.sh
echo 'show databases;' | ./mysql-cli.sh -i
${DOCKER_COMPOSE?} up -d --build cdc-service
if [ -z "$ASSEMBLE_ONLY" ] ; then
./gradlew -x :ftgo-end-to-end-tests:test $* build
${DOCKER_COMPOSE?} build
./gradlew $* integrationTest
./gradlew cleanComponentTest componentTest
# Reset the DB/messages
${DOCKER_COMPOSE?} down --remove-orphans -v
${DOCKER_COMPOSE?} up -d ${DATABASE_SERVICES?}
./gradlew waitForMySql
echo mysql is started
${DOCKER_COMPOSE?} up -d
else
./gradlew $* assemble
${DOCKER_COMPOSE?} up -d --build ${DATABASE_SERVICES?}
./gradlew waitForMySql
echo mysql is started
${DOCKER_COMPOSE?} up -d --build
fi
./wait-for-services.sh
./run-end-to-end-tests.sh
# NEED TO FIX
# ./run-graphql-api-gateway-tests.sh
if [ -z "$KEEP_RUNNING" ] ; then
${DOCKER_COMPOSE?} down --remove-orphans -v
fi