Makefile 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. @node api-docs/watch.js
  41. build: locale
  42. merge-locale-catalogs: build-js-po
  43. $(PIP) install Babel
  44. cd src/sentry && sentry django makemessages -i static -l en
  45. ./bin/merge-catalogs en
  46. compile-locale:
  47. $(PIP) install Babel
  48. ./bin/find-good-catalogs src/sentry/locale/catalogs.json
  49. cd src/sentry && sentry django compilemessages
  50. install-transifex:
  51. $(PIP) install transifex-client
  52. push-transifex: merge-locale-catalogs install-transifex
  53. tx push -s
  54. pull-transifex: install-transifex
  55. tx pull -a
  56. # Update transifex with new strings that need to be translated
  57. update-transifex: push-transifex
  58. # Pulls new translations from transifex and compiles for usage
  59. update-local-locales: pull-transifex compile-locale
  60. build-chartcuterie-config:
  61. @echo "--> Building chartcuterie config module"
  62. yarn build-chartcuterie-config
  63. fetch-release-registry:
  64. @echo "--> Fetching release registry"
  65. @echo "from sentry.utils.distutils import sync_registry; sync_registry()" | sentry exec
  66. run-acceptance:
  67. @echo "--> Running acceptance tests"
  68. pytest tests/acceptance --cov . --cov-report="xml:.artifacts/acceptance.coverage.xml" --junit-xml=".artifacts/acceptance.junit.xml"
  69. @echo ""
  70. test-cli:
  71. @echo "--> Testing CLI"
  72. rm -rf test_cli
  73. mkdir test_cli
  74. cd test_cli && sentry init test_conf
  75. cd test_cli && sentry --config=test_conf help
  76. cd test_cli && sentry --config=test_conf upgrade --traceback --noinput
  77. cd test_cli && sentry --config=test_conf export
  78. rm -r test_cli
  79. @echo ""
  80. test-js-build: node-version-check
  81. @echo "--> Running type check"
  82. @yarn run tsc -p config/tsconfig.build.json
  83. @echo "--> Building static assets"
  84. @NODE_ENV=production yarn webpack-profile > .artifacts/webpack-stats.json
  85. test-js: node-version-check
  86. @echo "--> Running JavaScript tests"
  87. @yarn run test
  88. @echo ""
  89. test-js-ci: node-version-check
  90. @echo "--> Running CI JavaScript tests"
  91. @yarn run test-ci
  92. @echo ""
  93. test-python:
  94. @echo "--> Running Python tests"
  95. # This gets called by getsentry
  96. pytest tests/integration tests/sentry
  97. test-python-ci:
  98. make build-platform-assets
  99. @echo "--> Running CI Python tests"
  100. pytest tests/integration tests/sentry --cov . --cov-report="xml:.artifacts/python.coverage.xml" --junit-xml=".artifacts/python.junit.xml" || exit 1
  101. @echo ""
  102. test-snuba:
  103. @echo "--> Running snuba tests"
  104. 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"
  105. @echo ""
  106. backend-typing:
  107. @echo "--> Running Python typing checks"
  108. mypy --strict --warn-unreachable --config-file mypy.ini
  109. @echo ""
  110. test-symbolicator:
  111. @echo "--> Running symbolicator tests"
  112. pytest tests/symbolicator -vv --cov . --cov-report="xml:.artifacts/symbolicator.coverage.xml" --junit-xml=".artifacts/symbolicator.junit.xml"
  113. @echo ""
  114. test-chartcuterie:
  115. @echo "--> Running chartcuterie tests"
  116. pytest tests/chartcuterie -vv --cov . --cov-report="xml:.artifacts/chartcuterie.coverage.xml" --junit-xml=".artifacts/chartcuterie.junit.xml"
  117. @echo ""
  118. test-acceptance: node-version-check
  119. @echo "--> Building static assets"
  120. @$(WEBPACK)
  121. make run-acceptance
  122. test-plugins:
  123. @echo "--> Running plugin tests"
  124. pytest tests/sentry_plugins -vv --cov . --cov-report="xml:.artifacts/plugins.coverage.xml" --junit-xml=".artifacts/plugins.junit.xml" || exit 1
  125. @echo ""
  126. test-relay-integration:
  127. @echo "--> Running Relay integration tests"
  128. pytest tests/relay_integration -vv
  129. @echo ""
  130. test-api-docs: build-api-docs
  131. yarn run validate-api-examples
  132. pytest tests/apidocs/endpoints
  133. @echo ""
  134. review-python-snapshots:
  135. @cargo insta --version &> /dev/null || cargo install cargo-insta
  136. @cargo insta review --workspace-root `pwd` -e pysnap
  137. accept-python-snapshots:
  138. @cargo insta --version &> /dev/null || cargo install cargo-insta
  139. @cargo insta accept --workspace-root `pwd` -e pysnap
  140. reject-python-snapshots:
  141. @cargo insta --version &> /dev/null || cargo install cargo-insta
  142. @cargo insta reject --workspace-root `pwd` -e pysnap
  143. lint-js:
  144. @echo "--> Linting javascript"
  145. bin/lint --js --parseable
  146. @echo ""
  147. .PHONY: build