Comment tests #133
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
push: | |
paths-ignore: | |
- "*.md" | |
pull_request: | |
types: [opened, synchronize, reopened, edited] | |
paths-ignore: | |
- "*.md" | |
env: | |
MODULE_NAME: "spacy_transformers" | |
RUN_MYPY: "true" | |
jobs: | |
tests: | |
name: Test | |
if: github.repository_owner == 'explosion' | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python_version: ["3.12"] | |
include: | |
- os: macos-13 | |
python_version: "3.10" | |
- os: windows-latest | |
python_version: "3.11" | |
- os: ubuntu-latest | |
python_version: "3.12" | |
- os: macos-13 | |
python_version: "3.12" | |
- os: windows-latest | |
python_version: "3.12" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
- name: Configure Python version | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install -U build pip setuptools wheel | |
python -m pip install -r requirements.txt --force-reinstall | |
- name: Build sdist | |
run: | | |
python -m build --sdist | |
- name: Run mypy | |
if: env.RUN_MYPY == 'true' && matrix.python_version != '3.6' | |
shell: bash | |
run: | | |
python -m mypy $MODULE_NAME | |
- name: Delete source directory | |
shell: bash | |
run: | | |
rm -rf $MODULE_NAME | |
- name: Uninstall all packages | |
run: | | |
python -m pip freeze --exclude pywin32 --exclude torch | |
python -m pip freeze --exclude pywin32 --exclude torch > installed.txt | |
python -m pip uninstall -y -r installed.txt | |
- name: Install newest torch for python 3.7+ | |
if: matrix.python_version != '3.6' | |
run: | | |
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu --force-reinstall | |
- name: Install from sdist | |
shell: bash | |
run: | | |
SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1) | |
python -m pip install dist/$SDIST | |
- name: Run tests | |
shell: bash | |
run: | | |
python -m pip install -r requirements.txt --force-reinstall | |
# The version of pytorch being used here requires numpy v2, but because of the way we're doing the | |
# requirements installation here it's not being resolved that way. So just install numpy 1 here. | |
python -m pip install "numpy<2" | |
python -m pytest --pyargs $MODULE_NAME --cov=$MODULE_NAME | |
- name: Test backwards compatibility for v1.0 models | |
if: matrix.python_version == '3.9' | |
run: | | |
python -m pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_trf-3.1.0/en_core_web_trf-3.1.0-py3-none-any.whl --no-deps | |
python -c "import spacy; nlp = spacy.load('en_core_web_trf'); doc = nlp('test')" | |
- name: Test backwards compatibility for v1.1 models | |
if: matrix.python_version == '3.9' | |
run: | | |
python -m pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_trf-3.4.0/en_core_web_trf-3.4.0-py3-none-any.whl --no-deps | |
python -c "import spacy; nlp = spacy.load('en_core_web_trf'); doc = nlp('test')" |