Makefile 5.4 KB

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