Skip to content

Fix CI

Fix CI #361

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: "weasel"
RUN_MYPY: "true"
jobs:
validate:
name: Validate
if: github.repository_owner == 'explosion'
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Configure Python version
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Set PY variable
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit
run: |
pip install 'pre-commit>=3.2.0,<4.0.0'
pre-commit install
- name: Run pre-commit
run: SKIP=no-commit-to-branch pre-commit run --all-files
tests:
name: Test
needs: Validate
if: github.repository_owner == 'explosion'
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python_version: ["3.12"]
include:
- os: ubuntu-latest
python_version: "3.7"
- os: windows-latest
python_version: "3.8"
- os: macos-latest
python_version: "3.9"
- os: macos-latest
python_version: "3.10"
- os: windows-latest
python_version: "3.11"
runs-on: ${{ matrix.os }}
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Configure Python version
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Build sdist
run: |
python -m pip install -U build pip setuptools
python -m pip install -U -r requirements.txt
python -m build --sdist
- name: Delete source directory
shell: bash
run: |
rm -rf $MODULE_NAME
- name: Uninstall all packages
run: |
python -m pip freeze > installed.txt
python -m pip uninstall -y -r installed.txt
- 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: Test import
shell: bash
run: |
python -c "import $MODULE_NAME" -Werror
- name: Test CLI
run: |
python -m weasel --help
- name: Install test requirements
run: |
python -m pip install -U -r requirements.txt
- name: Run tests
shell: bash
run: |
python -m pytest --pyargs $MODULE_NAME -Werror
- name: Test 'spacy project' CLI help/info messages
shell: bash
run: |
python -m pip install spacy
python -m spacy project clone pipelines/ner_demo | grep -q "spacy project assets"
cd ner_demo
python -m spacy project run --help | grep -q "spacy project run"