|
1 | 1 | on: |
2 | 2 | workflow_call: |
| 3 | + inputs: |
| 4 | + push_coverage: |
| 5 | + type: boolean |
| 6 | + description: "If true, the coverage results are pushed to codecov.io." |
| 7 | + default: true |
| 8 | + secrets: |
| 9 | + CODECOV_TOKEN: |
| 10 | + required: false |
3 | 11 |
|
4 | 12 | env: |
5 | | - RUN_IN_CI: "1" |
| 13 | + HF_HUB_DOWNLOAD_TIMEOUT: "60" |
| 14 | + HF_HUB_ETAG_TIMEOUT: "60" |
6 | 15 |
|
7 | 16 | jobs: |
8 | 17 | run-checks: |
9 | 18 | runs-on: ubuntu-latest |
10 | 19 | strategy: |
11 | 20 | matrix: |
12 | | - python-version: ['3.10', '3.11', '3.12'] |
| 21 | + python-version: ['3.10', '3.11', '3.12', '3.13'] |
13 | 22 | steps: |
14 | 23 | - uses: actions/checkout@v4 |
15 | | - - name: Install tesseract |
16 | | - run: sudo apt-get update && sudo apt-get install -y tesseract-ocr tesseract-ocr-eng tesseract-ocr-fra tesseract-ocr-deu tesseract-ocr-spa libleptonica-dev libtesseract-dev pkg-config |
17 | | - - name: Set TESSDATA_PREFIX |
18 | | - run: | |
19 | | - echo "TESSDATA_PREFIX=$(dpkg -L tesseract-ocr-eng | grep tessdata$)" >> "$GITHUB_ENV" |
20 | | - - uses: ./.github/actions/setup-poetry |
| 24 | + - name: Cache Hugging Face models |
| 25 | + uses: actions/cache@v4 |
| 26 | + with: |
| 27 | + path: ~/.cache/huggingface |
| 28 | + key: huggingface-cache-py${{ matrix.python-version }} |
| 29 | + - name: Install uv and set the python version |
| 30 | + uses: astral-sh/setup-uv@v5 |
| 31 | + with: |
| 32 | + python-version: ${{ matrix.python-version }} |
| 33 | + enable-cache: true |
| 34 | + - name: pre-commit cache key |
| 35 | + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV" |
| 36 | + - uses: actions/cache@v4 |
| 37 | + with: |
| 38 | + path: ~/.cache/pre-commit |
| 39 | + key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} |
| 40 | + - name: Install dependencies |
| 41 | + run: uv sync --frozen --all-extras |
| 42 | + - name: Check style and run tests |
| 43 | + run: pre-commit run --all-files |
| 44 | + - name: Upload coverage to Codecov |
| 45 | + if: inputs.push_coverage |
| 46 | + uses: codecov/codecov-action@v5 |
| 47 | + with: |
| 48 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 49 | + files: ./coverage.xml |
| 50 | + |
| 51 | + build-package: |
| 52 | + runs-on: ubuntu-latest |
| 53 | + strategy: |
| 54 | + matrix: |
| 55 | + python-version: ['3.12'] |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v4 |
| 58 | + - name: Install uv and set the python version |
| 59 | + uses: astral-sh/setup-uv@v5 |
| 60 | + with: |
| 61 | + python-version: ${{ matrix.python-version }} |
| 62 | + enable-cache: true |
| 63 | + - name: Install dependencies |
| 64 | + run: uv sync --all-extras |
| 65 | + - name: Build package |
| 66 | + run: uv build |
| 67 | + - name: Check content of wheel |
| 68 | + run: unzip -l dist/*.whl |
| 69 | + - name: Store the distribution packages |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: python-package-distributions |
| 73 | + path: dist/ |
| 74 | + |
| 75 | + test-package: |
| 76 | + needs: |
| 77 | + - build-package |
| 78 | + runs-on: ubuntu-latest |
| 79 | + strategy: |
| 80 | + matrix: |
| 81 | + python-version: ['3.12'] |
| 82 | + steps: |
| 83 | + - name: Download all the dists |
| 84 | + uses: actions/download-artifact@v4 |
| 85 | + with: |
| 86 | + name: python-package-distributions |
| 87 | + path: dist/ |
| 88 | + - name: Install uv and set the python version |
| 89 | + uses: astral-sh/setup-uv@v5 |
21 | 90 | with: |
22 | 91 | python-version: ${{ matrix.python-version }} |
23 | | - - name: Run styling check |
24 | | - run: poetry run pre-commit run --all-files |
25 | | - - name: Install with poetry |
26 | | - run: poetry install --all-extras |
27 | | - - name: Testing |
28 | | - run: | |
29 | | - poetry run pytest -v tests |
30 | | - - name: Run examples |
31 | | - run: | |
32 | | - # for file in docs/examples/*.py; do |
33 | | - # # Skip batch_convert.py |
34 | | - # if [[ "$(basename "$file")" =~ ^(batch_convert|minimal|export_multimodal|custom_convert|develop_picture_enrichment).py ]]; then |
35 | | - # echo "Skipping $file" |
36 | | - # continue |
37 | | - # fi |
38 | | - # |
39 | | - # echo "Running example $file" |
40 | | - # poetry run python "$file" || exit 1 |
41 | | - # done |
42 | | - echo "Skipping examples in CI until this is more time efficient." |
43 | | - - name: Build with poetry |
44 | | - run: poetry build |
| 92 | + enable-cache: true |
| 93 | + - name: Install package |
| 94 | + run: uv pip install dist/*.whl |
| 95 | + - name: Run docling-eval |
| 96 | + run: docling-eval --help |
0 commit comments