Skip to content

fix: remove runtime dependency installation #220

fix: remove runtime dependency installation

fix: remove runtime dependency installation #220

Workflow file for this run

name: CI
on:
push:
branches: [main, dev, "feature/*", "fix/*", "chore/*", "cleanup/*"]
pull_request:
branches: [main, dev]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
install-profile: ["core", "nlp", "nlp-advanced"]
exclude:
# v4.4.0 claims Python 3.13 support for core + CLI first.
# Optional heavyweight profiles remain validated separately before
# we advertise Python 3.13 support for them.
- python-version: "3.13"
install-profile: "nlp"
- python-version: "3.13"
install-profile: "nlp-advanced"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install dependencies (core)
if: matrix.install-profile == 'core'
run: |
pip install -e ".[test,cli]" -r requirements-test.txt
- name: Install dependencies (nlp)
if: matrix.install-profile == 'nlp'
run: |
pip install -e ".[test,cli,nlp]" -r requirements-test.txt
python -m spacy download en_core_web_lg
- name: Install dependencies (nlp-advanced)
if: matrix.install-profile == 'nlp-advanced'
run: |
pip install -e ".[test,cli,nlp,nlp-advanced]" -r requirements-test.txt
python -m spacy download en_core_web_lg
datafog download-model urchade/gliner_multi_pii-v1 --engine gliner
- name: Run tests (core)
if: matrix.install-profile == 'core'
run: |
pytest tests/ \
-m "not slow" \
--ignore=tests/test_gliner_annotator.py \
--ignore=tests/test_image_service.py \
--ignore=tests/test_ocr_integration.py \
--ignore=tests/test_spark_integration.py \
--ignore=tests/test_text_service_integration.py \
--cov=datafog \
--cov-branch \
--cov-report=xml \
--cov-report=term-missing
- name: Run tests (nlp)
if: matrix.install-profile == 'nlp'
run: |
pytest tests/ \
-m "not slow" \
--ignore=tests/test_gliner_annotator.py \
--ignore=tests/test_image_service.py \
--ignore=tests/test_ocr_integration.py \
--ignore=tests/test_spark_integration.py \
--cov=datafog \
--cov-branch \
--cov-report=xml \
--cov-report=term-missing
- name: Run tests (nlp-advanced)
if: matrix.install-profile == 'nlp-advanced'
run: |
pytest tests/ \
-m "not slow" \
--ignore=tests/test_detection_accuracy.py \
--ignore=tests/test_image_service.py \
--ignore=tests/test_ocr_integration.py \
--ignore=tests/test_spark_integration.py \
--cov=datafog \
--cov-branch \
--cov-report=xml \
--cov-report=term-missing
- name: Run detection accuracy corpus
if: matrix.python-version == '3.11' && matrix.install-profile == 'nlp-advanced'
run: |
pytest tests/test_detection_accuracy.py \
-v --tb=short \
--cov=datafog \
--cov-branch \
--cov-append \
--cov-report=xml \
--cov-report=term-missing
- name: Enforce coverage thresholds
if: matrix.python-version == '3.11' && matrix.install-profile == 'nlp-advanced'
run: |
python - <<'PY'
import sys
import xml.etree.ElementTree as ET
root = ET.parse("coverage.xml").getroot()
line_rate = float(root.attrib.get("line-rate", 0.0))
branch_rate = float(root.attrib.get("branch-rate", 0.0))
line_pct = line_rate * 100
branch_pct = branch_rate * 100
print(f"Line coverage: {line_pct:.2f}%")
print(f"Branch coverage: {branch_pct:.2f}%")
if line_pct < 85:
print("Line coverage below 85% threshold.")
sys.exit(1)
if branch_pct < 75:
print("Branch coverage below 75% threshold.")
sys.exit(1)
PY
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
flags: ${{ matrix.install-profile }}-py${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
wheel-size:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel
- name: Build wheel
run: python -m build --wheel
- name: Check wheel size
run: python scripts/check_wheel_size.py