Makefile 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. project := opentracing
  2. pytest := PYTHONDONTWRITEBYTECODE=1 py.test --tb short -rxs \
  3. --cov-config .coveragerc --cov $(project) tests
  4. html_report := --cov-report=html
  5. test_args := --cov-report xml --cov-report term-missing
  6. .PHONY: clean-pyc clean-build docs clean testbed
  7. .DEFAULT_GOAL : help
  8. help:
  9. @echo "bootstrap - initialize local environement for development. Requires virtualenv."
  10. @echo "clean - remove all build, test, coverage and Python artifacts"
  11. @echo "clean-build - remove build artifacts"
  12. @echo "clean-pyc - remove Python file artifacts"
  13. @echo "clean-test - remove test and coverage artifacts"
  14. @echo "lint - check style with flake8"
  15. @echo "test - run tests quickly with the default Python"
  16. @echo "testbed - run testbed scenarios with the default Python"
  17. @echo "coverage - check code coverage quickly with the default Python"
  18. @echo "docs - generate Sphinx HTML documentation, including API docs"
  19. @echo "release - package and upload a release"
  20. @echo "dist - package"
  21. @echo "install - install the package to the active Python's site-packages"
  22. check-virtual-env:
  23. @echo virtual-env: $${VIRTUAL_ENV?"Please run in virtual-env"}
  24. bootstrap: check-virtual-env
  25. pip install -r requirements.txt
  26. pip install -r requirements-test.txt
  27. python setup.py develop
  28. clean: clean-build clean-pyc clean-test
  29. clean-build:
  30. rm -fr build/
  31. rm -fr dist/
  32. rm -fr .eggs/
  33. find . -name '*.egg-info' -exec rm -fr {} +
  34. find . -name '*.egg' -exec rm -rf {} +
  35. clean-pyc:
  36. find . -name '*.pyc' -exec rm -f {} +
  37. find . -name '*.pyo' -exec rm -f {} +
  38. find . -name '*~' -exec rm -f {} +
  39. find . -name '__pycache__' -exec rm -fr {} +
  40. clean-test:
  41. rm -f .coverage
  42. rm -f coverage.xml
  43. rm -fr htmlcov/
  44. lint:
  45. flake8 $(project) tests
  46. test:
  47. $(pytest) $(test_args)
  48. testbed:
  49. PYTHONDONTWRITEBYTECODE=1 python -m testbed
  50. jenkins:
  51. pip install -r requirements.txt
  52. pip install -r requirements-test.txt
  53. python setup.py develop
  54. CLAY_CONFIG=config/test.yaml $(pytest) $(test_args) --junit-xml=jenkins.xml
  55. coverage:
  56. coverage run --source $(project) setup.py test
  57. coverage report -m
  58. coverage html
  59. open htmlcov/index.html
  60. docs:
  61. pip show -q opentracing || python setup.py develop
  62. $(MAKE) -C docs clean
  63. $(MAKE) -C docs html
  64. release: clean
  65. @echo Please see README
  66. # python setup.py sdist upload
  67. # python setup.py bdist_wheel upload
  68. dist: clean
  69. @echo Please see README
  70. # python setup.py sdist
  71. # python setup.py bdist_wheel
  72. # ls -l dist
  73. install:
  74. pip install -r requirements.txt
  75. pip install -r requirements-test.txt
  76. echo skipping pip install -r requirements-doc.txt
  77. python setup.py install