|
| 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 | +jobs: |
| 10 | + |
| 11 | +- job: 'Test' |
| 12 | + pool: |
| 13 | + vmImage: 'Ubuntu-16.04' |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + Python27: |
| 17 | + python.version: '2.7' |
| 18 | + # Python35: |
| 19 | + # python.version: '3.5' |
| 20 | + Python36: |
| 21 | + python.version: '3.6' |
| 22 | + maxParallel: 3 |
| 23 | + |
| 24 | + steps: |
| 25 | + - task: CondaEnvironment@1 |
| 26 | + inputs: |
| 27 | + createCustomEnvironment: true |
| 28 | + environmentName: 'py$(python.version)' |
| 29 | + packageSpecs: 'python=$(python.version)' |
| 30 | + |
| 31 | + - script: | |
| 32 | + python -m pip install --upgrade pip |
| 33 | + conda config --set always_yes yes --set changeps1 no |
| 34 | + conda install -c conda-forge protobuf |
| 35 | + conda install -c conda-forge numpy |
| 36 | + conda install -c conda-forge cmake |
| 37 | + conda install -c conda-forge openmpi |
| 38 | + conda install -c conda-forge tensorflow |
| 39 | + pip install -r requirements.txt |
| 40 | + pip install -r requirements-dev.txt |
| 41 | + test '$(python.version)' != '2.7' && pip install onnxruntime |
| 42 | + pip install pytest |
| 43 | + git clone --recursive https://github.com/cjlin1/libsvm libsvm |
| 44 | + cd libsvm |
| 45 | + make lib |
| 46 | + displayName: 'Install dependencies' |
| 47 | +
|
| 48 | + - script: | |
| 49 | + export PYTHONPATH=$PYTHONPATH:libsvm/python |
| 50 | + python -c "import svmutil" |
| 51 | + test '$(python.version)' != '2.7' && python -c "import onnxruntime" |
| 52 | + pytest tests --doctest-modules --junitxml=junit/test-results.xml |
| 53 | + displayName: 'pytest' |
| 54 | +
|
| 55 | + - task: PublishTestResults@2 |
| 56 | + inputs: |
| 57 | + testResultsFiles: '**/test-results.xml' |
| 58 | + testRunTitle: 'Python $(python.version)' |
| 59 | + condition: succeededOrFailed() |
0 commit comments