.travis.yml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. - libgeoip-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_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. - MIGRATIONS_TEST_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. base_postgres: &postgres_default
  64. python: 2.7
  65. services:
  66. - memcached
  67. - redis-server
  68. - postgresql
  69. before_install:
  70. - docker run -d --network host --name clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server:19.4
  71. - docker run -d --network host --name snuba --env SNUBA_SETTINGS=test --env CLICKHOUSE_SERVER=localhost:9000 getsentry/snuba
  72. - docker ps -a
  73. install:
  74. - python setup.py install_egg_info
  75. - pip install -U -e ".[dev,tests,optional]"
  76. before_script:
  77. - psql -c 'create database sentry;' -U postgres
  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. - <<: *postgres_default
  126. name: 'Backend with migrations [Postgres] (1/2)'
  127. env: TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=0 MIGRATIONS_TEST_MIGRATE=1
  128. - <<: *postgres_default
  129. name: 'Backend with migrations [Postgres] (2/2)'
  130. env: TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=1 MIGRATIONS_TEST_MIGRATE=1
  131. - <<: *acceptance_default
  132. name: 'Acceptance'
  133. env: TEST_SUITE=acceptance USE_SNUBA=1
  134. - python: 2.7
  135. name: 'Frontend'
  136. env: TEST_SUITE=js
  137. before_install:
  138. - find "$NODE_DIR" -type d -empty -delete
  139. - nvm install
  140. install:
  141. - ./bin/yarn install --pure-lockfile
  142. - python: 2.7
  143. name: 'Command Line'
  144. env: TEST_SUITE=cli
  145. services:
  146. - postgresql
  147. - redis-server
  148. install:
  149. - python setup.py install_egg_info
  150. - pip install -U -e .
  151. before_script:
  152. - psql -c 'create database sentry;' -U postgres
  153. - python: 2.7
  154. name: 'Distribution build'
  155. env: TEST_SUITE=dist
  156. before_install:
  157. - find "$NODE_DIR" -type d -empty -delete
  158. - nvm install
  159. - <<: *postgres_default
  160. name: 'Symbolicator Integration'
  161. env: TEST_SUITE=symbolicator
  162. before_install:
  163. - docker run -d --network host --name clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server:19.4
  164. - docker run -d --network host --name snuba --env SNUBA_SETTINGS=test --env CLICKHOUSE_SERVER=localhost:9000 getsentry/snuba
  165. - docker run -d --network host --name symbolicator us.gcr.io/sentryio/symbolicator:latest run
  166. - docker ps -a
  167. # snuba in testing
  168. - python: 2.7
  169. name: 'Snuba Integration'
  170. env: TEST_SUITE=snuba USE_SNUBA=1 SENTRY_ZOOKEEPER_HOSTS=localhost:2181 SENTRY_KAFKA_HOSTS=localhost:9092
  171. services:
  172. - docker
  173. - memcached
  174. - redis-server
  175. - postgresql
  176. before_install:
  177. - docker run -d --network host --name zookeeper -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:4.1.0
  178. - 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
  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 ps -a
  182. install:
  183. - python setup.py install_egg_info
  184. - pip install -U -e ".[dev,tests,optional]"
  185. - pip install confluent-kafka
  186. before_script:
  187. - psql -c 'create database sentry;' -U postgres
  188. # Deploy 'storybook' (component & style guide) - allowed to fail
  189. - language: node_js
  190. name: 'Storybook Deploy'
  191. env: STORYBOOK_BUILD=1
  192. before_install:
  193. # Decrypt the credentials we added to the repo using the key we added with the Travis command line tool
  194. - openssl aes-256-cbc -K $encrypted_020be61ef175_key -iv $encrypted_020be61ef175_iv -in .travis/storybook-credentials.tar.gz.enc -out credentials.tar.gz -d
  195. # If the SDK is not already cached, download it and unpack it
  196. - if [ ! -d ${HOME}/google-cloud-sdk ]; then curl https://sdk.cloud.google.com | bash; fi
  197. - tar -xzf credentials.tar.gz
  198. # Use the decrypted service account credentials to authenticate the command line tool
  199. - gcloud auth activate-service-account --key-file client-secret.json
  200. install:
  201. - ./bin/yarn install --pure-lockfile
  202. - gcloud version
  203. script: bash .travis/deploy-storybook.sh
  204. after_success: skip
  205. after_failure: skip
  206. # jobs are defined in matrix/include
  207. # to specify which jobs are allowed to fail, match the env exactly in matrix/allow_failures
  208. allow_failures:
  209. - language: node_js
  210. env: STORYBOOK_BUILD=1
  211. notifications:
  212. webhooks:
  213. urls:
  214. - https://zeus.ci/hooks/fa079cf6-8e6b-11e7-9155-0a580a28081c/public/provider/travis/webhook
  215. on_success: always
  216. on_failure: always
  217. on_start: always
  218. on_cancel: always
  219. on_error: always