Version 3.27.0rc0 #531
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GitHub Actions docs: https://docs.github.com/en/actions/learn-github-actions | |
# Reference syntax: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
# Env. vars: https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables | |
# Add'l variables (contexts): https://docs.github.com/en/actions/learn-github-actions/contexts | |
# Requires encrypted secret (see https://docs.github.com/en/actions/security-guides/encrypted-secrets) | |
# secrets.pypi_password | |
# This file is automatically "updated" with PRs by the "pre-commit ci" app in GitHub https://pre-commit.ci; it is | |
# currently scheduled weekly at approximately 16:00 UTC Monday. | |
name: Test and deploy release | |
on: [push, pull_request, workflow_dispatch] | |
env: | |
FORCE_COLOR: 1 | |
PYTHONUNBUFFERED: 1 | |
PYTHONUTF8: 1 | |
jobs: | |
# Set the job key. The key is displayed as the job name | |
# when a job name is not provided | |
# PRE-COMMIT IS ALREADY DONE BY GIT | |
# pre-commit: | |
# # Name the Job | |
# name: Quality assurance (pre-commit) | |
# # Set the type of machine to run on | |
# runs-on: ubuntu-latest | |
# | |
# steps: | |
# # Checks out a copy of the repository per https://github.com/actions/checkout | |
# - name: Check out repo | |
# uses: actions/checkout@main | |
# | |
# # Build Python and packages per https://github.com/actions/setup-python | |
# - name: Set up Python | |
# uses: actions/setup-python@main | |
# with: | |
# python-version: '3.11' # same as https://docs.readthedocs.io/en/stable/config-file/v2.html#build-tools-python | |
# cache: 'pip' | |
# cache-dependency-path: | | |
# requirements.txt | |
# tests/requirements_pre-commit.txt | |
# docs/requirements.txt | |
# | |
# # Install dependencies needed by the repo: local in .pre-commit-config.yaml | |
# - name: Install dependencies | |
# run: | | |
# pip install --upgrade pip setuptools wheel | |
# pip install --upgrade -r requirements.txt -r tests/requirements_pre-commit.txt -r docs/requirements.txt | |
# | |
# # The below has been replaced with the integration in GitHub of the "pre-commit ci" app https://pre-commit.ci | |
# # # Run pre-commit cache per https://github.com/pre-commit/action | |
# # - name: Run pre-commit | |
# # uses: pre-commit/[email protected] | |
test_ubuntu: | |
name: "Test ${{ matrix.python-version }}${{ matrix.disable-gil && 't' || '' }} on ${{ matrix.os }}" | |
runs-on: ${{ matrix.os }} | |
# Identifies any jobs that must complete successfully before this job will run | |
# needs: [pre-commit] | |
# A strategy creates a build matrix for your jobs. You can define different variations to run each job in | |
strategy: | |
matrix: | |
# Python versions at https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json | |
# RCs need to be specified fully, e.g. '3.13.0-rc.3' | |
python-version: ['3.13', '3.12', '3.11', '3.10'] | |
# python-version: ['3.12'] | |
os: [ubuntu-latest] | |
disable-gil: [false] | |
# 29-oct-24 lxml does not build for free-threaded (requires libxml2 and libxslt development packages | |
include: | |
# Free-threaded from https://github.com/actions/setup-python/issues/771#issuecomment-2439954031 | |
- { os: ubuntu-latest, python-version: '3.13', disable-gil: true } | |
# Set up Redis per https://docs.github.com/en/actions/guides/creating-redis-service-containers | |
# If you are using GitHub-hosted runners, you must use an Ubuntu runner | |
services: | |
# Label used to access the service container | |
redis: | |
# Docker Hub image | |
image: redis | |
# Set health checks to wait until redis has started | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps port 6379 on service container to the host | |
- 6379:6379 | |
env: | |
commitmsg: ${{ github.event.head_commit.message }} # only available at check-out; becomes env.commitmsg | |
TELEGRAM_TOKEN: ${{ secrets.telegram_token }} # for telegram testing | |
REDIS_URI: redis://localhost:6379 | |
steps: | |
# Checks out a copy of the repository per https://github.com/actions/checkout | |
- name: Check out repo | |
uses: actions/checkout@main | |
# Build Python and packages per https://github.com/actions/setup-python | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@main | |
if: "${{ !matrix.disable-gil }}" | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: | | |
requirements.txt | |
tests/requirements_pytest.txt | |
# Free-threaded from https://github.com/actions/setup-python/issues/771#issuecomment-2439954031 | |
- name: Set up Python ${{ matrix.python-version }} (free-threaded) | |
uses: deadsnakes/action@main | |
if: "${{ matrix.disable-gil }}" | |
with: | |
python-version: ${{ matrix.python-version }} | |
nogil: ${{ matrix.disable-gil }} | |
- name: Set PYTHON_GIL | |
if: '${{ matrix.disable-gil }}' | |
run: | | |
echo "PYTHON_GIL=0" >> $GITHUB_ENV | |
- name: Upgrade pip etc. | |
run: | | |
pip install --upgrade pip setuptools wheel | |
# - name: Install build dependencies for Python 3.10 for wheel-less lxml (Linux) | |
# # https://lxml.de/installation.html#installation | |
# if: matrix.python-version == '3.10.0-beta.4' && runner.os == 'Linux' | |
# run: | | |
# sudo apt-get -y update | |
# sudo apt-get -y install libxml2-dev libxslt-dev python3-dev | |
# CFLAGS="-O0" pip install lxml | |
- name: Install pdf2text and ocr dependencies (Linux Python latest) | |
# do full install and testing of pdf2text and ocr only on latest Python version | |
if: matrix.python-version == '3.13' && runner.os == 'Linux' | |
# https://github.com/jalan/pdftotext#os-dependencies | |
run: | | |
sudo apt-get -y update | |
sudo apt-get -y install python3-dbus build-essential libpoppler-cpp-dev pkg-config python3-dev tesseract-ocr | |
pip install --upgrade pdftotext pytesseract | |
- name: Install distribution's lxml for Python 3.13t (Linux Python latest free-threaded) | |
# https://lxml.de/installation.html#installation | |
if: matrix.disable-gil && matrix.python-version == '3.13' && runner.os == 'Linux' | |
run: | | |
sudo apt-get -y install python3-lxml | |
- name: Install all other dependencies (gil) | |
if: "${{ !matrix.disable-gil }}" | |
run: | | |
pip install --upgrade coveralls -r requirements.txt -r tests/requirements_pytest.txt | |
- name: Install all other dependencies (free-threaded) | |
if: "${{ matrix.disable-gil }}" | |
run: | | |
pip install --upgrade coveralls -r requirements.txt -r tests/requirements_pytest.txt lxml<=4.8.0 | |
# - name: Install all other dependencies (py12) | |
# if: matrix.python-version == '3.12' | |
# run: | | |
# pip install --upgrade --no-deps playwright >=1.37 greenlet==3.0 pyee==11.0 | |
# pip install --upgrade coveralls -r requirements.txt -r tests/requirements_pytest_312.txt | |
# pip install --upgrade --no-deps pyee==11.0 | |
- name: Run tests | |
# python -m required to get it to run in the correct directory; '>' folded style scalar (allows splitting line) | |
run: > | |
python -m pytest -v --cov=./ --cov-report=term tests/ | |
- name: Upload coverage data to coveralls.io (parallel) | |
run: coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
COVERALLS_FLAG_NAME: tests-${{ matrix.python-version }}-${{ matrix.os }} | |
COVERALLS_PARALLEL: true | |
test_macos: | |
# No redis (only works on ubuntu) | |
name: "Test ${{ matrix.python-version }} on ${{ matrix.os }}" | |
runs-on: ${{ matrix.os }} | |
# Identifies any jobs that must complete successfully before this job will run | |
# needs: [pre-commit] | |
# A strategy creates a build matrix for your jobs. You can define different variations to run each job in | |
strategy: | |
matrix: | |
# Python versions at https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json | |
# RCs need to be specified fully, e.g. '3.13.0-rc.3' | |
python-version: ['3.13', '3.12', '3.11', '3.10'] | |
# python-version: ['3.12'] | |
os: [macos-latest] | |
env: | |
commitmsg: ${{ github.event.head_commit.message }} # only available at check-out; becomes env.commitmsg | |
TELEGRAM_TOKEN: ${{ secrets.telegram_token }} # for telegram testing | |
# REDIS_URI: redis://localhost:6379 # no redis running | |
steps: | |
# Checks out a copy of the repository per https://github.com/actions/checkout | |
- name: Check out repo | |
uses: actions/checkout@main | |
# Build Python and packages per https://github.com/actions/setup-python | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@main | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: | | |
requirements.txt | |
tests/requirements_pytest.txt | |
- name: Upgrade pip etc. | |
run: | | |
pip install --upgrade pip setuptools wheel | |
# - name: Install wheel-less lxml for Python 3.10 | |
# # https://lxml.de/installation.html#installation | |
# if: matrix.python-version == '3.10.0-beta.4' | |
# run: | | |
# STATIC_DEPS=true sudo -H pip install lxml | |
- name: Install pdf2text and ocr dependencies (Python latest) | |
# do full install and testing of pdf2text and ocr only on latest Python version | |
if: matrix.python-version == '3.13' | |
run: | | |
brew install poppler tesseract | |
pip install --upgrade pdftotext pytesseract | |
- name: Install all other dependencies | |
# if: matrix.python-version < '3.12' | |
run: | | |
pip install --upgrade coveralls -r requirements.txt -r tests/requirements_pytest.txt | |
# - name: Install all other dependencies (py12) | |
# if: matrix.python-version == '3.12' | |
# run: | | |
# pip install --upgrade --no-deps playwright >=1.37 greenlet==3.0 pyee==11.0 | |
# pip install --upgrade coveralls -r requirements.txt -r tests/requirements_pytest_312.txt | |
# pip install --upgrade --no-deps pyee==11.0 | |
- name: Run tests | |
# python -m required to get it to run in the correct directory; '>' folded style scalar (allows splitting line) | |
run: > | |
python -m pytest -v --cov=./ --cov-report=term tests/ | |
- name: Upload coverage data to coveralls.io (parallel) | |
run: coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
COVERALLS_FLAG_NAME: tests-${{ matrix.python-version }}-${{ matrix.os }} | |
COVERALLS_PARALLEL: true | |
# NOTES FROM 15-Apr-2024: | |
# No need to install poppler, tesseract etc. (tests will skip) | |
# However, pytest would simply crash at collecting (Error: Process completed with exit code 1) so no good. | |
# Was doing the same on 02-Sep-2023 | |
# test_windows: | |
# # No redis (only works on ubuntu), only run on latest python-version | |
# name: "Test ${{ matrix.python-version }} on ${{ matrix.os }}" | |
# runs-on: ${{ matrix.os }} | |
# # Identifies any jobs that must complete successfully before this job will run | |
# # needs: [pre-commit] | |
# # A strategy creates a build matrix for your jobs. You can define different variations to run each job in | |
# strategy: | |
# matrix: | |
# # Python versions at https://github.com/actions/python-versions/releases | |
# python-version: ['3.12'] | |
# os: [windows-latest] | |
# | |
# env: | |
# commitmsg: ${{ github.event.head_commit.message }} # only available at check-out; becomes env.commitmsg | |
# TELEGRAM_TOKEN: ${{ secrets.telegram_token }} # for telegram testing | |
# REDIS_URI: redis://localhost:6379 | |
# | |
# steps: | |
# # Checks out a copy of the repository per https://github.com/actions/checkout | |
# - name: Check out repo | |
# uses: actions/checkout@main | |
# | |
# # Build Python and packages per https://github.com/actions/setup-python | |
# - name: Set up Python ${{ matrix.python-version }} | |
# uses: actions/setup-python@main | |
# with: | |
# python-version: ${{ matrix.python-version }} | |
# cache: 'pip' | |
# cache-dependency-path: | | |
# requirements.txt | |
# tests/requirements_pytest.txt | |
# | |
# - name: Upgrade pip etc. | |
# run: | | |
# pip install --upgrade pip setuptools wheel | |
# | |
## ISSUE WITH THE BELOW: | |
## Hangs at start /wait "" Miniconda3-latest-Windows-x86_64.exe /RegisterPython=0 /D=%temp%\Miniconda3 | |
## - name: Install pdf2text and ocr dependencies (Python 3.11) | |
## # do full install and testing of pdf2text and ocr only on latest Python version | |
## if: matrix.python-version == '3.11' | |
## run: | | |
## cd %temp% | |
## dir | |
## rem # install conda per https://conda.io/projects/conda/en/stable/user-guide/install/windows.html | |
## curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -O | |
## powershell Get-FileHash Miniconda3-latest-Windows-x86_64.exe -Algorithm SHA256 | |
## echo hash should match the one at https://docs.conda.io/projects/miniconda/en/latest/ | |
## rem # below, /S = silent mode | |
## start /wait "" Miniconda3-latest-Windows-x86_64.exe /RegisterPython=0 /D=%temp%\Miniconda3 | |
## del Miniconda3-latest-Windows-x86_64.exe /f | |
## call "%temp%\Miniconda3\conda" install -y -c conda-forge poppler | |
## rem # *** get latest tesseract filename from https://digi.bib.uni-mannheim.de/tesseract/?C=M;O=D | |
## set TESSERACT=tesseract-ocr-w64-setup-5.3.1.20230401.exe | |
## curl https://digi.bib.uni-mannheim.de/tesseract/%TESSERACT% -O | |
## start /wait "" %TESSERACT% /S | |
## del %TESSERACT% /f | |
## pip install --upgrade keyring pdftotext Pillow pytesseract | |
## shell: cmd | |
# | |
# - name: Install all other dependencies | |
## if: matrix.python-version <= '3.11' | |
# run: | | |
# pip install --upgrade coveralls -r requirements.txt -r tests/requirements_pytest.txt | |
# | |
## - name: Install all other dependencies (Python 3.12) | |
## if: matrix.python-version > '3.11' | |
## run: | | |
## pip install --upgrade greenlet==3.0.0a1 coveralls -r requirements.txt -r tests/requirements_pytest.txt | |
# | |
# - name: Run tests | |
# # workaround for Windows fatal exception: access violation | |
# # python -m required to get it to run in the correct directory; '>' folded style scalar (allows splitting line) | |
# run: > | |
# python -m pytest -v --cov=./ --cov-report=term tests/ -p no:faulthandler | |
# | |
# - name: Upload coverage data to coveralls.io (parallel) | |
# run: coveralls --service=github | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.github_token }} | |
# COVERALLS_FLAG_NAME: tests-${{ matrix.python-version }}-${{ matrix.os }} | |
# COVERALLS_PARALLEL: true | |
coveralls: | |
name: Completion -> coveralls.io | |
# needs: [test_ubuntu, test_macos, test_windows] | |
needs: [test_ubuntu, test_macos] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls parallel finished | |
uses: coverallsapp/github-action@main | |
with: | |
github-token: ${{ secrets.github_token }} | |
parallel-finished: true | |
deploy: | |
name: Deploy release | |
permissions: | |
contents: write # IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write # IMPORTANT: this permission is mandatory for create GitHub release | |
# needs: [test_ubuntu, test_macos, test_windows] | |
needs: [test_ubuntu, test_macos] | |
# ref https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@main | |
- name: Set up Python | |
uses: actions/setup-python@main | |
with: | |
python-version: '3.13' | |
cache: 'pip' | |
# Install pip dependencies | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip build | |
# build https://pypa-build.readthedocs.io/en/latest/ | |
- name: Build dist | |
run: | | |
python -m build | |
# PyPI publish GitHub Action from https://github.com/pypa/gh-action-pypi-publish | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
# with: | |
# user: __token__ | |
# password: ${{ secrets.pypi_password }} | |
- name: Create GitHub release | |
# uses: actions/create-release@main | |
uses: softprops/action-gh-release@main | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
body_path: RELEASE.rst | |
draft: false | |
prerelease: false | |
make_latest: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} |