pyqtgraph/azure-test-template.yml

170 lines
5.3 KiB
YAML
Raw Normal View History

# Azure Pipelines CI job template for PyDM Tests
# https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/anaconda?view=azure-devops
parameters:
name: ''
vmImage: ''
jobs:
- job: ${{ parameters.name }}
pool:
vmImage: ${{ parameters.vmImage }}
strategy:
matrix:
Python27-Qt4:
python.version: '2.7'
qt.bindings: "pyqt=4"
2019-05-29 05:42:01 +00:00
install.method: "conda"
Python27-PySide:
python.version: '2.7'
qt.bindings: "pyside"
install.method: "conda"
Python37-PyQt-5.9:
python.version: "3.7"
qt.bindings: "pyqt"
install.method: "conda"
Python37-PySide2-5.6:
python.version: "3.7"
qt.bindings: "pyside2"
install.method: "conda"
2019-05-29 05:42:01 +00:00
Python37-PyQt-5.12:
python.version: '3.7'
qt.bindings: "PyQt5"
install.method: "pip"
2019-05-29 05:42:01 +00:00
Python37-PySide2-5.12:
python.version: "3.7"
qt.bindings: "PySide2"
install.method: "pip"
steps:
2019-05-29 05:42:01 +00:00
- task: ScreenResolutionUtility@1
inputs:
displaySettings: 'specific'
width: '1920'
height: '1080'
condition: eq(variables['agent.os'], 'Windows_NT' )
- task: UsePythonVersion@0
inputs:
versionSpec: $(python.version)
condition: eq(variables['install.method'], 'pip')
- bash: |
2019-05-29 05:42:01 +00:00
if [ $(agent.os) == 'Linux' ]
then
echo '##vso[task.prependpath]/usr/share/miniconda/bin'
elif [ $(agent.os) == 'Darwin' ]
then
echo '##vso[task.prependpath]$CONDA/bin'
sudo install -d -m 0777 /usr/local/miniconda/envs
elif [ $(agent.os) == 'Windows_NT' ]
then
echo "##vso[task.prependpath]$env:CONDA\Scripts"
else
echo 'Just what OS are you using?'
fi
displayName: 'Add Conda to $PATH'
condition: eq(variables['install.method'], 'conda' )
2019-05-29 05:42:01 +00:00
- task: CondaEnvironment@0
displayName: 'Create Conda Environment'
condition: eq(variables['install.method'], 'conda')
inputs:
environmentName: 'test-environment-$(python.version)'
packageSpecs: 'python=$(python.version)'
- bash: |
2019-05-29 05:42:01 +00:00
if [ $(install.method) == "conda" ]
then
source activate test-environment-$(python.version)
conda install -c conda-forge $(qt.bindings) numpy scipy pyopengl pytest flake8 six coverage --yes
else
pip install $(qt.bindings) numpy scipy pyopengl pytest flake8 six coverage
fi
pip install pytest-xdist pytest-cov pytest-faulthandler
displayName: "Install Dependencies"
- bash: |
2019-05-29 05:42:01 +00:00
if [ $(install.method) == "conda" ]
then
source activate test-environment-$(python.version)
fi
pip install setuptools wheel
python setup.py bdist_wheel
pip install dist/*.whl
displayName: 'Build Wheel and Install'
- task: CopyFiles@2
inputs:
contents: 'dist/**'
targetFolder: $(Build.ArtifactStagingDirectory)
cleanTargetFolder: true # Optional
displayName: "Copy Distributions To Artifacts"
- task: PublishBuildArtifacts@1
displayName: 'Publish Distributions'
condition: always()
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)/dist
artifactName: Distributions
- bash: |
2019-05-29 05:42:01 +00:00
sudo apt-get install -y libxkbcommon-x11-0 # herbstluftwm
if [ $(install.method) == "conda" ]
then
source activate test-environment-$(python.version)
fi
pip install pytest-xvfb
displayName: "Linux Virtual Display Setup"
condition: eq(variables['agent.os'], 'Linux' )
- bash: |
2019-05-29 05:42:01 +00:00
if [ $(install.method) == "conda" ]
then
source activate test-environment-$(python.version)
fi
echo python location: `which python`
echo python version: `python --version`
2019-05-29 05:42:01 +00:00
echo pytest location: `which pytest`
echo installed packages
2019-05-29 05:42:01 +00:00
pip list
echo pyqtgraph system info
python -c "import pyqtgraph as pg; pg.systemInfo()"
2019-05-29 05:42:01 +00:00
displayName: 'Debug Info'
continueOnError: false
2019-05-29 05:42:01 +00:00
- bash: |
if [ $(install.method) == "conda" ]
then
source activate test-environment-$(python.version)
fi
mkdir -p "$SCREENSHOT_DIR"
# echo "If Screenshots are generated, they may be downloaded from:"
# echo "https://dev.azure.com/pyqtgraph/pyqtgraph/_apis/build/builds/$(Build.BuildId)/artifacts?artifactName=Screenshots&api-version=5.0"
python -m pytest -sv \
--junitxml=junit/test-results.xml \
--cov pyqtgraph --cov-report=xml --cov-report=html
displayName: 'Unit tests'
env:
2019-05-29 05:42:01 +00:00
AZURE: 1
SCREENSHOT_DIR: $(Build.ArtifactStagingDirectory)/screenshots
- task: PublishBuildArtifacts@1
displayName: 'Publish Screenshots'
condition: failed()
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)/screenshots
artifactName: Screenshots
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Test Results for $(agent.os) - $(python.version) - $(qt.bindings) - $(install.method)'
publishRunAttachments: true
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'