forked from mirego/absinthe_error_payload
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ci-check.sh
executable file
·46 lines (35 loc) · 965 Bytes
/
ci-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
#!/usr/bin/env sh
error_status=0
RED='\033[0;31m'
RED_BOLD='\033[1;31m'
GREEN='\033[0;32m'
GREEN_BOLD='\033[1;32m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
header() {
echo "\n\n${YELLOW}▶ $1${NO_COLOR}"
}
run() {
eval "${@}"
last_exit_status=${?}
if [ ${last_exit_status} -ne 0 ]; then
echo "\n${RED}↳ Something went wrong. Program exited with ${last_exit_status} ✘${NO_COLOR}"
error_status=${last_exit_status}
else
echo "${GREEN}↳ Passed ✔${NO_COLOR}"
fi
}
header "App tests…"
run mix test
header "Compilation without warnings…"
run make lint-compile
header "App code auto-formatting…"
run make lint-format
header "App code lint…"
run make lint-credo
if [ ${error_status} -ne 0 ]; then
echo "\n\n${YELLOW}▶▶ One of the checks ${RED_BOLD}failed${YELLOW}. Please fix it before committing.${NO_COLOR}"
else
echo "\n\n${YELLOW}▶▶ All checks ${GREEN_BOLD}passed${YELLOW}!${NO_COLOR}"
fi
exit $error_status