CI #92
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 | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.rst' | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.rst' | |
workflow_dispatch: | |
jobs: | |
tests: | |
name: "pytest on ${{ matrix.python-version }} (crypto-lib: ${{ matrix.use-crypto-lib }})" | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
use-crypto-lib: ["cryptography"] | |
steps: | |
- name: Update APT packages | |
run: | |
sudo apt-get update | |
- name: Install APT dependencies | |
run: | |
sudo apt-get install ghostscript | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Cache Downloaded Files | |
id: cache-downloaded-files | |
uses: actions/cache@v4 | |
with: | |
path: '**/tests/pdf_cache/*' | |
key: cache-downloaded-files | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
if: 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@v5 | |
if: matrix.python-version == '3.11' || matrix.python-version == '3.12' | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
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.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' | |
- name: Remove pycryptodome and cryptography | |
run: | | |
pip uninstall pycryptodome cryptography -y | |
- name: Install cryptography | |
run: | | |
pip install cryptography | |
if: matrix.use-crypto-lib == 'cryptography' | |
- name: Install pycryptodome | |
run: | | |
pip install pycryptodome | |
if: matrix.use-crypto-lib == 'pycryptodome' | |
- name: Install pypdf | |
run: | | |
pip install . | |
- name: Prepare | |
run: | | |
python -c "from tests import download_test_pdfs; download_test_pdfs()" | |
- name: Install mutmut | |
run: | | |
pip install mutmut | |
- name: Run mutmut | |
run: | | |
mutmut run | |
- name: Upload mutmut results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mutmut-cache | |
path: .mutmut-cache |