|
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 | jobs: |
5 | 13 | run-checks: |
|
9 | 17 | python-version: ['3.9', '3.10', '3.11', '3.12'] |
10 | 18 | steps: |
11 | 19 | - uses: actions/checkout@v4 |
12 | | - - uses: ./.github/actions/setup-poetry |
| 20 | + - name: Install uv and set the python version |
| 21 | + uses: astral-sh/setup-uv@v5 |
13 | 22 | with: |
14 | 23 | python-version: ${{ matrix.python-version }} |
15 | | - - name: Run styling check |
16 | | - run: poetry run pre-commit run --all-files |
| 24 | + enable-cache: true |
| 25 | + - name: pre-commit cache key |
| 26 | + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV" |
| 27 | + - uses: actions/cache@v4 |
| 28 | + with: |
| 29 | + path: ~/.cache/pre-commit |
| 30 | + key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} |
| 31 | + - name: Install dependencies |
| 32 | + run: uv sync --frozen --all-extras |
| 33 | + - name: Check style and run tests |
| 34 | + run: pre-commit run --all-files |
| 35 | + - name: Upload coverage to Codecov |
| 36 | + if: inputs.push_coverage |
| 37 | + uses: codecov/codecov-action@v5 |
| 38 | + with: |
| 39 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 40 | + files: ./coverage.xml |
| 41 | + |
| 42 | + build-package: |
| 43 | + runs-on: ubuntu-latest |
| 44 | + strategy: |
| 45 | + matrix: |
| 46 | + python-version: ['3.12'] |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v4 |
| 49 | + - name: Install uv and set the python version |
| 50 | + uses: astral-sh/setup-uv@v5 |
| 51 | + with: |
| 52 | + python-version: ${{ matrix.python-version }} |
| 53 | + enable-cache: true |
| 54 | + - name: Install dependencies |
| 55 | + run: uv sync --all-extras |
| 56 | + - name: Build package |
| 57 | + run: uv build |
| 58 | + - name: Check content of wheel |
| 59 | + run: unzip -l dist/*.whl |
| 60 | + - name: Store the distribution packages |
| 61 | + uses: actions/upload-artifact@v4 |
| 62 | + with: |
| 63 | + name: python-package-distributions |
| 64 | + path: dist/ |
| 65 | + |
| 66 | + test-package: |
| 67 | + needs: |
| 68 | + - build-package |
| 69 | + runs-on: ubuntu-latest |
| 70 | + strategy: |
| 71 | + matrix: |
| 72 | + python-version: ['3.12'] |
| 73 | + steps: |
| 74 | + - name: Download all the dists |
| 75 | + uses: actions/download-artifact@v4 |
| 76 | + with: |
| 77 | + name: python-package-distributions |
| 78 | + path: dist/ |
| 79 | + - name: Install uv and set the python version |
| 80 | + uses: astral-sh/setup-uv@v5 |
| 81 | + with: |
| 82 | + python-version: ${{ matrix.python-version }} |
| 83 | + enable-cache: true |
| 84 | + - name: Install package |
| 85 | + run: uv pip install dist/*.whl |
| 86 | + - name: Check accessing the DoclingLoader class |
| 87 | + run: python -c 'from langchain_docling import DoclingLoader' |
0 commit comments