.travis.yml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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_VERSION causes issues because: https://github.com/pypa/pip/issues/4528
  26. - PYTHON_PIP_VERSION=19.1.1
  27. - PIP_USE_PEP517=off
  28. - PIP_DISABLE_PIP_VERSION_CHECK=on
  29. - PIP_QUIET=1
  30. - SENTRY_LIGHT_BUILD=1
  31. - SENTRY_SKIP_BACKEND_VALIDATION=1
  32. - SOUTH_TESTS_MIGRATE=0
  33. - DJANGO_VERSION=">=1.8,<1.9"
  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==${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. # Trigger a build for the `git` image on docker-sentry
  64. - >
  65. if [ "$TRAVIS_PULL_REQUEST" == "false" -a "$TRAVIS_BRANCH" == "master" ]; then
  66. curl -s -X POST "$DOCKER_SENTRY_BUILD_TRIGGER_URL";
  67. fi
  68. base_postgres: &postgres_default
  69. python: 2.7
  70. services:
  71. - memcached
  72. - redis-server
  73. - postgresql
  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. install:
  79. - python setup.py install_egg_info
  80. - pip install -U -e ".[dev,tests,optional]"
  81. before_script:
  82. - psql -c 'create database sentry;' -U postgres
  83. base_acceptance: &acceptance_default
  84. python: 2.7
  85. services:
  86. - docker
  87. - memcached
  88. - redis-server
  89. - postgresql
  90. before_install:
  91. - find "$NODE_DIR" -type d -empty -delete
  92. - nvm install
  93. - docker run -d --network host --name clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server:19.4
  94. - docker run -d --network host --name snuba --env SNUBA_SETTINGS=test --env CLICKHOUSE_SERVER=localhost:9000 getsentry/snuba
  95. - docker ps -a
  96. install:
  97. - ./bin/yarn install --pure-lockfile
  98. - python setup.py install_egg_info
  99. - pip install -U -e ".[dev,tests,optional]"
  100. - |
  101. CHROME_MAJOR_VERSION="$(dpkg -s google-chrome-stable | sed -nr 's/Version: ([0-9]+).*/\1/p')"
  102. wget -N "https://chromedriver.storage.googleapis.com/$(curl https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAJOR_VERSION})/chromedriver_linux64.zip" -P ~/
  103. - unzip ~/chromedriver_linux64.zip -d ~/
  104. - rm ~/chromedriver_linux64.zip
  105. - sudo install -m755 ~/chromedriver /usr/local/bin/
  106. before_script:
  107. - psql -c 'create database sentry;' -U postgres
  108. # each job in the matrix inherits `env/global` and uses everything above,
  109. # but custom `services`, `before_install`, `install`, and `before_script` directives
  110. # may be defined to define and setup individual job environments with more precision.
  111. matrix:
  112. fast_finish: true
  113. include:
  114. # Lint python and javascript together
  115. - python: 2.7
  116. name: 'Linter'
  117. env: TEST_SUITE=lint
  118. install:
  119. - python setup.py install_egg_info
  120. - SENTRY_LIGHT_BUILD=1 pip install -U -e ".[dev,tests,optional]"
  121. - find "$NODE_DIR" -type d -empty -delete
  122. - nvm install
  123. - ./bin/yarn install --pure-lockfile
  124. - <<: *postgres_default
  125. name: 'Backend [Postgres] (1/2)'
  126. env: TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=0
  127. - <<: *postgres_default
  128. name: 'Backend [Postgres] (2/2)'
  129. env: TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=1
  130. - python: 2.7
  131. name: 'Backend [Riak]'
  132. env: TEST_SUITE=riak DB=postgres
  133. services:
  134. - memcached
  135. - redis-server
  136. - postgresql
  137. - riak
  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. install:
  143. - python setup.py install_egg_info
  144. - pip install -U -e ".[dev,tests,optional]"
  145. before_script:
  146. - psql -c 'create database sentry;' -U postgres
  147. - <<: *acceptance_default
  148. name: 'Acceptance'
  149. env: TEST_SUITE=acceptance USE_SNUBA=1
  150. - python: 2.7
  151. name: 'Frontend'
  152. env: TEST_SUITE=js
  153. before_install:
  154. - find "$NODE_DIR" -type d -empty -delete
  155. - nvm install
  156. install:
  157. - ./bin/yarn install --pure-lockfile
  158. - python: 2.7
  159. name: 'Command Line'
  160. env: TEST_SUITE=cli
  161. services:
  162. - postgresql
  163. - redis-server
  164. install:
  165. - python setup.py install_egg_info
  166. - pip install -U -e .
  167. before_script:
  168. - psql -c 'create database sentry;' -U postgres
  169. - python: 2.7
  170. name: 'Distribution build'
  171. env: TEST_SUITE=dist
  172. before_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.4
  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. # snuba in testing
  184. - python: 2.7
  185. name: 'Snuba Integration'
  186. env: TEST_SUITE=snuba USE_SNUBA=1 SENTRY_ZOOKEEPER_HOSTS=localhost:2181 SENTRY_KAFKA_HOSTS=localhost:9092
  187. services:
  188. - docker
  189. - memcached
  190. - redis-server
  191. - postgresql
  192. before_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.4
  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,tests,optional]"
  201. - pip install confluent-kafka
  202. before_script:
  203. - psql -c 'create database sentry;' -U postgres
  204. # Deploy 'storybook' (component & style guide) - allowed to fail
  205. - language: node_js
  206. name: 'Storybook Deploy'
  207. env: STORYBOOK_BUILD=1
  208. before_install:
  209. # Decrypt the credentials we added to the repo using the key we added with the Travis command line tool
  210. - openssl aes-256-cbc -K $encrypted_020be61ef175_key -iv $encrypted_020be61ef175_iv -in .travis/storybook-credentials.tar.gz.enc -out credentials.tar.gz -d
  211. # If the SDK is not already cached, download it and unpack it
  212. - if [ ! -d ${HOME}/google-cloud-sdk ]; then curl https://sdk.cloud.google.com | bash; fi
  213. - tar -xzf credentials.tar.gz
  214. # Use the decrypted service account credentials to authenticate the command line tool
  215. - gcloud auth activate-service-account --key-file client-secret.json
  216. install:
  217. - ./bin/yarn install --pure-lockfile
  218. - gcloud version
  219. script: bash .travis/deploy-storybook.sh
  220. after_success: skip
  221. after_failure: skip
  222. # jobs are defined in matrix/include
  223. # to specify which jobs are allowed to fail, match the env exactly in matrix/allow_failures
  224. allow_failures:
  225. - language: node_js
  226. env: STORYBOOK_BUILD=1
  227. notifications:
  228. webhooks:
  229. urls:
  230. - https://zeus.ci/hooks/fa079cf6-8e6b-11e7-9155-0a580a28081c/public/provider/travis/webhook
  231. on_success: always
  232. on_failure: always
  233. on_start: always
  234. on_cancel: always
  235. on_error: always