forked from getsentry/sentry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
309 lines (277 loc) · 9.82 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
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())')"
- '$VOLTA_HOME'
- 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
- VOLTA_VERSION=0.8.1
- VOLTA_HOME="${HOME}/.volta"
- PATH="${HOME}/.volta/bin:${PATH}"
- 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
install_volta: &install_volta |-
command -v volta && return 0
wget --quiet "https://github.com/volta-cli/volta/releases/download/v$VOLTA_VERSION/volta-$VOLTA_VERSION-linux-openssl-1.0.tar.gz"
tar -xzf "volta-$VOLTA_VERSION-linux-openssl-1.0.tar.gz" -C "${HOME}/bin"
# Running `volta -v` triggers setting up the shims in VOLTA_HOME (otherwise node won't work)
volta -v
install_node_dependencies: &install_node_dependencies |-
# Running `node -v` and `yarn -v` triggers Volta to install the versions set in the project.
# There might be a more readable `volta install` in the future that would replace this magic.
# Tracking: https://github.com/volta-cli/volta/issues/653#issuecomment-628909923
node -v
yarn -v
yarn install --frozen-lockfile
start_snuba: &start_snuba |-
docker run \
--name sentry_clickhouse \
-d --network host \
--ulimit nofile=262144:262144 \
yandex/clickhouse-server:20.3.9.70 \
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
docker exec sentry_snuba snuba migrations migrate --force
script:
- make travis-test-$TEST_SUITE
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
- *install_volta
- volta install @zeus-ci/cli
- zeus upload -t "text/xml+xunit" .artifacts/*junit.xml
- zeus upload -t "text/xml+coverage" .artifacts/*coverage.xml
- zeus upload -t "text/xml+coverage" .artifacts/coverage/cobertura-coverage.xml
- zeus upload -t "text/html+pytest" .artifacts/*pytest.html
- zeus upload -t "text/plain+pycodestyle" .artifacts/*pycodestyle.log
- zeus upload -t "text/xml+checkstyle" .artifacts/*checkstyle.xml
- 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]"
- sentry init
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
- *install_volta
- *start_snuba
- docker ps -a
install:
- *install_node_dependencies
- python setup.py install_egg_info
- pip install -U -e ".[dev]"
- sentry init
- |
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
- install -m755 ~/chromedriver -C "${HOME}/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
before_install:
# Under a "generic" language environment, this will make travis pyenv error because there
# is no pyenv python installed.
- rm .python-version
- *install_volta
install:
- *install_node_dependencies
- python: 3.7
name: 'pre-commit hooks (includes python linting + format check)'
install:
- SENTRY_NO_VIRTUALENV_CREATION=1 make setup-git
script:
# Run pre-commit to lint and format check files that were changed (but not deleted) compared to master.
# XXX: there is a very small chance that it'll expand to exceed Linux's limits
# `getconf ARG_MAX` - max # bytes of args + environ for exec()
- pre-commit run --files $(git diff --diff-filter=d --name-only master)
- <<: *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 (1/3)'
env: TEST_SUITE=acceptance USE_SNUBA=1 TOTAL_TEST_GROUPS=3 TEST_GROUP=0
- <<: *acceptance_default
name: 'Acceptance (2/3)'
env: TEST_SUITE=acceptance USE_SNUBA=1 TOTAL_TEST_GROUPS=3 TEST_GROUP=1
- <<: *acceptance_default
name: 'Acceptance (3/3)'
env: TEST_SUITE=acceptance USE_SNUBA=1 TOTAL_TEST_GROUPS=3 TEST_GROUP=2
- <<: *acceptance_default
name: 'Plugins'
env: TEST_SUITE=plugins DB=postgres
- python: 2.7
name: 'Frontend [test]'
env: TEST_SUITE=js
before_install:
- *install_volta
install:
- *install_node_dependencies
- python: 2.7
name: 'Frontend [build]'
env: TEST_SUITE=js-build
before_install:
- *install_volta
install:
- *install_node_dependencies
- 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 ".[dev]"
- sentry init
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 -v $PWD/config/symbolicator/:/etc/symbolicator --network host --name symbolicator us.gcr.io/sentryio/symbolicator:latest run -c /etc/symbolicator/config.yml
- 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]"
- sentry init
before_script:
- psql -c 'create database sentry;' -U postgres
# Deploy 'storybook' (component & style guide)
- name: 'Storybook Deploy'
language: generic
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_volta
install:
- *install_node_dependencies
script: 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
# This is to capture travis metrics
# Repo for this webhook is https://github.com/getsentry/sentry-development-metrics
# Hosted on GCP
- https://product-eng-webhooks-vmrqv3f7nq-uw.a.run.app/metrics/travis/webhook
on_success: always
on_failure: always
on_start: always
on_cancel: always
on_error: always