.travis.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. dist: xenial
  2. language: python
  3. python: 2.7
  4. branches:
  5. only:
  6. - master
  7. cache:
  8. yarn: true
  9. directories:
  10. - "${HOME}/virtualenv/python$(python -c 'import platform; print(platform.python_version())')"
  11. - "$NODE_DIR"
  12. - node_modules
  13. - "${HOME}/google-cloud-sdk"
  14. addons:
  15. apt:
  16. update: true
  17. packages:
  18. - libxmlsec1-dev
  19. - libmaxminddb-dev
  20. chrome: stable
  21. env:
  22. global:
  23. - NODE_ENV=development
  24. # PIP_VERSION causes issues because: https://github.com/pypa/pip/issues/4528
  25. # Note: this has to be synced with the pip version in the Makefile.
  26. - PYTHON_PIP_VERSION=19.2.3
  27. - PIP_DISABLE_PIP_VERSION_CHECK=on
  28. - PIP_QUIET=1
  29. - SENTRY_LIGHT_BUILD=1
  30. - SENTRY_SKIP_BACKEND_VALIDATION=1
  31. - MIGRATIONS_TEST_MIGRATE=0
  32. # Use this to override the django version in the requirements file.
  33. - DJANGO_VERSION=">=1.9,<1.10"
  34. # node's version is pinned by .nvmrc and is autodetected by `nvm install`.
  35. - NODE_DIR="${HOME}/.nvm/versions/node/v$(< .nvmrc)"
  36. - NODE_OPTIONS=--max-old-space-size=4096
  37. before_install:
  38. - &pip_install pip install "pip==${PYTHON_PIP_VERSION}"
  39. script:
  40. # certain commands require sentry init to be run, but this is only true for
  41. # running things within Travis
  42. - make travis-test-$TEST_SUITE
  43. - make travis-scan-$TEST_SUITE
  44. # installing dependencies for after_* steps here ensures they get cached
  45. # since those steps execute after travis runs `store build cache`
  46. after_failure:
  47. - dmesg | tail -n 100
  48. after_script:
  49. - |
  50. coverage_files=$(ls .artifacts/*coverage.xml || true)
  51. if [[ -n "$coverage_files" || -f .artifacts/coverage/cobertura-coverage.xml ]]; then
  52. pip install -U codecov
  53. codecov -e TEST_SUITE
  54. fi
  55. - ./bin/yarn global add @zeus-ci/cli
  56. - $(./bin/yarn global bin)/zeus upload -t "text/xml+xunit" .artifacts/*junit.xml
  57. - $(./bin/yarn global bin)/zeus upload -t "text/xml+coverage" .artifacts/*coverage.xml
  58. - $(./bin/yarn global bin)/zeus upload -t "text/xml+coverage" .artifacts/coverage/cobertura-coverage.xml
  59. - $(./bin/yarn global bin)/zeus upload -t "text/html+pytest" .artifacts/*pytest.html
  60. - $(./bin/yarn global bin)/zeus upload -t "text/plain+pycodestyle" .artifacts/*pycodestyle.log
  61. - $(./bin/yarn global bin)/zeus upload -t "text/xml+checkstyle" .artifacts/*checkstyle.xml
  62. - $(./bin/yarn global bin)/zeus upload -t "application/webpack-stats+json" .artifacts/*webpack-stats.json
  63. base_postgres: &postgres_default
  64. python: 2.7
  65. services:
  66. - memcached
  67. - redis-server
  68. - postgresql
  69. before_install:
  70. - *pip_install
  71. - docker run -d --network host --name clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server:19.11
  72. - docker run -d --network host --name snuba --env SNUBA_SETTINGS=test --env CLICKHOUSE_SERVER=localhost:9000 getsentry/snuba
  73. - docker ps -a
  74. install:
  75. - python setup.py install_egg_info
  76. - pip install -U -e ".[dev]"
  77. before_script:
  78. - psql -c 'create database sentry;' -U postgres
  79. base_acceptance: &acceptance_default
  80. python: 2.7
  81. services:
  82. - docker
  83. - memcached
  84. - redis-server
  85. - postgresql
  86. before_install:
  87. - *pip_install
  88. - find "$NODE_DIR" -type d -empty -delete
  89. - nvm install
  90. - docker run -d --network host --name clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server:19.11
  91. - docker run -d --network host --name snuba --env SNUBA_SETTINGS=test --env CLICKHOUSE_SERVER=localhost:9000 getsentry/snuba
  92. - docker ps -a
  93. install:
  94. - ./bin/yarn install --pure-lockfile
  95. - python setup.py install_egg_info
  96. - pip install -U -e ".[dev]"
  97. - |
  98. CHROME_MAJOR_VERSION="$(dpkg -s google-chrome-stable | sed -nr 's/Version: ([0-9]+).*/\1/p')"
  99. wget -N "https://chromedriver.storage.googleapis.com/$(curl https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAJOR_VERSION})/chromedriver_linux64.zip" -P ~/
  100. - unzip ~/chromedriver_linux64.zip -d ~/
  101. - rm ~/chromedriver_linux64.zip
  102. - sudo install -m755 ~/chromedriver /usr/local/bin/
  103. before_script:
  104. - psql -c 'create database sentry;' -U postgres
  105. # each job in the matrix inherits `env/global` and uses everything above,
  106. # but custom `services`, `before_install`, `install`, and `before_script` directives
  107. # may be defined to define and setup individual job environments with more precision.
  108. matrix:
  109. fast_finish: true
  110. include:
  111. # Lint python and javascript together
  112. - python: 2.7
  113. name: 'Linter'
  114. env: TEST_SUITE=lint
  115. install:
  116. - python setup.py install_egg_info
  117. - SENTRY_LIGHT_BUILD=1 pip install -U -e ".[dev]"
  118. - find "$NODE_DIR" -type d -empty -delete
  119. - nvm install
  120. - ./bin/yarn install --pure-lockfile
  121. # Proactive linting on 3.7 during the porting process
  122. - python: 3.7
  123. name: 'Linter (Python 3.7)'
  124. install: pip install 'sentry-flake8>=0.2.0,<0.3.0'
  125. # configuration for flake8 can be found in setup.cfg
  126. script: flake8
  127. - <<: *postgres_default
  128. name: 'Backend with migrations [Postgres] (1/2)'
  129. env: TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=0 MIGRATIONS_TEST_MIGRATE=1
  130. - <<: *postgres_default
  131. name: 'Backend with migrations [Postgres] (2/2)'
  132. env: TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=1 MIGRATIONS_TEST_MIGRATE=1
  133. - <<: *acceptance_default
  134. name: 'Acceptance'
  135. env: TEST_SUITE=acceptance USE_SNUBA=1
  136. - <<: *postgres_default
  137. name: '[Django 1.10] Backend with migrations [Postgres] (1/2)'
  138. env: DJANGO_VERSION=">=1.10,<1.11" TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=0 MIGRATIONS_TEST_MIGRATE=1
  139. - <<: *postgres_default
  140. name: '[Django 1.10] Backend with migrations [Postgres] (2/2)'
  141. env: DJANGO_VERSION=">=1.10,<1.11" TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=1 MIGRATIONS_TEST_MIGRATE=1
  142. - <<: *acceptance_default
  143. name: '[Django 1.10] Acceptance'
  144. env: DJANGO_VERSION=">=1.10,<1.11" TEST_SUITE=acceptance USE_SNUBA=1 PERCY_ENABLE=0
  145. - <<: *acceptance_default
  146. name: 'Plugins'
  147. env: TEST_SUITE=plugins DB=postgres PERCY_TOKEN=${PLUGIN_PERCY_TOKEN}
  148. - python: 2.7
  149. name: 'Frontend'
  150. env: TEST_SUITE=js
  151. before_install:
  152. - *pip_install
  153. - find "$NODE_DIR" -type d -empty -delete
  154. - nvm install
  155. install:
  156. - ./bin/yarn install --pure-lockfile
  157. - python: 2.7
  158. name: 'Command Line'
  159. env: TEST_SUITE=cli
  160. services:
  161. - postgresql
  162. - redis-server
  163. install:
  164. - python setup.py install_egg_info
  165. - pip install -U -e .
  166. before_script:
  167. - psql -c 'create database sentry;' -U postgres
  168. - python: 2.7
  169. name: 'Distribution build'
  170. env: TEST_SUITE=dist
  171. before_install:
  172. - *pip_install
  173. - find "$NODE_DIR" -type d -empty -delete
  174. - nvm install
  175. - <<: *postgres_default
  176. name: 'Symbolicator Integration'
  177. env: TEST_SUITE=symbolicator
  178. before_install:
  179. - docker run -d --network host --name clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server:19.11
  180. - docker run -d --network host --name snuba --env SNUBA_SETTINGS=test --env CLICKHOUSE_SERVER=localhost:9000 getsentry/snuba
  181. - docker run -d --network host --name symbolicator us.gcr.io/sentryio/symbolicator:latest run
  182. - docker ps -a
  183. - python: 2.7
  184. name: 'Snuba Integration with migrations'
  185. env: TEST_SUITE=snuba USE_SNUBA=1 SENTRY_ZOOKEEPER_HOSTS=localhost:2181 SENTRY_KAFKA_HOSTS=localhost:9092 MIGRATIONS_TEST_MIGRATE=1
  186. services:
  187. - docker
  188. - memcached
  189. - redis-server
  190. - postgresql
  191. before_install:
  192. - *pip_install
  193. - docker run -d --network host --name zookeeper -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:4.1.0
  194. - docker run -d --network host --name kafka -e KAFKA_ZOOKEEPER_CONNECT=localhost:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 confluentinc/cp-kafka:4.1.0
  195. - docker run -d --network host --name clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server:19.11
  196. - docker run -d --network host --name snuba --env SNUBA_SETTINGS=test --env CLICKHOUSE_SERVER=localhost:9000 getsentry/snuba
  197. - docker ps -a
  198. install:
  199. - python setup.py install_egg_info
  200. - pip install -U -e ".[dev]"
  201. - pip install confluent-kafka
  202. before_script:
  203. - psql -c 'create database sentry;' -U postgres
  204. - python: 2.7
  205. name: '[Django 1.10] Snuba Integration with migrations'
  206. env: DJANGO_VERSION=">=1.10,<1.11" TEST_SUITE=snuba USE_SNUBA=1 SENTRY_ZOOKEEPER_HOSTS=localhost:2181 SENTRY_KAFKA_HOSTS=localhost:9092 MIGRATIONS_TEST_MIGRATE=1
  207. services:
  208. - docker
  209. - memcached
  210. - redis-server
  211. - postgresql
  212. before_install:
  213. - *pip_install
  214. - docker run -d --network host --name zookeeper -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:4.1.0
  215. - docker run -d --network host --name kafka -e KAFKA_ZOOKEEPER_CONNECT=localhost:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 confluentinc/cp-kafka:4.1.0
  216. - docker run -d --network host --name clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server:19.11
  217. - docker run -d --network host --name snuba --env SNUBA_SETTINGS=test --env CLICKHOUSE_SERVER=localhost:9000 getsentry/snuba
  218. - docker ps -a
  219. install:
  220. - python setup.py install_egg_info
  221. - pip install -U -e ".[dev]"
  222. - pip install confluent-kafka
  223. before_script:
  224. - psql -c 'create database sentry;' -U postgres
  225. # Deploy 'storybook' (component & style guide) - allowed to fail
  226. - name: 'Storybook Deploy'
  227. language: node_js
  228. env: STORYBOOK_BUILD=1
  229. before_install:
  230. # Decrypt the credentials we added to the repo using the key we added with the Travis command line tool
  231. - openssl aes-256-cbc -K $encrypted_020be61ef175_key -iv $encrypted_020be61ef175_iv -in .travis/storybook-credentials.tar.gz.enc -out credentials.tar.gz -d
  232. # If the SDK is not already cached, download it and unpack it
  233. - if [ ! -d ${HOME}/google-cloud-sdk ]; then curl https://sdk.cloud.google.com | bash; fi
  234. - tar -xzf credentials.tar.gz
  235. # Use the decrypted service account credentials to authenticate the command line tool
  236. - gcloud auth activate-service-account --key-file client-secret.json
  237. install:
  238. - ./bin/yarn install --pure-lockfile
  239. - gcloud version
  240. script: bash .travis/deploy-storybook.sh
  241. after_success: skip
  242. after_failure: skip
  243. allow_failures:
  244. - name: 'Storybook Deploy'
  245. notifications:
  246. webhooks:
  247. urls:
  248. - https://zeus.ci/hooks/fa079cf6-8e6b-11e7-9155-0a580a28081c/public/provider/travis/webhook
  249. on_success: always
  250. on_failure: always
  251. on_start: always
  252. on_cancel: always
  253. on_error: always