From f50620c2446f418e6e981064b8fcdc5d20cdf906 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sun, 27 Oct 2024 13:26:41 -0700 Subject: [PATCH] Convert to uv build --- .github/workflows/build.yml | 84 +++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d88a87bf7..a413e5f6e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,6 @@ jobs: python: "pypy3.10" - os: ubuntu-22.04 python: "3.13" - experimental: true env: OS: ${{ matrix.os }} @@ -49,12 +48,15 @@ jobs: with: fetch-depth: "0" # 0=all, needed for setuptools-scm to resolve version tags - - uses: actions/setup-python@v5 - name: Setup Python + - name: Install uv + uses: astral-sh/setup-uv@v3 with: - python-version: ${{ matrix.python }} - cache: "pip" - allow-prereleases: ${{ matrix.experimental }} + version: "0.4.27" + + - name: "Set up Python" + uses: actions/setup-python@v5 + with: + python-version-file: ".python-version" - name: Install Tesseract 5 if: matrix.tesseract5 @@ -89,11 +91,6 @@ jobs: libxslt1-dev \ pypy3-dev - - name: Install Python packages - run: | - python -m pip install --upgrade pip wheel - python -m pip install --prefer-binary .[test] - - name: Report versions run: | tesseract --version @@ -102,9 +99,13 @@ jobs: unpaper --version img2pdf --version + - name: Install Python packages + run: | + uv sync --extra test + - name: Test run: | - python -m pytest --cov-report xml --cov=ocrmypdf --cov=tests/ -n0 tests/ + uv run pytest --cov-report xml --cov=ocrmypdf --cov=tests/ -n0 tests/ - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 @@ -144,17 +145,6 @@ jobs: pngquant \ tesseract - - uses: actions/setup-python@v5 - name: Setup Python - with: - python-version: ${{ matrix.python }} - cache: "pip" - - - name: Install Python packages - run: | - python -m pip install --upgrade pip wheel - python -m pip install --prefer-binary .[test] - - name: Report versions run: | tesseract --version @@ -162,9 +152,23 @@ jobs: pngquant --version img2pdf --version + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.4.27" + + - name: "Set up Python" + uses: actions/setup-python@v5 + with: + python-version-file: ".python-version" + + - name: Install Python packages + run: | + uv sync --extra test + - name: Test run: | - python -m pytest --cov-report xml --cov=ocrmypdf --cov=tests/ -n0 tests/ + uv run pytest --cov-report xml --cov=ocrmypdf --cov=tests/ -n0 tests/ - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 @@ -191,11 +195,15 @@ jobs: with: fetch-depth: "0" # 0=all, needed for setuptools-scm to resolve version tags - - uses: actions/setup-python@v5 - name: Setup Python + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.4.27" + + - name: "Set up Python" + uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python }} - cache: "pip" + python-version-file: ".python-version" - name: Install system packages run: | @@ -204,12 +212,11 @@ jobs: - name: Install Python packages run: | - python -m pip install --upgrade pip wheel - python -m pip install --prefer-binary .[test] + uv sync --extra test - name: Test run: | - python -m pytest --cov-report xml --cov=ocrmypdf --cov=tests/ -n0 tests/ + uv run pytest --cov-report xml --cov=ocrmypdf --cov=tests/ -n0 tests/ - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 @@ -227,16 +234,19 @@ jobs: with: fetch-depth: "0" # 0=all, needed for setuptools-scm to resolve version tags - - uses: actions/setup-python@v5 - name: Setup Python + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.4.27" + + - name: "Set up Python" + uses: actions/setup-python@v5 with: - python-version: "3.10" - cache: "pip" + python-version-file: ".python-version" - name: Make wheels and sdist run: | - python -m pip install --upgrade pip wheel build - python -m build --sdist --wheel + uv build --sdist --wheel - uses: actions/upload-artifact@v4 with: