|
| 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: 'vs2017-win2016' |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + Python36-nightly: |
| 17 | + python.version: '3.6' |
| 18 | + ONNX_PATH: onnx==1.4.1 |
| 19 | + ONNXRT_PATH: -i https://test.pypi.org/simple/ ort-nightly |
| 20 | + COREML_PATH: git+https://github.com/apple/coremltools |
| 21 | + maxParallel: 3 |
| 22 | + |
| 23 | + steps: |
| 24 | + - task: UsePythonVersion@0 |
| 25 | + inputs: |
| 26 | + versionSpec: '$(python.version)' |
| 27 | + architecture: 'x64' |
| 28 | + |
| 29 | + - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" |
| 30 | + displayName: Add conda to PATH |
| 31 | + |
| 32 | + - script: conda create --yes --quiet --name py$(python.version) -c conda-forge python=$(python.version) numpy protobuf |
| 33 | + displayName: Create Anaconda environment |
| 34 | + |
| 35 | + - script: | |
| 36 | + call activate py$(python.version) |
| 37 | + python -m pip install --upgrade pip numpy |
| 38 | + echo Test numpy installation... && python -c "import numpy" |
| 39 | + pip install %COREML_PATH% %ONNX_PATH% |
| 40 | + cd onnxutils |
| 41 | + pip install -e . |
| 42 | + echo Test onnxconverter-common installation... && python -c "import onnxconverter_common" |
| 43 | + cd .. |
| 44 | + pip install -r requirements-dev.txt |
| 45 | + pip install %ONNXRT_PATH% |
| 46 | + echo Test onnxruntime installation... && python -c "import onnxruntime" |
| 47 | + REM install libsvm from github |
| 48 | + git clone --recursive https://github.com/cjlin1/libsvm libsvm |
| 49 | + copy libsvm\windows\*.dll libsvm\python |
| 50 | + set PYTHONPATH=libsvm\python;%PYTHONPATH% |
| 51 | + dir libsvm\python |
| 52 | + echo Test libsvm installation... && python -c "import svmutil" |
| 53 | + displayName: 'Install dependencies' |
| 54 | +
|
| 55 | + - script: | |
| 56 | + call activate py$(python.version) |
| 57 | + set PYTHONPATH=libsvm\python;%PYTHONPATH% |
| 58 | + pip install -e . |
| 59 | + pytest tests --doctest-modules --junitxml=junit/test-results.xml |
| 60 | + displayName: 'pytest - onnxmltools' |
| 61 | +
|
| 62 | + - script: | |
| 63 | + call activate py$(python.version) |
| 64 | + set PYTHONPATH=libsvm\python;%PYTHONPATH% |
| 65 | + pytest onnxutils/tests --doctest-modules --junitxml=junit/test-results-onnxutils.xml |
| 66 | + displayName: 'pytest - onnxutils' |
| 67 | +
|
| 68 | + - task: PublishTestResults@2 |
| 69 | + inputs: |
| 70 | + testResultsFiles: '**/test-results.xml' |
| 71 | + testRunTitle: 'Python $(python.version)' |
| 72 | + condition: succeededOrFailed() |
0 commit comments