.travis.yml 9.3 KB

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