Makefile 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. help:
  2. @echo "Please use \`make <target>' where <target> is one of"
  3. @echo " start-server to start the test server"
  4. @echo " stop-server to stop the test server"
  5. @echo " test to perform unit tests. Provide TEST to perform a specific test."
  6. @echo " coverage to perform unit tests with code coverage. Provide TEST to perform a specific test."
  7. @echo " coverage-show to show the code coverage report"
  8. @echo " clean to remove build artifacts"
  9. @echo " docs to build the Sphinx docs"
  10. @echo " docs-show to view the Sphinx docs"
  11. @echo " static to run phpstan and php-cs-fixer on the codebase"
  12. @echo " static-phpstan to run phpstan on the codebase"
  13. @echo " static-phpstan-update-baseline to regenerate the phpstan baseline file"
  14. @echo " static-codestyle-fix to run php-cs-fixer on the codebase, writing the changes"
  15. @echo " static-codestyle-check to run php-cs-fixer on the codebase"
  16. start-server: stop-server
  17. node tests/server.js &> /dev/null &
  18. ./vendor/bin/http_test_server &> /dev/null &
  19. stop-server:
  20. @PID=$(shell ps axo pid,command \
  21. | grep 'tests/server.js' \
  22. | grep -v grep \
  23. | cut -f 1 -d " "\
  24. ) && [ -n "$$PID" ] && kill $$PID || true
  25. @PID=$(shell ps axo pid,command \
  26. | grep 'vendor/bin/http_test_server' \
  27. | grep -v grep \
  28. | cut -f 1 -d " "\
  29. ) && [ -n "$$PID" ] && kill $$PID || true
  30. test: start-server
  31. vendor/bin/phpunit
  32. $(MAKE) stop-server
  33. coverage: start-server
  34. vendor/bin/phpunit --coverage-html=build/artifacts/coverage
  35. $(MAKE) stop-server
  36. coverage-show: view-coverage
  37. view-coverage:
  38. open build/artifacts/coverage/index.html
  39. clean:
  40. rm -rf artifacts/*
  41. docs:
  42. cd docs && make html && cd ..
  43. docs-show:
  44. open docs/_build/html/index.html
  45. static: static-phpstan static-psalm static-codestyle-check
  46. static-psalm:
  47. composer install
  48. composer bin psalm update
  49. vendor/bin/psalm.phar $(PSALM_PARAMS)
  50. static-psalm-update-baseline:
  51. composer install
  52. composer bin psalm update
  53. $(MAKE) static-psalm PSALM_PARAMS="--set-baseline=psalm-baseline.xml"
  54. static-phpstan:
  55. composer install
  56. composer bin phpstan update
  57. vendor/bin/phpstan analyze $(PHPSTAN_PARAMS)
  58. static-phpstan-update-baseline:
  59. composer install
  60. composer bin phpstan update
  61. $(MAKE) static-phpstan PHPSTAN_PARAMS="--generate-baseline"
  62. static-codestyle-fix:
  63. composer install
  64. composer bin php-cs-fixer update
  65. vendor/bin/php-cs-fixer fix --diff $(CS_PARAMS)
  66. static-codestyle-check:
  67. $(MAKE) static-codestyle-fix CS_PARAMS="--dry-run"
  68. .PHONY: docs coverage-show view-coverage