pytest-azurepipelines/azure-pipelines.yml

179 строки
5.0 KiB
YAML

trigger:
- master
name: $(Year:yy)$(DayOfYear)$(Rev:r)
variables:
majorVer: '1.0.0'
stages:
- stage: Unit_Test
jobs:
- job: 'Test_Linux'
pool:
vmImage: 'Ubuntu-16.04'
strategy:
matrix:
Python37_Pytest_50:
python.version: '3.7'
pytest_version: '>=5.0.0'
Python38_Pytest_50:
python.version: '3.8'
pytest_version: '>=5.0.0'
maxParallel: 8
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
- script: |
echo "Installing Pytest - $PYTEST_VERSION"
python -m pip install --upgrade pip
pip install pytest$PYTEST_VERSION
env:
PYTEST_VERSION: $(pytest_version)
- script: "pip install -e ."
displayName: 'Install package'
- script: |
pytest tests -v -m "not testfail"
displayName: 'pytest with defaults - passes'
- script: |
pip install pytest-cov
pytest tests -v -m "not testfail" --cov --cov-report=html
displayName: 'pytest with coverage plugin'
- script: |
pip install pytest-nunit
pytest tests -v -m "not testfail" --cov --cov-report=html
displayName: 'pytest with nunit plugin'
- script: |
pytest tests -v -m "testfail"
displayName: 'pytest - failures'
continueOnError: true
- script: |
pytest tests -v -m "not testfail" --doctest-modules
displayName: 'pytest with doctest modules flag - doctest fails'
continueOnError: true
- job: 'Test_Windows'
pool:
vmImage: 'vs2017-win2016'
strategy:
matrix:
Python35:
python.version: '3.5'
Python36:
python.version: '3.6'
Python37:
python.version: '3.7'
maxParallel: 5
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
- script: |
python -m pip install --upgrade pip
pip install -e .
displayName: 'Install dependencies'
- script: |
pytest tests -v -m "not testfail"
displayName: 'pytest with defaults - passes'
- script: |
pip install pytest-cov
pytest tests -v -m "not testfail" --no-coverage-upload --cov --cov-report=html
displayName: 'pytest with --no-coverage-upload'
- script: |
pip install pytest-cov
pytest tests -v -m "not testfail" --cov --cov-report=html
displayName: 'pytest with coverage plugin'
- script: |
pytest tests -v -m "not testfail" --cov --cov-report=html --force-xunit
displayName: 'pytest with forced Xunit output'
- script: |
pytest tests -v -m "testfail"
displayName: 'pytest - failures'
continueOnError: true
- job: 'Test_Docker'
pool:
vmImage: 'Ubuntu-16.04'
steps:
- script: ./.azure-pipelines/docker.sh
- stage: Integration_Test
jobs:
- job: 'Test_Packages'
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
architecture: 'x64'
- script: 'python -m pip install -U pip setuptools wheel twine'
displayName: "Install packaging tools"
- script: |
echo "Building rev $BUILD_VERSION"
python setup.py sdist bdist_wheel
displayName: "Build package"
env:
BUILD_VERSION: $(majorVer).dev$(Build.BuildNumber)
- task: TwineAuthenticate@0
inputs:
artifactFeeds: 'test_feed'
- script: 'python -m twine upload -r test_feed --config-file $(PYPIRC_PATH) dist/*.whl'
displayName: "Upload package"
- job: "Test_suite_Jinja2"
dependsOn: "Test_Packages"
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
architecture: 'x64'
- script: 'python -m pip install -U pip'
displayName: "Update pip"
- script: 'python -m pip install MarkupSafe>=0.23'
displayName: 'Install dependencies'
- task: PipAuthenticate@0
displayName: Authenticate with artifact feed
inputs:
artifactFeeds: "test_feed"
- script: "pip install --pre pytest-azurepipelines==$BUILD_VERSION"
displayName: "Install pytest-azurepipelines package"
env:
BUILD_VERSION: $(majorVer).dev$(Build.BuildNumber)
- script: |
wget https://github.com/pallets/jinja/archive/c4813e51ad664bca17773517462610c1578a6850.zip
unzip c4813e51ad664bca17773517462610c1578a6850.zip -d jinja2
cd jinja2/jinja-c4813e51ad664bca17773517462610c1578a6850/
python -m pytest tests --test-run-title="Jinja2 test suite"
displayName: "Test jinja2 pinned revision"