Makefile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. test: phpunit phpcs
  2. .PHONY: test phpunit phpcs
  3. pretest:
  4. if [ ! -d vendor ] || [ ! -f composer.lock ]; then composer install; else echo "Already have dependencies"; fi
  5. phpunit: pretest
  6. mkdir -p tests/output
  7. vendor/bin/phpunit --coverage-text --coverage-clover=tests/output/coverage.clover --coverage-html=tests/output/Results
  8. test-examples:
  9. ./validate_examples.sh
  10. phpunit-ci: pretest
  11. vendor/bin/phpunit --coverage-text --coverage-clover=tests/output/coverage.clover
  12. phpunit-full-ci: pretest
  13. vendor/bin/phpunit -c phpunit.full.xml --coverage-text --coverage-clover=tests/output/coverage.clover
  14. ifndef STRICT
  15. STRICT = 0
  16. endif
  17. ifeq "$(STRICT)" "1"
  18. phpcs: pretest
  19. vendor/bin/phpcs --standard=PSR2 src tests/unit/
  20. else
  21. phpcs: pretest
  22. vendor/bin/phpcs --standard=PSR2 -n src tests/unit/
  23. endif
  24. phpcbf: pretest
  25. vendor/bin/phpcbf --standard=PSR2 -n src tests/unit/
  26. ocular:
  27. wget https://scrutinizer-ci.com/ocular.phar
  28. ifdef OCULAR_TOKEN
  29. scrutinizer: ocular
  30. @php ocular.phar code-coverage:upload --format=php-clover tests/output/coverage.clover --access-token=$(OCULAR_TOKEN);
  31. else
  32. scrutinizer: ocular
  33. php ocular.phar code-coverage:upload --format=php-clover tests/output/coverage.clover;
  34. endif
  35. clean: clean-env clean-deps
  36. clean-env:
  37. rm -rf coverage.clover
  38. rm -rf ocular.phar
  39. rm -rf tests/output/
  40. clean-deps:
  41. rm -rf vendor/