Skip to content

Fix compilation with recent Cython 3.x versions #102

Fix compilation with recent Cython 3.x versions

Fix compilation with recent Cython 3.x versions #102

Workflow file for this run

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.11"]
include:
- os: macos-latest
python_version: "3.7"
- os: windows-latest
python_version: "3.8"
- os: ubuntu-latest
python_version: "3.9"
- os: macos-latest
python_version: "3.10"
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 }}
architecture: x64
- name: Install oldest supported torch for python 3.6
if: matrix.python_version == '3.6'
run: |
python -m pip install "torch==1.8.1+cpu" -f https://download.pytorch.org/whl/torch_stable.html
- name: Install dependencies
run: |
python -m pip install -U build pip setuptools wheel
python -m pip install -r requirements.txt
- 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 oldest supported torch for python 3.6
if: matrix.python_version == '3.6'
run: |
python -m pip install "torch==1.8.1+cpu" -f https://download.pytorch.org/whl/torch_stable.html
- 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
- 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
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')"