generated from archtechx/template
-
Notifications
You must be signed in to change notification settings - Fork 31
/
check
executable file
·54 lines (47 loc) · 1.23 KB
/
check
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
#!/bin/bash
set -e
offer_run() {
read -p "For more output, run $1. Run it now (Y/n)? " run
case ${run:0:1} in
n|N )
exit 1
;;
* )
$1
;;
esac
exit 1
}
if (php-cs-fixer fix --dry-run --config=.php-cs-fixer.php > /dev/null 2>/dev/null); then
echo '✅ php-cs-fixer OK'
else
read -p "⚠️ php-cs-fixer found issues. Fix (Y/n)? " fix
case ${fix:0:1} in
n|N )
echo '❌ php-cs-fixer FAIL'
offer_run 'php-cs-fixer fix --config=.php-cs-fixer.php'
;;
* )
if (php-cs-fixer fix --config=.php-cs-fixer.php > /dev/null 2>/dev/null); then
echo '✅ php-cs-fixer OK'
else
echo '❌ php-cs-fixer FAIL'
offer_run 'php-cs-fixer fix --config=.php-cs-fixer.php'
fi
;;
esac
fi
if (./vendor/bin/phpstan analyse > /dev/null 2>/dev/null); then
echo '✅ PHPStan OK'
else
echo '❌ PHPStan FAIL'
offer_run './vendor/bin/phpstan analyse'
fi
if (./vendor/bin/pest > /dev/null 2>/dev/null); then
echo '✅ PEST OK'
else
echo '❌ PEST FAIL'
offer_run './vendor/bin/pest'
fi
echo '=================='
echo '✅ Everything OK'