8000 ci: Use Azure Pipelines (#305) · etherscan-io/sentry-python@62e3a64 · GitHub
[go: up one dir, main page]

Skip to content

Commit 62e3a64

Browse files
authored
ci: Use Azure Pipelines (getsentry#305)
1 parent 9da3ac7 commit 62e3a64

File tree

5 files changed

+93
-9
lines changed

5 files changed

+93
-9
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ matrix:
5555
- export TRAVIS_PYTHON_VERSION=2.7
5656

5757
before_script:
58-
- psql -c 'create database travis_ci_test;' -U postgres
59-
- psql -c 'create database test_travis_ci_test;' -U postgres
58+
- psql -c 'create database travis_ci_test;' -U postgres
59+
- psql -c 'create database test_travis_ci_test;' -U postgres
6060

6161
services:
6262
- postgresql
6363

6464
install:
6565
- pip install tox
6666
- pip install codecov
67-
- sh scripts/download-semaphore.sh
67+
- bash scripts/download-semaphore.sh
6868

6969
script:
7070
- coverage erase

azure-pipelines.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Python package
2+
# Create and test a Python package on multiple Python versions.
3+
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
4+
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
5+
6+
trigger:
7+
- master
8+
9+
pr: none
10+
11+
resources:
12+
containers:
13+
- container: postgres
14+
image: "postgres:9.6"
15+
ports:
16+
- 5432:5432
17+
18+
jobs:
19+
- job: run_tests
20+
displayName: Tests
21+
pool:
22+
vmImage: "Ubuntu-16.04"
23+
services:
24+
postgres: postgres
25+
strategy:
26+
matrix:
27+
Python27:
28+
python.version: "2.7"
29+
Python34:
30+
python.version: "3.4"
31+
Python35:
32+
python.version: "3.5"
33+
Python36:
34+
python.version: "3.6"
35+
Python37:
36+
python.version: "3.7"
37+
# Python 3.8 and PyPy will be soon added to the base VM image:
38+
# https://github.com/Microsoft/azure-pipelines-tasks/pull/9866
39+
Python38:
40+
python.version: "3.8-dev"
41+
PyPy2:
42+
python.version: "pypy2"
43+
44+
steps:
45+
- task: UsePythonVersion@0
46+
inputs:
47+
versionSpec: "$(python.version)"
48+
architecture: "x64"
49+
50+
- script: |
51+
set -eux
52+
docker ps -a
53+
docker images -a
54+
# FIXME: theoretically we can run psql commands from a docker container, but
55+
# name resolution is a bit tricky here
56+
sudo apt install -y postgresql-client
57+
psql -c 'create database travis_ci_test;' -U postgres -h localhost
58+
psql -c 'create database test_travis_ci_test;' -U postgres -h localhost
59+
displayName: "Create Postgres users"
60+
61+
- script: |
62+
set -eux
63+
python --version
64+
pip --version
65+
pip install tox
66+
pip install codecov
67+
sh scripts/download-semaphore.sh
68+
displayName: "Install dependencies"
69+
70+
- script: |
71+
set -eux
72+
coverage erase
73+
./scripts/runtox.sh '' --cov=sentry_sdk --cov-report= --cov-branch
74+
codecov --file .coverage*
75+
env:
76+
SENTRY_PYTHON_TEST_POSTGRES_USER: postgres
77+
SENTRY_PYTHON_TEST_POSTGRES_NAME: travis_ci_test
78+
AZURE_PYTHON_VERSION: "$(python.version)"
79+
displayName: "Run tests"

scripts/download-semaphore.sh

100644100755
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/bash
2-
32
set -e
43

5-
if [ "$TRAVIS" = true ] && [ -z "$GITHUB_API_TOKEN" ]; then
4+
if { [ "$TRAVIS" == "true" ] || [ "$TF_BUILD" == "True" ]; } && [ -z "$GITHUB_API_TOKEN" ]; then
65
echo "Not running on external pull request"
76
exit 0;
87
fi
@@ -20,11 +19,13 @@ echo "$output"
2019

2120
output="$(echo "$output" \
2221
| grep "$(uname -s)" \
22+
| grep -v "\.zip" \
2323
| grep "download" \
2424
| cut -d : -f 2,3 \
2525
| tr -d , \
2626
| tr -d \")"
2727

28+
echo "$output"
2829
echo "$output" | wget -i - -O $target
2930
[ -s $target ]
3031
chmod +x $target

scripts/runtox.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e
2+
set -ex
33

44
if [ -n "$TOXPATH" ]; then
55
true
@@ -12,10 +12,12 @@ fi
1212
# Usage: sh scripts/runtox.sh py3.7 <pytest-args>
1313
# Runs all environments with substring py3.7 and the given arguments for pytest
1414

15-
if [ -z "$1" ] && [ -n "$TRAVIS_PYTHON_VERSION" ]; then
16-
searchstring="$(echo py$TRAVIS_PYTHON_VERSION | sed -e 's/pypypy/pypy/g' -e 's/-dev//g')"
17-
else
15+
if [ -n "$1" ]; then
1816
searchstring="$1"
17+
elif [ -n "$TRAVIS_PYTHON_VERSION" ]; then
18+
searchstring="$(echo py$TRAVIS_PYTHON_VERSION | sed -e 's/pypypy/pypy/g' -e 's/-dev//g')"
19+
elif [ -n "$AZURE_PYTHON_VERSION" ]; then
20+
searchstring="$(echo py$AZURE_PYTHON_VERSION | sed -e 's/pypypy/pypy/g' -e 's/-dev//g')"
1921
fi
2022

2123
exec $TOXPATH -e $($TOXPATH -l | grep "$searchstring" | tr '\n' ',') -- "${@:2}"

tests/integrations/django/myapp/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ def process_response(self, request, response):
101101
"ENGINE": "django.db.backends.postgresql_psycopg2",
102102
"NAME": os.environ["SENTRY_PYTHON_TEST_POSTGRES_NAME"],
103103
"USER": os.environ["SENTRY_PYTHON_TEST_POSTGRES_USER"],
104+
"HOST": "localhost",
105+
"PORT": 5432,
104106
}
105107
except (ImportError, KeyError):
106108
pass

0 commit comments

Comments
 (0)
0