|
| 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" |
0 commit comments