-
Notifications
You must be signed in to change notification settings - Fork 10
/
check.sh
executable file
·55 lines (42 loc) · 998 Bytes
/
check.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
#!/bin/bash
echo "
trying to download all go dependencies...
"
if ! go get -v ./...; then
echo "[FAIL] Failed to get dependencies."
exit 1
fi
go get github.com/rubenv/sql-migrate/...
go get github.com/stretchr/testify/assert
echo "
upgrading test database objects to latest version...
"
psql -c 'drop database if exists tracker_test;'
psql -c 'create database tracker_test;'
if [ ! -f migrations/dbconfig.yml ]; then
cp migrations/dbconfig.yml.sample migrations/dbconfig.yml
fi
if [ ! -f test/config.json ]; then
cp test/config.json.sample test/config.json
fi
if [ ! -f server/config.json ]; then
cp server/config.json.sample server/config.json
fi
echo "
testing all the packages...
"
cd test
#cannot run all tests at once, so we loop instead on each directory looking for test files
for dir in ./*
do
dir=${dir%*/}
if [ -d "$dir" ]; then
cd "$dir"
if ! go test -v; then
echo "[FAIL] One or more unit tests failed."
exit 1
fi
cd ..
fi
done
cd ..