Makefile 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. NPM_ROOT = ./node_modules
  2. STATIC_DIR = src/sentry/static/sentry
  3. install-python:
  4. @echo "--> Installing Python dependencies"
  5. pip install "setuptools>=0.9.8"
  6. # order matters here, base package must install first
  7. pip install -e .
  8. pip install ujson
  9. pip install "file://`pwd`#egg=sentry[dev]"
  10. install-yarn:
  11. @echo "--> Installing Node dependencies"
  12. @hash yarn 2> /dev/null || npm install -g yarn
  13. # Use NODE_ENV=development so that yarn installs both dependencies + devDependencies
  14. NODE_ENV=development yarn install --ignore-optional --pure-lockfile
  15. # Fix phantomjs-prebuilt not installed via yarn
  16. # See: https://github.com/karma-runner/karma-phantomjs-launcher/issues/120#issuecomment-262634703
  17. node ./node_modules/phantomjs-prebuilt/install.js
  18. install-python-tests:
  19. pip install "file://`pwd`#egg=sentry[dev,tests,dsym]"
  20. develop-only: update-submodules install-python install-python-tests install-yarn
  21. develop: develop-only setup-git
  22. @echo ""
  23. dev-postgres: install-python
  24. dev-docs:
  25. pip install -r doc-requirements.txt
  26. reset-db:
  27. @echo "--> Dropping existing 'sentry' database"
  28. dropdb sentry || true
  29. @echo "--> Creating 'sentry' database"
  30. createdb -E utf-8 sentry
  31. @echo "--> Applying migrations"
  32. sentry upgrade
  33. setup-git:
  34. @echo "--> Installing git hooks"
  35. git config branch.autosetuprebase always
  36. cd .git/hooks && ln -sf ../../config/hooks/* ./
  37. @echo ""
  38. build: locale
  39. clean:
  40. @echo "--> Cleaning static cache"
  41. rm -rf dist/* static/dist/*
  42. @echo "--> Cleaning integration docs cache"
  43. rm -rf src/sentry/integration-docs
  44. @echo "--> Cleaning pyc files"
  45. find . -name "*.pyc" -delete
  46. @echo "--> Cleaning python build artifacts"
  47. rm -rf build/ dist/ src/sentry/assets.json
  48. @echo ""
  49. build-js-po:
  50. mkdir -p build
  51. SENTRY_EXTRACT_TRANSLATIONS=1 ./node_modules/.bin/webpack
  52. locale: build-js-po
  53. cd src/sentry && sentry django makemessages -i static -l en
  54. ./bin/merge-catalogs en
  55. ./bin/find-good-catalogs src/sentry/locale/catalogs.json
  56. cd src/sentry && sentry django compilemessages
  57. update-transifex: build-js-po
  58. pip install transifex-client
  59. cd src/sentry && sentry django makemessages -i static -l en
  60. ./bin/merge-catalogs en
  61. tx push -s
  62. tx pull -a
  63. ./bin/find-good-catalogs src/sentry/locale/catalogs.json
  64. cd src/sentry && sentry django compilemessages
  65. update-submodules:
  66. @echo "--> Updating git submodules"
  67. git submodule init
  68. git submodule update
  69. @echo ""
  70. test: develop lint test-js test-python test-cli
  71. testloop: develop
  72. pip install pytest-xdist
  73. py.test tests -f
  74. test-cli:
  75. @echo "--> Testing CLI"
  76. rm -rf test_cli
  77. mkdir test_cli
  78. cd test_cli && sentry init test_conf > /dev/null
  79. cd test_cli && sentry --config=test_conf upgrade --traceback --noinput > /dev/null
  80. cd test_cli && sentry --config=test_conf help 2>&1 | grep start > /dev/null
  81. rm -r test_cli
  82. @echo ""
  83. test-js:
  84. @echo "--> Building static assets"
  85. @${NPM_ROOT}/.bin/webpack
  86. @echo "--> Running JavaScript tests"
  87. @npm run test
  88. @echo ""
  89. test-python:
  90. @echo "--> Running Python tests"
  91. py.test tests/integration tests/sentry || exit 1
  92. @echo ""
  93. test-acceptance:
  94. @echo "--> Building static assets"
  95. @${NPM_ROOT}/.bin/webpack
  96. @echo "--> Running acceptance tests"
  97. py.test tests/acceptance
  98. @echo ""
  99. test-python-coverage:
  100. @echo "--> Running Python tests"
  101. SOUTH_TESTS_MIGRATE=1 coverage run --source=src/sentry -m py.test tests/integration tests/sentry
  102. @echo ""
  103. lint: lint-python lint-js
  104. lint-python:
  105. @echo "--> Linting python"
  106. bin/lint --python
  107. @echo ""
  108. lint-js:
  109. @echo "--> Linting javascript"
  110. bin/lint --js
  111. @echo ""
  112. coverage: develop
  113. make test-python-coverage
  114. coverage html
  115. publish:
  116. python setup.py sdist bdist_wheel upload
  117. extract-api-docs:
  118. rm -rf api-docs/cache/*
  119. cd api-docs; python generator.py
  120. .PHONY: develop dev-postgres dev-docs setup-git build clean locale update-transifex update-submodules test testloop test-cli test-js test-python test-acceptance test-python-coverage lint lint-python lint-js coverage publish
  121. ############################
  122. # Halt, Travis stuff below #
  123. ############################
  124. # Bases for all builds
  125. travis-upgrade-pip:
  126. python -m pip install pip==8.1.1
  127. travis-setup-cassandra:
  128. echo "create keyspace sentry with replication = {'class' : 'SimpleStrategy', 'replication_factor': 1};" | cqlsh --cqlversion=3.1.7
  129. echo 'create table nodestore (key text primary key, value blob, flags int);' | cqlsh -k sentry --cqlversion=3.1.7
  130. travis-install-python: travis-upgrade-pip install-python install-python-tests
  131. python -m pip install codecov
  132. travis-noop:
  133. @echo "nothing to do here."
  134. .PHONY: travis-upgrade-pip travis-setup-cassandra travis-install-python travis-noop
  135. travis-install-danger:
  136. bundle install
  137. travis-install-sqlite: travis-install-python
  138. travis-install-postgres: travis-install-python dev-postgres
  139. psql -c 'create database sentry;' -U postgres
  140. travis-install-mysql: travis-install-python
  141. pip install mysqlclient
  142. echo 'create database sentry;' | mysql -uroot
  143. travis-install-acceptance: install-yarn travis-install-postgres
  144. travis-install-js: travis-upgrade-pip install-python install-python-tests install-yarn
  145. travis-install-cli: travis-install-postgres
  146. travis-install-dist: travis-upgrade-pip install-python install-python-tests install-yarn
  147. travis-install-django-18: travis-install-postgres
  148. pip install "Django>=1.8,<1.9"
  149. .PHONY: travis-install-danger travis-install-sqlite travis-install-postgres travis-install-js travis-install-cli travis-install-dist
  150. # Lint steps
  151. travis-lint-danger: travis-noop
  152. travis-lint-sqlite: lint-python
  153. travis-lint-postgres: lint-python
  154. travis-lint-mysql: lint-python
  155. travis-lint-acceptance: travis-noop
  156. travis-lint-js: lint-js
  157. travis-lint-cli: travis-noop
  158. travis-lint-dist: travis-noop
  159. travis-lint-django-18: travis-lint-postgres
  160. .PHONY: travis-lint-danger travis-lint-sqlite travis-lint-postgres travis-lint-mysql travis-lint-js travis-lint-cli travis-lint-dist
  161. # Test steps
  162. travis-test-danger:
  163. bundle exec danger
  164. travis-test-sqlite: test-python-coverage
  165. travis-test-postgres: test-python-coverage
  166. travis-test-mysql: test-python-coverage
  167. travis-test-acceptance: test-acceptance
  168. travis-test-js: test-js
  169. travis-test-cli: test-cli
  170. travis-test-dist:
  171. SENTRY_BUILD=$(TRAVIS_COMMIT) SENTRY_LIGHT_BUILD=0 python setup.py sdist bdist_wheel
  172. @ls -lh dist/
  173. travis-test-django-18: travis-test-postgres
  174. .PHONY: travis-test-danger travis-test-sqlite travis-test-postgres travis-test-mysql travis-test-js travis-test-cli travis-test-dist