-
Notifications
You must be signed in to change notification settings - Fork 4
/
pre-commit.sh
executable file
·44 lines (37 loc) · 996 Bytes
/
pre-commit.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
#!/bin/sh
NC='\033[0m'
GREEN='\033[0;32m'
RED='\033[0;31m'
echo "----==== Running Mix tests ====----"
docker-compose run --rm -e MIX_ENV=test app mix do compile --force --warnings-as-errors, test
MIX=$?
if [ $MIX -eq 0 ]; then
echo "${GREEN}OK${NC}";
fi
echo "----==== Running Flow tests ====----"
docker-compose run --rm webpack yarn flow
FLOW=$?
if [ $FLOW -eq 0 ]; then
echo "${GREEN}OK${NC}";
fi
echo "----==== Running Eslint tests ====----"
docker-compose run --rm webpack yarn lint
ESLINT=$?
if [ $ESLINT -eq 0 ]; then
echo "${GREEN}OK${NC}";
fi
if [ $MIX -eq 0 ] && [ $FLOW -eq 0 ] && [ $ESLINT -eq 0 ]; then
echo "${GREEN}----==== Good to go! ====----${NC}"
else
echo "${RED}----==== Oops! ====----${NC}"
if [ $MIX -ne 0 ]; then
echo "${RED}Mix tests failed${NC}";
fi
if [ $FLOW -ne 0 ]; then
echo "${RED}Flow tests failed${NC}";
fi
if [ $ESLINT -ne 0 ]; then
echo "${RED}ESLint tests failed${NC}";
fi
echo "${RED}----==== Oops! ====----${NC}"
fi