-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
executable file
·78 lines (66 loc) · 1.45 KB
/
build.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
__DIR__="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# required libs
source "${__DIR__}/.bash/functions.shlib"
set -E
trap 'throw_exception' ERR
php_version="$(php --version | head -n1 | cut -d' ' -f2)"
consolelog 'composer install'
composer install \
--no-interaction \
--prefer-dist \
--no-suggest \
--quiet \
--verbose
consolelog 'install phpunit'
# switch phpunit version depending on php version
if [[ "${php_version}" == 7.* ]]; then
composer require \
--dev \
--update-with-dependencies \
--quiet \
--verbose \
phpunit/phpunit
elif [[ "${php_version}" == 5.6.* ]]; then
composer require \
--dev \
--update-with-dependencies \
--quiet \
--verbose \
phpunit/phpunit '5.7.*'
else
composer require \
--dev \
--update-with-dependencies \
--quiet \
--verbose \
phpunit/phpunit '4.8.*'
fi
composer dump-autoload \
--classmap-authoritative \
--quiet \
--verbose
if [[ ! -z "${RUN_COVERAGE}" ]]; then
consolelog 'run tests & coverage'
mkdir -p build/logs
vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml
vendor/bin/coveralls --quiet
else
consolelog 'run tests'
vendor/bin/phpunit
fi
consolelog 'composer optimise'
composer remove \
--dev \
--quiet \
--verbose \
phpunit/phpunit
composer install \
--no-dev \
--quiet \
--verbose
composer dump-autoload \
--no-dev \
--classmap-authoritative \
--quiet \
--verbose