-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestAndLint.sh
More file actions
65 lines (60 loc) · 1.92 KB
/
TestAndLint.sh
File metadata and controls
65 lines (60 loc) · 1.92 KB
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
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/bash
# Script to Test and Lint
# requirement:
# - https://github.com/phpenv/phpenv installed
# - PHP versions defined in ../PHP_VERSIONS installed
CMD=phpenv
$CMD -v &> /dev/null
if [ $? -ne 0 ]; then
echo "command [${CMD}] not found!"
exit 1
fi
echo "-----------------------------------------------------------"
echo "[composer validate]"
composer validate
if [ $? -ne 0 ]; then
echo "Operation aborted."
exit 1
fi
test_and_lint() {
echo "-----------------------------------------------------------"
echo "[PHP $1][php -v]"
php -v
echo "-----------------------------------------------------------"
echo "[PHP $1][parallel-lint]"
./vendor/bin/parallel-lint src tests examples
echo "-----------------------------------------------------------"
echo "[PHP $1][neon-lint]"
./vendor/nette/neon/bin/neon-lint conf
echo "-----------------------------------------------------------"
echo "[PHP $1][phpcs]"
./vendor/bin/phpcs --ignore=vendor \
--standard=phpcs.xml \
-p \
-s \
.
echo "-----------------------------------------------------------"
echo "[PHP $1][phpstan]"
./vendor/bin/phpstan analyze -c phpstan.neon
echo "-----------------------------------------------------------"
echo "[PHP $1][phpunit]"
./vendor/bin/phpunit ./tests/
echo "-----------------------------------------------------------"
}
echo "[[TesAndLint.sh]]"
SUPPORTED_PHP_VERSIONS=PHP_VERSIONS
if [ ! -f $SUPPORTED_PHP_VERSIONS ]; then
echo "file [$SUPPORTED_PHP_VERSIONS] not found."
echo "operation aborted."
exit 1
fi
if [ ! -r $SUPPORTED_PHP_VERSIONS ]; then
echo "cannot read file[$SUPPORTED_PHP_VERSIONS]."
echo "operation aborted."
exit 1
fi
STR_CMD=''
while read version ; do
STR_CMD="$STR_CMD test_and_lint $version;"
done < $SUPPORTED_PHP_VERSIONS
eval $STR_CMD