Makefile 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. PIP := python -m pip --disable-pip-version-check
  2. WEBPACK := yarn build-acceptance
  3. bootstrap \
  4. develop \
  5. clean \
  6. init-config \
  7. run-dependent-services \
  8. drop-db \
  9. create-db \
  10. apply-migrations \
  11. reset-db \
  12. setup-git \
  13. node-version-check \
  14. install-js-dev \
  15. install-py-dev :
  16. @./scripts/do.sh $@
  17. build-platform-assets \
  18. direnv-help \
  19. upgrade-pip \
  20. prerequisites \
  21. setup-git-config :
  22. @SENTRY_NO_VENV_CHECK=1 ./scripts/do.sh $@
  23. setup-pyenv:
  24. @./scripts/pyenv_setup.sh
  25. build-js-po: node-version-check
  26. mkdir -p build
  27. rm -rf node_modules/.cache/babel-loader
  28. SENTRY_EXTRACT_TRANSLATIONS=1 $(WEBPACK)
  29. build-spectacular-docs:
  30. @echo "--> Building drf-spectacular openapi spec (combines with deprecated docs)"
  31. @OPENAPIGENERATE=1 sentry django spectacular --file tests/apidocs/openapi-spectacular.json --format openapi-json --validate --fail-on-warn
  32. build-deprecated-docs:
  33. @echo "--> Building deprecated openapi spec from json files"
  34. yarn build-deprecated-docs
  35. build-api-docs: build-deprecated-docs build-spectacular-docs
  36. @echo "--> Dereference the json schema for ease of use"
  37. yarn deref-api-docs
  38. watch-api-docs:
  39. @ts-node api-docs/watch.ts
  40. diff-api-docs:
  41. @echo "--> diffing local api docs against sentry-api-schema/openapi-derefed.json"
  42. yarn diff-docs
  43. build: locale
  44. merge-locale-catalogs: build-js-po
  45. $(PIP) install Babel
  46. cd src/sentry && sentry django makemessages -i static -l en
  47. ./bin/merge-catalogs en
  48. compile-locale:
  49. $(PIP) install Babel
  50. ./bin/find-good-catalogs src/sentry/locale/catalogs.json
  51. cd src/sentry && sentry django compilemessages
  52. install-transifex:
  53. $(PIP) install transifex-client
  54. push-transifex: merge-locale-catalogs install-transifex
  55. tx push -s
  56. pull-transifex: install-transifex
  57. tx pull -a
  58. # Update transifex with new strings that need to be translated
  59. update-transifex: push-transifex
  60. # Pulls new translations from transifex and compiles for usage
  61. update-local-locales: pull-transifex compile-locale
  62. build-chartcuterie-config:
  63. @echo "--> Building chartcuterie config module"
  64. yarn build-chartcuterie-config
  65. fetch-release-registry:
  66. @echo "--> Fetching release registry"
  67. @echo "from sentry.utils.distutils import sync_registry; sync_registry()" | sentry exec
  68. run-acceptance:
  69. @echo "--> Running acceptance tests"
  70. pytest tests/acceptance --cov . --cov-report="xml:.artifacts/acceptance.coverage.xml" --junit-xml=".artifacts/acceptance.junit.xml"
  71. @echo ""
  72. test-cli:
  73. @echo "--> Testing CLI"
  74. rm -rf test_cli
  75. mkdir test_cli
  76. cd test_cli && sentry init test_conf
  77. cd test_cli && sentry --config=test_conf help
  78. cd test_cli && sentry --config=test_conf upgrade --traceback --noinput
  79. cd test_cli && sentry --config=test_conf export
  80. rm -r test_cli
  81. @echo ""
  82. test-js-build: node-version-check
  83. @echo "--> Running type check"
  84. @yarn run tsc -p config/tsconfig.build.json
  85. @echo "--> Building static assets"
  86. @NODE_ENV=production yarn webpack-profile > .artifacts/webpack-stats.json
  87. test-js: node-version-check
  88. @echo "--> Running JavaScript tests"
  89. @yarn run test
  90. @echo ""
  91. test-js-ci: node-version-check
  92. @echo "--> Running CI JavaScript tests"
  93. @yarn run test-ci
  94. @echo ""
  95. test-python:
  96. @echo "--> Running Python tests"
  97. # This gets called by getsentry
  98. pytest tests/integration tests/sentry
  99. test-python-ci:
  100. make build-platform-assets
  101. @echo "--> Running CI Python tests"
  102. pytest tests/integration tests/sentry \
  103. --ignore tests/sentry/eventstream/kafka \
  104. --ignore tests/sentry/snuba \
  105. --ignore tests/sentry/search/events \
  106. --cov . --cov-report="xml:.artifacts/python.coverage.xml" --junit-xml=".artifacts/python.junit.xml" || exit 1
  107. @echo ""
  108. test-snuba:
  109. @echo "--> Running snuba tests"
  110. pytest tests/snuba tests/sentry/eventstream/kafka tests/sentry/snuba tests/sentry/search/events -vv --cov . --cov-report="xml:.artifacts/snuba.coverage.xml" --junit-xml=".artifacts/snuba.junit.xml"
  111. @echo ""
  112. test-tools:
  113. @echo "--> Running tools tests"
  114. pytest -c /dev/null --confcutdir tests/tools tests/tools -vv --cov=tools --cov=tests/tools --cov-report="xml:.artifacts/tools.coverage.xml" --junit-xml=".artifacts/tools.junit.xml"
  115. @echo ""
  116. backend-typing:
  117. @echo "--> Running Python typing checks"
  118. mypy --strict --warn-unreachable --config-file mypy.ini
  119. @echo ""
  120. test-symbolicator:
  121. @echo "--> Running symbolicator tests"
  122. pytest tests/symbolicator -vv --cov . --cov-report="xml:.artifacts/symbolicator.coverage.xml" --junit-xml=".artifacts/symbolicator.junit.xml"
  123. @echo ""
  124. test-chartcuterie:
  125. @echo "--> Running chartcuterie tests"
  126. pytest tests/chartcuterie -vv --cov . --cov-report="xml:.artifacts/chartcuterie.coverage.xml" --junit-xml=".artifacts/chartcuterie.junit.xml"
  127. @echo ""
  128. test-acceptance: node-version-check
  129. @echo "--> Building static assets"
  130. @$(WEBPACK)
  131. make run-acceptance
  132. test-plugins:
  133. @echo "--> Running plugin tests"
  134. pytest tests/sentry_plugins -vv --cov . --cov-report="xml:.artifacts/plugins.coverage.xml" --junit-xml=".artifacts/plugins.junit.xml" || exit 1
  135. @echo ""
  136. test-relay-integration:
  137. @echo "--> Running Relay integration tests"
  138. pytest tests/relay_integration -vv --cov . --cov-report="xml:.artifacts/relay.coverage.xml" --junit-xml=".artifacts/relay.junit.xml"
  139. @echo ""
  140. test-api-docs: build-api-docs
  141. yarn run validate-api-examples
  142. pytest tests/apidocs/endpoints
  143. @echo ""
  144. review-python-snapshots:
  145. @cargo insta --version &> /dev/null || cargo install cargo-insta
  146. @cargo insta review --workspace-root `pwd` -e pysnap
  147. accept-python-snapshots:
  148. @cargo insta --version &> /dev/null || cargo install cargo-insta
  149. @cargo insta accept --workspace-root `pwd` -e pysnap
  150. reject-python-snapshots:
  151. @cargo insta --version &> /dev/null || cargo install cargo-insta
  152. @cargo insta reject --workspace-root `pwd` -e pysnap
  153. lint-js:
  154. @echo "--> Linting javascript"
  155. bin/lint --js --parseable
  156. @echo ""
  157. .PHONY: build