attrs/azure-pipelines.yml

139 lines
3.6 KiB
YAML

---
trigger:
- master
jobs:
- job: 'Test'
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Typing:
python.version: '3.7'
tox.env: typing
Lint:
python.version: '3.7'
tox.env: lint
py27:
python.version: '2.7'
tox.env: py27
py34:
python.version: '3.4'
tox.env: py34
py35:
python.version: '3.5'
tox.env: py35
py36:
python.version: '3.6'
tox.env: py36
py37:
python.version: '3.7'
tox.env: py37
py38:
python.version: '3.8'
tox.env: py38
pypy2:
python.version: 'pypy2'
tox.env: pypy
pypy3:
python.version: 'pypy3'
tox.env: pypy3
Docs:
python.version: '3.7'
tox.env: docs
PyPI-Description:
python.version: '3.7'
tox.env: pypi-description
Changelog:
python.version: '3.7'
tox.env: changelog
steps:
- task: UsePythonVersion@0
displayName: Get Python for Python tools.
inputs:
versionSpec: '3.7'
addToPath: false
name: pyTools
- script: $(pyTools.pythonLocation)/bin/pip install --upgrade tox
displayName: Install Python-based tools.
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
condition: not(in(variables['python.version'], '3.8'))
displayName: Use cached Python $(python.version) for tests.
- script: |
sudo add-apt-repository ppa:deadsnakes
sudo apt-get update
sudo apt-get install -y --no-install-recommends python$(python.version)-dev python$(python.version)-distutils
condition: in(variables['python.version'], '3.8')
displayName: Install Python $(python.version) from the deadsnakes PPA for tests.
- script: $(pyTools.pythonLocation)/bin/tox -e $(tox.env)
env:
TOX_AP_TEST_EXTRAS: azure-pipelines
displayName: run tox -e $(tox.env)
- script: |
if [ ! -f .coverage.* ]; then
echo No coverage data found.
exit 0
fi
# codecov shells out to "coverage" and avoiding 'sudo pip' allows for
# package caching.
PATH=$HOME/.local/bin:$PATH
case "$(python.version)" in
"pypy2") PY=pypy ;;
"pypy3") PY=pypy3 ;;
*) PY=python$(python.version) ;;
esac
# Python 3.8 needs an up-to-date pip.
if [ "$(python.version)" = "3.8" ]; then
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$PY get-pip.py --user
fi
$PY -m pip install --user coverage codecov
coverage combine
codecov
env:
CODECOV_TOKEN: $(codecov.token)
displayName: Report Coverage
condition: succeeded()
# Make sure contributors can use Windows.
- job: 'Windows'
pool:
vmImage: 'windows-latest'
strategy:
matrix:
py27:
python.version: '2.7'
py37:
python.version: '3.7'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
displayName: Use cached Python $(python.version) for tests.
- script: python -m pip install -e .[dev]
displayName: Install package in dev mode.
- script: python -m pytest
displayName: Run tests.