|
| 1 | +parameters: |
| 2 | + python_version: '' |
| 3 | + architecture: '' |
| 4 | + prefix: '' |
| 5 | + gpu: false |
| 6 | + num_build_jobs: 1 |
| 7 | + |
| 8 | +steps: |
| 9 | + - task: UsePythonVersion@0 |
| 10 | + inputs: |
| 11 | + versionSpec: ${{ parameters.python_version }} |
| 12 | + architecture: ${{ parameters.architecture }} |
| 13 | + |
| 14 | + - bash: | |
| 15 | + echo "##vso[task.setvariable variable=python_version]${{ parameters.python_version }}" |
| 16 | + displayName: 'Set variables' |
| 17 | +
|
| 18 | + - script: | |
| 19 | + ${{ parameters.prefix }} python -m pip install -U pip setuptools |
| 20 | + ${{ parameters.prefix }} python -m pip install -U -r requirements.txt |
| 21 | + displayName: "Install dependencies" |
| 22 | +
|
| 23 | + - script: | |
| 24 | + ${{ parameters.prefix }} python setup.py build_ext --inplace -j ${{ parameters.num_build_jobs }} |
| 25 | + ${{ parameters.prefix }} python setup.py sdist --formats=gztar |
| 26 | + displayName: "Compile and build sdist" |
| 27 | +
|
| 28 | + - script: python -m mypy spacy |
| 29 | + displayName: 'Run mypy' |
| 30 | + condition: ne(variables['python_version'], '3.10') |
| 31 | + |
| 32 | + - task: DeleteFiles@1 |
| 33 | + inputs: |
| 34 | + contents: "spacy" |
| 35 | + displayName: "Delete source directory" |
| 36 | + |
| 37 | + - script: | |
| 38 | + ${{ parameters.prefix }} python -m pip freeze --exclude torch --exclude cupy-cuda110 > installed.txt |
| 39 | + ${{ parameters.prefix }} python -m pip uninstall -y -r installed.txt |
| 40 | + displayName: "Uninstall all packages" |
| 41 | +
|
| 42 | + - bash: | |
| 43 | + ${{ parameters.prefix }} SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1) |
| 44 | + ${{ parameters.prefix }} SPACY_NUM_BUILD_JOBS=2 python -m pip install dist/$SDIST |
| 45 | + displayName: "Install from sdist" |
| 46 | +
|
| 47 | + - script: | |
| 48 | + ${{ parameters.prefix }} python -m pip install -U -r requirements.txt |
| 49 | + displayName: "Install test requirements" |
| 50 | +
|
| 51 | + - script: | |
| 52 | + ${{ parameters.prefix }} python -m pip install -U cupy-cuda110 -f https://github.com/cupy/cupy/releases/v9.0.0 |
| 53 | + ${{ parameters.prefix }} python -m pip install "torch==1.7.1+cu110" -f https://download.pytorch.org/whl/torch_stable.html |
| 54 | + displayName: "Install GPU requirements" |
| 55 | + condition: eq(${{ parameters.gpu }}, true) |
| 56 | +
|
| 57 | + - script: | |
| 58 | + ${{ parameters.prefix }} python -m pytest --pyargs spacy -W error |
| 59 | + displayName: "Run CPU tests" |
| 60 | + condition: eq(${{ parameters.gpu }}, false) |
| 61 | +
|
| 62 | + - script: | |
| 63 | + ${{ parameters.prefix }} python -m pytest --pyargs spacy -W error -p spacy.tests.enable_gpu |
| 64 | + displayName: "Run GPU tests" |
| 65 | + condition: eq(${{ parameters.gpu }}, true) |
| 66 | +
|
| 67 | + - script: | |
| 68 | + python -m spacy download ca_core_news_sm |
| 69 | + python -m spacy download ca_core_news_md |
| 70 | + python -c "import spacy; nlp=spacy.load('ca_core_news_sm'); doc=nlp('test')" |
| 71 | + displayName: 'Test download CLI' |
| 72 | + condition: eq(variables['python_version'], '3.8') |
| 73 | +
|
| 74 | + - script: | |
| 75 | + python -m spacy convert extra/example_data/ner_example_data/ner-token-per-line-conll2003.json . |
| 76 | + displayName: 'Test convert CLI' |
| 77 | + condition: eq(variables['python_version'], '3.8') |
| 78 | +
|
| 79 | + - script: | |
| 80 | + python -m spacy init config -p ner -l ca ner.cfg |
| 81 | + python -m spacy debug config ner.cfg --paths.train ner-token-per-line-conll2003.spacy --paths.dev ner-token-per-line-conll2003.spacy |
| 82 | + displayName: 'Test debug config CLI' |
| 83 | + condition: eq(variables['python_version'], '3.8') |
| 84 | +
|
| 85 | + - script: | |
| 86 | + # will have errors due to sparse data, check for summary in output |
| 87 | + python -m spacy debug data ner.cfg --paths.train ner-token-per-line-conll2003.spacy --paths.dev ner-token-per-line-conll2003.spacy | grep -q Summary |
| 88 | + displayName: 'Test debug data CLI' |
| 89 | + condition: eq(variables['python_version'], '3.8') |
| 90 | +
|
| 91 | + - script: | |
| 92 | + python -m spacy train ner.cfg --paths.train ner-token-per-line-conll2003.spacy --paths.dev ner-token-per-line-conll2003.spacy --training.max_steps 10 --gpu-id -1 |
| 93 | + displayName: 'Test train CLI' |
| 94 | + condition: eq(variables['python_version'], '3.8') |
| 95 | +
|
| 96 | + - script: | |
| 97 | + python -c "import spacy; config = spacy.util.load_config('ner.cfg'); config['components']['ner'] = {'source': 'ca_core_news_sm'}; config.to_disk('ner_source_sm.cfg')" |
| 98 | + PYTHONWARNINGS="error,ignore::DeprecationWarning" python -m spacy assemble ner_source_sm.cfg output_dir |
| 99 | + displayName: 'Test assemble CLI' |
| 100 | + condition: eq(variables['python_version'], '3.8') |
| 101 | +
|
| 102 | + - script: | |
| 103 | + python -c "import spacy; config = spacy.util.load_config('ner.cfg'); config['components']['ner'] = {'source': 'ca_core_news_md'}; config.to_disk('ner_source_md.cfg')" |
| 104 | + python -m spacy assemble ner_source_md.cfg output_dir 2>&1 | grep -q W113 |
| 105 | + displayName: 'Test assemble CLI vectors warning' |
| 106 | + condition: eq(variables['python_version'], '3.8') |
| 107 | +
|
| 108 | + - script: | |
| 109 | + python .github/validate_universe_json.py website/meta/universe.json |
| 110 | + displayName: 'Test website/meta/universe.json' |
| 111 | + condition: eq(variables['python_version'], '3.8') |
| 112 | +
|
| 113 | + - script: | |
| 114 | + ${{ parameters.prefix }} python -m pip install --pre thinc-apple-ops |
| 115 | + ${{ parameters.prefix }} python -m pytest --pyargs spacy |
| 116 | + displayName: "Run CPU tests with thinc-apple-ops" |
| 117 | + condition: and(startsWith(variables['imageName'], 'macos'), eq(variables['python.version'], '3.10')) |
0 commit comments