feat: add GLM-OCR as primary OCR backend, pytesseract as fallback (#260) #762
This file contains hidden or 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: test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install dependencies | |
| run: uv sync --extra dev --no-sources | |
| - name: Guard against bare heavy imports in tests | |
| run: | | |
| # Fail CI if any test file has a bare top-level import of a heavy package. | |
| # Heavy packages must use pytest.importorskip() at module level. | |
| if grep -rn '^import \(torch\|transformers\|trl\|datasets\|unsloth\|accelerate\|peft\|bitsandbytes\)\b' tests/ || \ | |
| grep -rn '^from \(torch\|transformers\|trl\|datasets\|unsloth\|accelerate\|peft\|bitsandbytes\|openadapt_ml\)\b' tests/; then | |
| echo "" | |
| echo "ERROR: Found bare top-level import of heavy package in tests." | |
| echo "Use pytest.importorskip() instead. Example:" | |
| echo ' torch = pytest.importorskip("torch")' | |
| echo ' openadapt_ml = pytest.importorskip("openadapt_ml")' | |
| exit 1 | |
| fi | |
| - name: Run tests | |
| run: | | |
| uv run --no-sources pytest tests/ -q \ | |
| -m "not heavy and not gpu and not vm" \ | |
| -k "not (test_demo_format_and_persistence or test_synthetic_demos)" |