-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpre-commit.sh
More file actions
executable file
·37 lines (31 loc) · 911 Bytes
/
pre-commit.sh
File metadata and controls
executable file
·37 lines (31 loc) · 911 Bytes
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
#!/bin/sh
NC='\033[0m'
GREEN='\033[0;32m'
RED='\033[0;31m'
echo "${GREEN}----==== Updating flow schema ====----${NC}"
docker-compose run --rm ui ./bin/yarn expand-schema
echo "${GREEN}----==== Schema updated, don't forget to commit it ====----${NC}"
echo "${GREEN}----==== Running RSpec ====----${NC}"
docker-compose run --rm ui rspec
RSPEC=$?
if [ $RSPEC -eq 0 ]; then
echo "${GREEN}OK${NC}";
fi
echo "${GREEN}----==== Running Flow tests ====----${NC}"
docker-compose run --rm webpack yarn flow check
FLOW=$?
if [ $FLOW -eq 0 ]; then
echo "${GREEN}OK${NC}";
fi
if [ $RSPEC -eq 0 ] && [ $FLOW -eq 0 ]; then
echo "${GREEN}----==== Good to go! ====----${NC}"
else
echo "${RED}----==== Oops! ====----${NC}"
if [ $RSPEC -ne 0 ]; then
echo "${RED}Rspec tests failed${NC}";
fi
if [ $FLOW -ne 0 ]; then
echo "${RED}Flow tests failed${NC}";
fi
echo "${RED}----==== Oops! ====----${NC}"
fi