Spaces:
Running
Running
| name: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| jobs: | |
| test: | |
| name: Tests (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.11'] | |
| env: | |
| # Skip the ~350 MB Hugging Face download in CI; detectors degrade gracefully. | |
| DOCFORENSICS_DISABLE_AI_MODEL: '1' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: Install system dependencies | |
| run: sudo apt-get update && sudo apt-get install -y tesseract-ocr | |
| - name: Install CPU PyTorch | |
| run: pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu | |
| - name: Install Python dependencies | |
| run: pip install -r requirements.txt | |
| - name: Run test suite | |
| run: pytest tests/ -v --maxfail=1 | |
| docker-build: | |
| name: Build Docker image | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build image (no push) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: false | |
| tags: docforensics:ci | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |