Makefile 5.3 KB

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