.travis.yml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. - PYTEST_SENTRY_DSN=https://6fd5cfea2d4d46b182ad214ac7810508@sentry.io/2423079
  35. - PYTEST_ADDOPTS="--reruns 5"
  36. before_install:
  37. - &pip_install pip install --no-cache-dir "pip>=20.0.2"
  38. - '[ "$TRAVIS_BRANCH" != "master" ] || export PYTEST_SENTRY_ALWAYS_REPORT=1'
  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 --frozen-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 --frozen-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. - <<: *acceptance_default
  137. name: 'Plugins'
  138. env: TEST_SUITE=plugins DB=postgres PERCY_TOKEN=${PLUGIN_PERCY_TOKEN}
  139. - python: 2.7
  140. name: 'Frontend'
  141. env: TEST_SUITE=js
  142. before_install:
  143. - *pip_install
  144. - find "$NODE_DIR" -type d -empty -delete
  145. - nvm install
  146. install:
  147. - ./bin/yarn install --frozen-lockfile
  148. - python: 2.7
  149. name: 'Command Line'
  150. env: TEST_SUITE=cli
  151. services:
  152. - postgresql
  153. - redis-server
  154. install:
  155. - python setup.py install_egg_info
  156. - pip install -U -e .
  157. before_script:
  158. - psql -c 'create database sentry;' -U postgres
  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.11
  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. - python: 2.7
  168. name: 'Snuba Integration with migrations'
  169. env: TEST_SUITE=snuba USE_SNUBA=1 SENTRY_ZOOKEEPER_HOSTS=localhost:2181 SENTRY_KAFKA_HOSTS=localhost:9092 MIGRATIONS_TEST_MIGRATE=1
  170. services:
  171. - docker
  172. - memcached
  173. - redis-server
  174. - postgresql
  175. before_install:
  176. - *pip_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.11
  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]"
  185. - pip install confluent-kafka
  186. before_script:
  187. - psql -c 'create database sentry;' -U postgres
  188. # Deploy 'storybook' (component & style guide)
  189. - name: 'Storybook Deploy'
  190. language: node_js
  191. env: STORYBOOK_BUILD=1
  192. before_install:
  193. # travis pyenv will attempt to use .python-version, but the appropriate python version won't be installed.
  194. # since we don't need python here, we have to remove this.
  195. - rm .python-version
  196. # Decrypt the credentials we added to the repo using the key we added with the Travis command line tool
  197. - openssl aes-256-cbc -K $encrypted_020be61ef175_key -iv $encrypted_020be61ef175_iv -in .travis/storybook-credentials.tar.gz.enc -out credentials.tar.gz -d
  198. # If the SDK is not already cached, download it and unpack it
  199. - if [ ! -d ${HOME}/google-cloud-sdk ]; then curl https://sdk.cloud.google.com | bash; fi
  200. - tar -xzf credentials.tar.gz
  201. # Use the decrypted service account credentials to authenticate the command line tool
  202. - gcloud auth activate-service-account --key-file client-secret.json
  203. install:
  204. - ./bin/yarn install --frozen-lockfile
  205. - gcloud version
  206. script: bash .travis/deploy-storybook.sh
  207. after_success: skip
  208. after_failure: skip
  209. notifications:
  210. webhooks:
  211. urls:
  212. - https://zeus.ci/hooks/fa079cf6-8e6b-11e7-9155-0a580a28081c/public/provider/travis/webhook
  213. on_success: always
  214. on_failure: always
  215. on_start: always
  216. on_cancel: always
  217. on_error: always