Makefile 5.7 KB

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