|
| 1 | +name: medcat-scripts - Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + paths: |
| 8 | + - 'medcat-scripts/**' |
| 9 | + - '.github/workflows/medcat-scripts**' |
| 10 | + |
| 11 | +defaults: |
| 12 | + run: |
| 13 | + working-directory: ./medcat-scripts |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: read |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + python-version: [ '3.10', '3.11', '3.12', '3.13' ] |
| 23 | + max-parallel: 4 |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v5 |
| 26 | + - name: Install uv for Python ${{ matrix.python-version }} |
| 27 | + uses: astral-sh/setup-uv@v6 |
| 28 | + with: |
| 29 | + python-version: ${{ matrix.python-version }} |
| 30 | + enable-cache: true |
| 31 | + - name: Install the project |
| 32 | + run: | |
| 33 | + uv venv .venv |
| 34 | + source .venv/bin/activate |
| 35 | + uv run python -m ensurepip |
| 36 | + uv pip install -r requirements.txt |
| 37 | + uv pip install -r requirements-dev.txt |
| 38 | + # reinstall MedCAT from local to test against changes in core lib |
| 39 | + uv pip install "../medcat-v2[spacy,deid,meta-cat,rel-cat]" |
| 40 | + - name: Check types |
| 41 | + run: | |
| 42 | + # NOTE: Only testing against .py files in this folder |
| 43 | + uv run python -m mypy `git ls-tree --full-tree --name-only -r HEAD | grep ".py$" | grep "^medcat-scripts" | grep -v "tests/" | sed 's|^medcat-scripts/||'` --explicit-package-bases --follow-imports=normal |
| 44 | +
|
| 45 | + - name: Setup for notebook tests |
| 46 | + run: | |
| 47 | + # NOTE: this will make sure there's something in the den to work with below |
| 48 | + uv run python tests/setup_for_tests.py |
| 49 | +
|
| 50 | + - name: Install IPython kernel |
| 51 | + run: | |
| 52 | + uv run python -m ipykernel install --name smoketests --user |
| 53 | +
|
| 54 | + - name: Run tests |
| 55 | + run: | |
| 56 | + uv run pytest tests |
| 57 | +
|
| 58 | + - name: Test notebooks |
| 59 | + run: | |
| 60 | + uv run pytest --collect-only --nbmake **/*.ipynb |
| 61 | + uv run pytest --nbmake -n=auto --nbmake-kernel=smoketests --nbmake-timeout=1800 **/*.ipynb |
0 commit comments