123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- dist: xenial
- language: python
- python: 2.7
- branches:
- only:
- - master
- cache:
- yarn: true
- directories:
- - "${HOME}/virtualenv/python$(python -c 'import platform; print(platform.python_version())')"
- - '$NODE_DIR'
- - node_modules
- - '${HOME}/google-cloud-sdk'
- addons:
- apt:
- update: true
- packages:
- - libxmlsec1-dev
- - libmaxminddb-dev
- chrome: stable
- env:
- global:
- - NODE_ENV=development
- - PIP_DISABLE_PIP_VERSION_CHECK=on
- - PIP_QUIET=1
- - SENTRY_LIGHT_BUILD=1
- - SENTRY_SKIP_BACKEND_VALIDATION=1
- - MIGRATIONS_TEST_MIGRATE=0
- # Use this to override the django version in the requirements file.
- - DJANGO_VERSION=">=1.11,<1.12"
- # node's version is pinned by .nvmrc and is autodetected by `nvm install`.
- - NODE_DIR="${HOME}/.nvm/versions/node/v$(< .nvmrc)"
- - NODE_OPTIONS=--max-old-space-size=4096
- - PYTEST_SENTRY_DSN=https://6fd5cfea2d4d46b182ad214ac7810508@sentry.io/2423079
- - SENTRY_KAFKA_HOSTS=localhost:9092
- - SENTRY_ZOOKEEPER_HOSTS=localhost:2181
- - PYTEST_ADDOPTS="--reruns 5"
- base_install: &base_install |-
- pip install --no-cache-dir "pip>=20.0.2"
- docker run \
- --name sentry_zookeeper \
- -d --network host \
- -e ZOOKEEPER_CLIENT_PORT=2181 \
- confluentinc/cp-zookeeper:4.1.0
- docker run \
- --name sentry_kafka \
- -d --network host \
- -e KAFKA_ZOOKEEPER_CONNECT=127.0.0.1:2181 \
- -e KAFKA_LISTENERS=INTERNAL://0.0.0.0:9093,EXTERNAL://0.0.0.0:9092 \
- -e KAFKA_ADVERTISED_LISTENERS=INTERNAL://127.0.0.1:9093,EXTERNAL://127.0.0.1:9092 \
- -e KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT \
- -e KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL \
- -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \
- confluentinc/cp-kafka:5.1.2
- [ "$TRAVIS_PULL_REQUEST" != "false" ] || export PYTEST_SENTRY_ALWAYS_REPORT=1
- start_snuba: &start_snuba |-
- docker run \
- --name sentry_clickhouse \
- -d --network host \
- --ulimit nofile=262144:262144 \
- yandex/clickhouse-server:19.11 \
- docker run \
- --name sentry_snuba \
- -d --network host \
- -e SNUBA_SETTINGS=test \
- -e CLICKHOUSE_HOST=127.0.0.1 \
- -e CLICKHOUSE_PORT=9000 \
- getsentry/snuba
- script:
- # certain commands require sentry init to be run, but this is only true for
- # running things within Travis
- - make travis-test-$TEST_SUITE
- # installing dependencies for after_* steps here ensures they get cached
- # since those steps execute after travis runs `store build cache`
- after_failure:
- - dmesg | tail -n 100
- after_script:
- - |
- coverage_files=$(ls .artifacts/*coverage.xml || true)
- if [[ -n "$coverage_files" || -f .artifacts/coverage/cobertura-coverage.xml ]]; then
- pip install -U codecov
- codecov -e TEST_SUITE
- fi
- - ./bin/yarn global add @zeus-ci/cli
- - $(./bin/yarn global bin)/zeus upload -t "text/xml+xunit" .artifacts/*junit.xml
- - $(./bin/yarn global bin)/zeus upload -t "text/xml+coverage" .artifacts/*coverage.xml
- - $(./bin/yarn global bin)/zeus upload -t "text/xml+coverage" .artifacts/coverage/cobertura-coverage.xml
- - $(./bin/yarn global bin)/zeus upload -t "text/html+pytest" .artifacts/*pytest.html
- - $(./bin/yarn global bin)/zeus upload -t "text/plain+pycodestyle" .artifacts/*pycodestyle.log
- - $(./bin/yarn global bin)/zeus upload -t "text/xml+checkstyle" .artifacts/*checkstyle.xml
- - $(./bin/yarn global bin)/zeus upload -t "application/webpack-stats+json" .artifacts/*webpack-stats.json
- base_postgres: &postgres_default
- python: 2.7
- services:
- - memcached
- - redis-server
- - postgresql
- before_install:
- - *base_install
- - *start_snuba
- - docker ps -a
- install:
- - python setup.py install_egg_info
- - pip install -U -e ".[dev]"
- before_script:
- - psql -c 'create database sentry;' -U postgres
- base_acceptance: &acceptance_default
- python: 2.7
- services:
- - docker
- - memcached
- - redis-server
- - postgresql
- before_install:
- - *base_install
- - *start_snuba
- - find "$NODE_DIR" -type d -empty -delete
- - nvm install
- - docker ps -a
- install:
- - ./bin/yarn install --frozen-lockfile
- - python setup.py install_egg_info
- - pip install -U -e ".[dev]"
- - |
- CHROME_MAJOR_VERSION="$(dpkg -s google-chrome-stable | sed -nr 's/Version: ([0-9]+).*/\1/p')"
- wget -N "https://chromedriver.storage.googleapis.com/$(curl https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAJOR_VERSION})/chromedriver_linux64.zip" -P ~/
- - unzip ~/chromedriver_linux64.zip -d ~/
- - rm ~/chromedriver_linux64.zip
- - sudo install -m755 ~/chromedriver /usr/local/bin/
- before_script:
- - psql -c 'create database sentry;' -U postgres
- # each job in the matrix inherits `env/global` and uses everything above,
- # but custom `services`, `before_install`, `install`, and `before_script` directives
- # may be defined to define and setup individual job environments with more precision.
- matrix:
- fast_finish: true
- include:
- - language: generic
- name: 'Linter (Javascript)'
- env: TEST_SUITE=lint-js
- install:
- - find "$NODE_DIR" -type d -empty -delete
- # Under a "generic" language environment, this will make travis pyenv error because there
- # is no pyenv python installed.
- - rm .python-version
- - nvm install
- - ./bin/yarn install --frozen-lockfile
- - python: 3.7
- name: 'pre-commit hooks (includes python linting + format check) and dependency scanning'
- install:
- # XXX: this must be synced with requirements-dev.txt
- - pip install 'sentry-flake8==0.3.0'
- - SENTRY_NO_VIRTUALENV_CREATION=1 make setup-git
- script:
- # black is going to rewrite the files in-place.
- # i need to either define a second hook that only runs --check --diff and conditionally run that,
- # or i need to figure out how to pass additional args to a hook from the pre-commit invocation.
- - pre-commit run --all-files
- # If pre-commit was good, then we scan dependencies.
- # Note that this isn't moved to an after_script since that would override what we already have.
- # XXX: ideally we don't have to install sentry in its entirety just to scan dependencies...
- # see the note in bin/scan on why this needs to be done for now.
- # Note that this will mostly noop because we pull in a cached venv from Travis.
- - SENTRY_LIGHT_BUILD=1 SENTRY_PYTHON3=1 pip install -e .
- - pip install safety
- # XXX: fun fact, as of April 2020 travis preinstalls numpy 1.15.4 in their 3.7 environments
- # and the safety scanner won't like that (safety id 36810)
- # Previously we had 36810 ignored in bin/scan until it was removed because it was fixed in
- # travis 2.7. So this is isolated to at least travis 3.7.
- - pip uninstall -y numpy
- - bin/scan
- - <<: *postgres_default
- name: 'Backend with migrations [Postgres] (1/2)'
- env: TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=0 MIGRATIONS_TEST_MIGRATE=1
- - <<: *postgres_default
- name: 'Backend with migrations [Postgres] (2/2)'
- env: TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=1 MIGRATIONS_TEST_MIGRATE=1
- - <<: *acceptance_default
- name: 'Acceptance'
- env: TEST_SUITE=acceptance USE_SNUBA=1
- - <<: *acceptance_default
- name: 'Plugins'
- env: TEST_SUITE=plugins DB=postgres PERCY_TOKEN=${PLUGIN_PERCY_TOKEN}
- - python: 2.7
- name: 'Frontend [test]'
- env: TEST_SUITE=js
- before_install:
- - find "$NODE_DIR" -type d -empty -delete
- - nvm install
- install:
- - ./bin/yarn install --frozen-lockfile
- - python: 2.7
- name: 'Frontend [build]'
- env: TEST_SUITE=js-build
- before_install:
- - find "$NODE_DIR" -type d -empty -delete
- - nvm install
- install:
- - ./bin/yarn install --frozen-lockfile
- - python: 2.7
- name: 'Command Line'
- env: TEST_SUITE=cli
- services:
- - postgresql
- - redis-server
- install:
- - python setup.py install_egg_info
- - pip install -U -e .
- before_script:
- - psql -c 'create database sentry;' -U postgres
- - <<: *postgres_default
- name: 'Symbolicator Integration'
- env: TEST_SUITE=symbolicator
- before_install:
- - *base_install
- - *start_snuba
- - docker run -d --network host --name symbolicator us.gcr.io/sentryio/symbolicator:latest run
- - docker ps -a
- - <<: *postgres_default
- name: 'Sentry-Relay integration tests'
- env: TEST_SUITE=relay-integration DB=postgres
- services:
- - docker
- - memcached
- - redis-server
- - postgresql
- before_install:
- - *base_install
- - *start_snuba
- - docker pull us.gcr.io/sentryio/relay:latest # pull relay we'll run and kill it for each test
- - docker ps -a
- - python: 2.7
- name: 'Snuba Integration with migrations'
- env: TEST_SUITE=snuba USE_SNUBA=1 MIGRATIONS_TEST_MIGRATE=1
- services:
- - docker
- - memcached
- - redis-server
- - postgresql
- before_install:
- - *base_install
- - *start_snuba
- - docker ps -a
- install:
- - python setup.py install_egg_info
- - pip install -U -e ".[dev]"
- before_script:
- - psql -c 'create database sentry;' -U postgres
- # XXX: this needs to be the same as postgres_default (other than python, name, env, and the rb package override)
- # NOTE: Migrations need to also be ported to py3.6, but the errors just clog up everything.
- # So for now, we're unblocking that by not having MIGRATIONS_TEST_MIGRATE=1.
- # Allowed to fail!
- # - python: 3.6
- # name: 'Python 3.6 backend (no migrations) [Postgres]'
- # env: TEST_SUITE=postgres DB=postgres SENTRY_PYTHON3=1 PYTEST_ADDOPTS="" PYTEST_SENTRY_ALWAYS_REPORT=no
- # services:
- # - memcached
- # - redis-server
- # - postgresql
- # before_install:
- # - *base_install
- # - *start_snuba
- # - docker ps -a
- # install:
- # - python setup.py install_egg_info
- # - pip install -U -e ".[dev]"
- # - pip uninstall -y rb
- # - pip install -e git+https://github.com/joshuarli/rb.git@505ad7665baba66c7c492b01b0e83d433ed2eb8e#egg=rb
- # before_script:
- # - psql -c 'create database sentry;' -U postgres
- # Deploy 'storybook' (component & style guide)
- - name: 'Storybook Deploy'
- language: node_js
- env: STORYBOOK_BUILD=1
- before_install:
- # travis pyenv will attempt to use .python-version, but the appropriate python version won't be installed.
- # since we don't need python here, we have to remove this.
- - rm .python-version
- install: ./bin/yarn install --frozen-lockfile
- script: ./bin/yarn run storybook-build
- after_success: .travis/deploy-storybook.sh
- after_failure: skip
- notifications:
- webhooks:
- urls:
- - https://zeus.ci/hooks/fa079cf6-8e6b-11e7-9155-0a580a28081c/public/provider/travis/webhook
- on_success: always
- on_failure: always
- on_start: always
- on_cancel: always
- on_error: always
|