2021-04-22 15:58:29 +03:00
|
|
|
parameters:
|
|
|
|
python_version: ''
|
|
|
|
architecture: ''
|
|
|
|
prefix: ''
|
|
|
|
gpu: false
|
|
|
|
num_build_jobs: 1
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- task: UsePythonVersion@0
|
|
|
|
inputs:
|
|
|
|
versionSpec: ${{ parameters.python_version }}
|
|
|
|
architecture: ${{ parameters.architecture }}
|
|
|
|
|
2021-06-07 15:46:07 +03:00
|
|
|
- bash: |
|
|
|
|
echo "##vso[task.setvariable variable=python_version]${{ parameters.python_version }}"
|
|
|
|
displayName: 'Set variables'
|
|
|
|
|
2021-04-22 15:58:29 +03:00
|
|
|
- script: |
|
|
|
|
${{ parameters.prefix }} python -m pip install -U pip setuptools
|
|
|
|
${{ parameters.prefix }} python -m pip install -U -r requirements.txt
|
|
|
|
displayName: "Install dependencies"
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
${{ parameters.prefix }} python setup.py build_ext --inplace -j ${{ parameters.num_build_jobs }}
|
|
|
|
${{ parameters.prefix }} python setup.py sdist --formats=gztar
|
|
|
|
displayName: "Compile and build sdist"
|
|
|
|
|
|
|
|
- task: DeleteFiles@1
|
|
|
|
inputs:
|
|
|
|
contents: "spacy"
|
|
|
|
displayName: "Delete source directory"
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
${{ parameters.prefix }} python -m pip freeze --exclude torch --exclude cupy-cuda110 > installed.txt
|
|
|
|
${{ parameters.prefix }} python -m pip uninstall -y -r installed.txt
|
|
|
|
displayName: "Uninstall all packages"
|
|
|
|
|
|
|
|
- bash: |
|
|
|
|
${{ parameters.prefix }} SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1)
|
|
|
|
${{ parameters.prefix }} python -m pip install dist/$SDIST
|
|
|
|
displayName: "Install from sdist"
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
${{ parameters.prefix }} python -m pip install -U -r requirements.txt
|
|
|
|
displayName: "Install test requirements"
|
|
|
|
|
|
|
|
- script: |
|
2021-04-28 11:18:24 +03:00
|
|
|
${{ parameters.prefix }} python -m pip install -U cupy-cuda110 -f https://github.com/cupy/cupy/releases/v9.0.0
|
2021-04-22 15:58:29 +03:00
|
|
|
${{ parameters.prefix }} python -m pip install "torch==1.7.1+cu110" -f https://download.pytorch.org/whl/torch_stable.html
|
|
|
|
displayName: "Install GPU requirements"
|
|
|
|
condition: eq(${{ parameters.gpu }}, true)
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
${{ parameters.prefix }} python -m pytest --pyargs spacy
|
|
|
|
displayName: "Run CPU tests"
|
|
|
|
condition: eq(${{ parameters.gpu }}, false)
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
${{ parameters.prefix }} python -m pytest --pyargs spacy -p spacy.tests.enable_gpu
|
|
|
|
displayName: "Run GPU tests"
|
|
|
|
condition: eq(${{ parameters.gpu }}, true)
|
2021-06-07 15:46:07 +03:00
|
|
|
|
2021-06-24 10:26:30 +03:00
|
|
|
- script: |
|
|
|
|
python -m spacy download ca_core_news_sm
|
|
|
|
python -c "import spacy; nlp=spacy.load('ca_core_news_sm'); doc=nlp('test')"
|
|
|
|
displayName: 'Test download CLI'
|
|
|
|
condition: eq(variables['python_version'], '3.8')
|