.travis.yml 8.9 KB

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