ENH: Add level
parameter to compress_content_streams (#2044)
#3563
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: CI | |
on: | |
push: | |
branches: [ main, 2.0.0-dev ] | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.rst' | |
pull_request: | |
branches: [ main, 2.0.0-dev ] | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.rst' | |
jobs: | |
tests: | |
name: pytest on ${{ matrix.python-version }} | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12.0-beta.4"] | |
use-crypto-lib: ["pycryptodome"] | |
include: | |
- python-version: "3.9" | |
use-crypto-lib: "cryptography" | |
- python-version: "3.10" | |
use-crypto-lib: "" | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Cache Downloaded Files | |
id: cache-downloaded-files | |
uses: actions/cache@v3 | |
with: | |
path: '**/tests/pdf_cache/*' | |
key: cache-downloaded-files | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
if: matrix.python-version == '3.6' || matrix.python-version == '3.7' || matrix.python-version == '3.8' || matrix.python-version == '3.9' || matrix.python-version == '3.10' | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: '**/requirements/ci.txt' | |
- name: Setup Python (3.11+) | |
uses: actions/setup-python@v4 | |
if: matrix.python-version == '3.11' || matrix.python-version == '3.12.0-beta.4' | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: '**/requirements/ci-3.11.txt' | |
- name: Upgrade pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install requirements (Python 3) | |
run: | | |
pip install -r requirements/ci.txt | |
if: matrix.python-version == '3.6' || matrix.python-version == '3.7' || matrix.python-version == '3.8' || matrix.python-version == '3.9' || matrix.python-version == '3.10' | |
- name: Install requirements (Python 3.11+) | |
run: | | |
pip install -r requirements/ci-3.11.txt | |
if: matrix.python-version == '3.11' || matrix.python-version == '3.12.0-beta.4' | |
- name: Remove pycryptodome | |
run: | | |
pip uninstall pycryptodome -y | |
if: matrix.use-crypto-lib != 'pycryptodome' | |
- name: Install cryptography | |
run: | | |
pip install cryptography | |
if: matrix.use-crypto-lib == 'cryptography' | |
- name: Install pypdf | |
run: | | |
pip install . | |
- name: Test with pytest | |
run: | | |
python -m coverage run --parallel-mode -m pytest tests -vv | |
- name: Test with mypy | |
run : | | |
mypy pypdf --show-error-codes --disallow-untyped-defs --disallow-incomplete-defs | |
- name: Upload coverage data | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-data | |
path: .coverage.* | |
if-no-files-found: ignore | |
codestyle: | |
name: Check code style issues | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Cache Downloaded Files | |
id: cache-downloaded-files | |
uses: actions/cache@v3 | |
with: | |
path: '**/tests/pdf_cache/*' | |
key: cache-downloaded-files | |
- name: Setup Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: 'pip' | |
cache-dependency-path: '**/requirements/ci-3.11.txt' | |
- name: Upgrade pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install requirements | |
run: | | |
pip install -r requirements/ci-3.11.txt | |
- name: Install pypdf | |
run: | | |
pip install . | |
- name: Test with ruff | |
run: | | |
echo `ruff --version` | |
ruff . | |
package: | |
name: Build & verify package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: ${{env.PYTHON_LATEST}} | |
- run: python -m pip install flit check-wheel-contents | |
- run: flit build | |
- run: ls -l dist | |
- run: check-wheel-contents dist/*.whl | |
- name: Test installing package | |
run: python -m pip install . | |
- name: Test running installed package | |
working-directory: /tmp | |
run: python -c "import pypdf;print(pypdf.__version__)" | |
coverage: | |
name: Combine & check coverage. | |
runs-on: ubuntu-latest | |
needs: tests | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
# Use latest Python, so it understands all syntax. | |
python-version: ${{env.PYTHON_LATEST}} | |
- run: python -m pip install --upgrade coverage[toml] | |
- uses: actions/download-artifact@v3 | |
with: | |
name: coverage-data | |
- name: Combine coverage & create xml report | |
run: | | |
python -m coverage combine | |
python -m coverage xml | |
- name: Upload Coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml |