|
| 1 | +.PHONY: clean code-style coverage help test static-analysis install-dependencies install-dependencies-lowest update-dependencies pcov-enable pcov-disable infection-testing |
| 2 | +.DEFAULT_GOAL := test |
| 3 | + |
| 4 | +PHPUNIT = ./vendor/bin/phpunit -c ./phpunit.xml |
| 5 | +PHPSTAN = ./vendor/bin/phpstan |
| 6 | +PHPCS = ./vendor/bin/phpcs --extensions=php |
| 7 | +CONSOLE = ./bin/console |
| 8 | +INFECTION = ./vendor/bin/infection |
| 9 | + |
| 10 | +clean: |
| 11 | + rm -rf ./build ./vendor |
| 12 | + |
| 13 | +code-style: pcov-disable |
| 14 | + mkdir -p build/logs/phpcs |
| 15 | + ${PHPCS} --report-full --report-gitblame --standard=PSR12 ./src --exclude=Generic.Commenting.Todo --report-junit=build/logs/phpcs/junit.xml |
| 16 | + |
| 17 | +coverage: pcov-enable |
| 18 | + ${PHPUNIT} && ./vendor/bin/coverage-check clover.xml 100 |
| 19 | + |
| 20 | +test: pcov-disable |
| 21 | + ${PHPUNIT} |
| 22 | + |
| 23 | +static-analysis: pcov-disable |
| 24 | + mkdir -p build/logs/phpstan |
| 25 | + ${PHPSTAN} analyse --no-progress --memory-limit=64 |
| 26 | + |
| 27 | +update-dependencies: |
| 28 | + composer update |
| 29 | + |
| 30 | +install-dependencies: |
| 31 | + composer install |
| 32 | + |
| 33 | +install-dependencies-lowest: |
| 34 | + composer install --prefer-lowest |
| 35 | + |
| 36 | +infection-testing: |
| 37 | + make coverage |
| 38 | + cp -f build/logs/phpunit/junit.xml build/logs/phpunit/coverage/junit.xml |
| 39 | + sudo php-ext-disable pcov |
| 40 | + ${INFECTION} --coverage=build/logs/phpunit/coverage --min-msi=93 --threads=`nproc` |
| 41 | + sudo php-ext-enable pcov |
| 42 | + |
| 43 | +pcov-enable: |
| 44 | + sudo php-ext-enable pcov |
| 45 | + |
| 46 | +pcov-disable: |
| 47 | + sudo php-ext-disable pcov |
| 48 | + |
| 49 | +help: |
| 50 | + # Usage: |
| 51 | + # make <target> [OPTION=value] |
| 52 | + # |
| 53 | + # Targets: |
| 54 | + # clean Cleans the coverage and the vendor directory |
| 55 | + # code-style Check codestyle using phpcs |
| 56 | + # coverage Generate code coverage (html, clover) |
| 57 | + # help You're looking at it! |
| 58 | + # test (default) Run all the tests with phpunit |
| 59 | + # static-analysis Run static analysis using phpstan |
| 60 | + # infection-testing Run infection/mutation testing |
| 61 | + # install-dependencies Run composer install |
| 62 | + # install-dependencies-lowest Run composer install with --prefer-lowest |
| 63 | + # update-dependencies Run composer update |
| 64 | + # pcov-enable Enable pcov |
| 65 | + # pcov-disable Disable pcov |
0 commit comments