.travis.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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.10,<1.11"
  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. # allowed to fail
  137. - <<: *postgres_default
  138. name: '[Django 1.11] Backend with migrations [Postgres] (1/2)'
  139. env: DJANGO_VERSION=">=1.11,<1.12" TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=0 MIGRATIONS_TEST_MIGRATE=1
  140. # allowed to fail
  141. - <<: *postgres_default
  142. name: '[Django 1.11] Backend with migrations [Postgres] (2/2)'
  143. env: DJANGO_VERSION=">=1.11,<1.12" TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=1 MIGRATIONS_TEST_MIGRATE=1
  144. # allowed to fail
  145. - <<: *acceptance_default
  146. name: '[Django 1.11] Acceptance'
  147. env: DJANGO_VERSION=">=1.11,<1.12" TEST_SUITE=acceptance USE_SNUBA=1 PERCY_ENABLE=0
  148. - <<: *acceptance_default
  149. name: 'Plugins'
  150. env: TEST_SUITE=plugins DB=postgres PERCY_TOKEN=${PLUGIN_PERCY_TOKEN}
  151. - python: 2.7
  152. name: 'Frontend'
  153. env: TEST_SUITE=js
  154. before_install:
  155. - *pip_install
  156. - find "$NODE_DIR" -type d -empty -delete
  157. - nvm install
  158. install:
  159. - ./bin/yarn install --pure-lockfile
  160. - python: 2.7
  161. name: 'Command Line'
  162. env: TEST_SUITE=cli
  163. services:
  164. - postgresql
  165. - redis-server
  166. install:
  167. - python setup.py install_egg_info
  168. - pip install -U -e .
  169. before_script:
  170. - psql -c 'create database sentry;' -U postgres
  171. - python: 2.7
  172. name: 'Distribution build'
  173. env: TEST_SUITE=dist
  174. before_install:
  175. - *pip_install
  176. - find "$NODE_DIR" -type d -empty -delete
  177. - nvm install
  178. - <<: *postgres_default
  179. name: 'Symbolicator Integration'
  180. env: TEST_SUITE=symbolicator
  181. before_install:
  182. - docker run -d --network host --name clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server:19.11
  183. - docker run -d --network host --name snuba --env SNUBA_SETTINGS=test --env CLICKHOUSE_SERVER=localhost:9000 getsentry/snuba
  184. - docker run -d --network host --name symbolicator us.gcr.io/sentryio/symbolicator:latest run
  185. - docker ps -a
  186. - python: 2.7
  187. name: 'Snuba Integration with migrations'
  188. env: TEST_SUITE=snuba USE_SNUBA=1 SENTRY_ZOOKEEPER_HOSTS=localhost:2181 SENTRY_KAFKA_HOSTS=localhost:9092 MIGRATIONS_TEST_MIGRATE=1
  189. services:
  190. - docker
  191. - memcached
  192. - redis-server
  193. - postgresql
  194. before_install:
  195. - *pip_install
  196. - docker run -d --network host --name zookeeper -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:4.1.0
  197. - 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
  198. - docker run -d --network host --name clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server:19.11
  199. - docker run -d --network host --name snuba --env SNUBA_SETTINGS=test --env CLICKHOUSE_SERVER=localhost:9000 getsentry/snuba
  200. - docker ps -a
  201. install:
  202. - python setup.py install_egg_info
  203. - pip install -U -e ".[dev]"
  204. - pip install confluent-kafka
  205. before_script:
  206. - psql -c 'create database sentry;' -U postgres
  207. # allowed to fail
  208. - python: 2.7
  209. name: '[Django 1.11] Snuba Integration with migrations'
  210. env: DJANGO_VERSION=">=1.11,<1.12" TEST_SUITE=snuba USE_SNUBA=1 SENTRY_ZOOKEEPER_HOSTS=localhost:2181 SENTRY_KAFKA_HOSTS=localhost:9092 MIGRATIONS_TEST_MIGRATE=1
  211. services:
  212. - docker
  213. - memcached
  214. - redis-server
  215. - postgresql
  216. before_install:
  217. - *pip_install
  218. - docker run -d --network host --name zookeeper -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:4.1.0
  219. - 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
  220. - docker run -d --network host --name clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server:19.11
  221. - docker run -d --network host --name snuba --env SNUBA_SETTINGS=test --env CLICKHOUSE_SERVER=localhost:9000 getsentry/snuba
  222. - docker ps -a
  223. install:
  224. - python setup.py install_egg_info
  225. - pip install -U -e ".[dev]"
  226. - pip install confluent-kafka
  227. before_script:
  228. - psql -c 'create database sentry;' -U postgres
  229. # Deploy 'storybook' (component & style guide) - allowed to fail
  230. - name: 'Storybook Deploy'
  231. language: node_js
  232. env: STORYBOOK_BUILD=1
  233. before_install:
  234. # Decrypt the credentials we added to the repo using the key we added with the Travis command line tool
  235. - openssl aes-256-cbc -K $encrypted_020be61ef175_key -iv $encrypted_020be61ef175_iv -in .travis/storybook-credentials.tar.gz.enc -out credentials.tar.gz -d
  236. # If the SDK is not already cached, download it and unpack it
  237. - if [ ! -d ${HOME}/google-cloud-sdk ]; then curl https://sdk.cloud.google.com | bash; fi
  238. - tar -xzf credentials.tar.gz
  239. # Use the decrypted service account credentials to authenticate the command line tool
  240. - gcloud auth activate-service-account --key-file client-secret.json
  241. install:
  242. - ./bin/yarn install --pure-lockfile
  243. - gcloud version
  244. script: bash .travis/deploy-storybook.sh
  245. after_success: skip
  246. after_failure: skip
  247. allow_failures:
  248. - name: 'Storybook Deploy'
  249. - name: '[Django 1.11] Backend with migrations [Postgres] (1/2)'
  250. - name: '[Django 1.11] Backend with migrations [Postgres] (2/2)'
  251. - name: '[Django 1.11] Acceptance'
  252. - name: '[Django 1.11] Snuba Integration with migrations'
  253. notifications:
  254. webhooks:
  255. urls:
  256. - https://zeus.ci/hooks/fa079cf6-8e6b-11e7-9155-0a580a28081c/public/provider/travis/webhook
  257. on_success: always
  258. on_failure: always
  259. on_start: always
  260. on_cancel: always
  261. on_error: always