-
Notifications
You must be signed in to change notification settings - Fork 1
/
local.sh
42 lines (35 loc) · 853 Bytes
/
local.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
#!/bin/bash
function prepare() {
# Delete old container
docker-compose kill && echo y | docker-compose rm
# Build images
docker-compose build
# Prepare DB
docker-compose up -d db
attempt=0
while [ ${attempt} -le 10 ]; do
attempt=$(($attempt + 1))
db_output=$(docker-compose logs db)
if grep -q 'autovacuum launcher started' <<< ${db_output} ; then
echo "Postgres is up."
break
else
echo "Waiting for database (attempt: $attempt)"
sleep 2
fi
done
}
function test() {
# Delete old report
rm -f coverage.xml xunit.xml
# Run unit test
prepare
docker-compose up test
docker cp test:/opt/coverage.xml .
docker cp test:/opt/xunit.xml .
}
function run() {
prepare
docker-compose up -d api
}
$@