Skip to content

Optimize and prevent OOM in apply_png_predictor (#1247) #800

Optimize and prevent OOM in apply_png_predictor (#1247)

Optimize and prevent OOM in apply_png_predictor (#1247) #800

Workflow file for this run

name: Continuous integration
on:
push: # run when commits are added to master
branches:
- master
tags:
- '[0-9]+' # match version tags with only numbers
pull_request: # run on pr's against master
branches:
- master
merge_group:
types:
- checks_requested
env:
default-python: "3.10"
jobs:
check-lockfile:
name: Check uv.lock is up to date
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Check if uv.lock is up to date
run: uv lock --locked
format:
name: Check code formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ env.default-python }}
run: uv python install ${{ env.default-python }}
- name: Install dependencies
run: uv sync --locked --group dev --no-install-project
- name: Check formatting
run: uv run ruff format --check .
lint:
name: Run linting checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ env.default-python }}
run: uv python install ${{ env.default-python }}
- name: Install dependencies
run: uv sync --locked --group dev --no-install-project
- name: Run ruff linter
run: uv run ruff check .
type-check:
name: Check static types
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ env.default-python }}
run: uv python install ${{ env.default-python }}
- name: Install dependencies
run: uv sync --locked --group dev --no-install-project
- name: Run mypy type checker
run: uv run mypy --install-types --non-interactive --show-error-codes fuzzing pdfminer tools tests
tests:
name: Run tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --locked --group dev --no-install-project
- name: Run tests
run: uv run pytest
pre-commit:
name: Run pre-commit hooks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ env.default-python }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.default-python }}
- name: Run pre-commit
uses: pre-commit/action@v3.0.1
build-docs:
name: Test building docs
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ env.default-python }}
run: uv python install ${{ env.default-python }}
- name: Install project and docs dependencies
run: uv sync --locked --group docs --all-extras
- name: Build docs
run: |
uv run python -m sphinx -b html docs/source docs/build/html
uv run python -m sphinx -b doctest docs/source docs/build/doctest
publish:
name: Publish to PyPi
runs-on: ubuntu-latest
needs:
- check-lockfile
- format
- lint
- type-check
- tests
- pre-commit
- build-docs
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Generate changelog
run: sed '1,/## \[/d;/## \[/Q' CHANGELOG.md > ${{ github.workspace }}-CHANGELOG.md
- name: Publish package to PyPi
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Create GitHub release
if: startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
id: create_release
with:
token: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
body_path: ${{ github.workspace }}-CHANGELOG.md
files: |
dist/*.tar.gz
dist/*.whl