-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
51 lines (44 loc) · 3.31 KB
/
makefile
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
PHP ?=
TEST ?=
FILTER ?= .
docs:
docker run --rm -v $$(pwd)/docs:/data/docs -w /data php:cli bash -c "\
apt-get update && apt-get install -y wget git zip unzip;\
docker-php-ext-install zip;\
wget -q -O - https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer;\
wget -q https://phpdoc.org/phpDocumentor.phar;\
TEMPLATE=\$$(grep -o "{{#TAGS}}.*{{/TAGS}}" docs/index.html);\
HTML='';\
git clone https://github.com/matthiasmullie/types.git code && cd code;\
while read TAG; do\
git clean -fx;\
git checkout \$$TAG;\
git reset --hard;\
composer install --ignore-platform-reqs;\
php ../phpDocumentor.phar --directory=src --target=../docs/\$$TAG --visibility=public --defaultpackagename=Types --title='Types';\
HTML=\$$HTML\$$(echo \$$TEMPLATE | sed -e \"s/{{[#/]TAGS}}//g\" | sed -e \"s/{{\.}}/\$$TAG/g\");\
done <<< \$$(git rev-parse --abbrev-ref HEAD && git tag --sort=-v:refname | cat);\
sed -i \"s|\$$TEMPLATE|\$$HTML|g\" ../docs/index.html"
test:
VERSION=$$(echo "$(PHP)-cli" | sed "s/^-//");\
test $$(docker images -q matthiasmullie/types:$$VERSION) || docker build -t matthiasmullie/types:$$VERSION . --build-arg VERSION=$$VERSION;\
docker run -v $$(pwd)/src:/var/www/src -v $$(pwd)/tests:/var/www/tests -v $$(pwd)/phpunit.xml:/var/www/phpunit.xml matthiasmullie/types:$$VERSION env XDEBUG_MODE=off vendor/bin/phpunit $(TEST) --filter $(FILTER)
coverage:
VERSION=$$(echo "$(PHP)-cli" | sed "s/^-//");\
test $$(docker images -q matthiasmullie/types:$$VERSION) || docker build -t matthiasmullie/types:$$VERSION . --build-arg VERSION=$$VERSION;\
docker run -v $$(pwd)/src:/var/www/src -v $$(pwd)/tests:/var/www/tests -v $$(pwd)/build:/var/www/build -v $$(pwd)/phpunit.xml:/var/www/phpunit.xml matthiasmullie/types:$$VERSION env XDEBUG_MODE=off php -d pcov.enabled=1 -d pcov.directory="src" vendor/bin/phpunit $(TEST) --filter $(FILTER) --coverage-clover build/coverage-$(PHP).clover
profile:
VERSION=$$(echo "$(PHP)-cli" | sed "s/^-//");\
test $$(docker images -q matthiasmullie/types:$$VERSION) || docker build -t matthiasmullie/types:$$VERSION . --build-arg VERSION=$$VERSION;\
docker run -v $$(pwd)/src:/var/www/src -v $$(pwd)/tests:/var/www/tests -v $$(pwd)/build:/var/www/build -v $$(pwd)/phpunit.xml:/var/www/phpunit.xml matthiasmullie/types:$$VERSION env XDEBUG_MODE=off php -d xdebug.mode=profile -d xdebug.profiler_output_name=cachegrind.out -d xdebug.output_dir=build vendor/bin/phpunit $(TEST) --filter $(FILTER)
format:
VERSION=$$(echo "$(PHP)-cli" | sed "s/^-//");\
test $$(docker images -q matthiasmullie/types:$$VERSION) || docker build -t matthiasmullie/types:$$VERSION . --build-arg VERSION=$$VERSION;\
docker run -v $$(pwd)/src:/var/www/src -v $$(pwd)/tests:/var/www/tests -v $$(pwd)/.php-cs-fixer.php:/var/www/.php-cs-fixer.php matthiasmullie/types:$$VERSION vendor/bin/php-cs-fixer fix
composer_update:
VERSION=$$(echo "$(PHP)-cli" | sed "s/^-//");\
docker image rm -f matthiasmullie/types:$$VERSION;\
echo '{}' > composer.lock;\
docker build -t matthiasmullie/types:$$VERSION . --build-arg VERSION=$$VERSION;\
docker run -v $$(pwd)/src:/var/www/src -v $$(pwd)/tests:/var/www/tests -v $$(pwd)/composer.json:/var/www/composer.json -v $$(pwd)/composer.lock:/var/www/composer.lock -v $$(pwd)/vendor:/var/www/vendor matthiasmullie/types:$$VERSION composer update
.PHONY: docs