Skip to content

Commit

Permalink
Update github-ci.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan6419846 authored Mar 16, 2024
1 parent 8ef399a commit de1b50f
Showing 1 changed file with 9 additions and 143 deletions.
152 changes: 9 additions & 143 deletions .github/workflows/github-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,13 @@ on:
workflow_dispatch:

jobs:
test_windows:
name: pytest on windows
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup Python (3.11+)
uses: actions/setup-python@v5
with:
python-version: 3.12 # latest stable python
allow-prereleases: true
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install requirements (Python 3.11+)
run: |
pip install -r requirements/ci-3.11.txt
- name: Install cryptography
run: |
pip install cryptography
- name: Install pypdf
run: |
pip install .
- name: Prepare
run: |
python -c "from tests import download_test_pdfs; download_test_pdfs()"
- name: Test with pytest
run: |
python -m pytest tests --cov=pypdf --cov-append -n auto -vv
tests:
name: "pytest on ${{ matrix.python-version }} (crypto-lib: ${{ matrix.use-crypto-lib }})"
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.12"]
use-crypto-lib: ["cryptography"]
include:
- python-version: "3.7"
use-crypto-lib: "pycryptodome"
- python-version: "3.7"
use-crypto-lib: "none"
steps:
- name: Update APT packages
run:
Expand Down Expand Up @@ -124,110 +86,14 @@ jobs:
- name: Prepare
run: |
python -c "from tests import download_test_pdfs; download_test_pdfs()"
- name: Test with pytest
- name: Install mutmut
run: |
pip install mutmut
- name: Run mutmut
run: |
python -m pytest tests --cov=pypdf --cov-append -n auto -vv
- name: Rename coverage data file
run: mv .coverage ".coverage.$RANDOM"
- name: Upload coverage data
mutmut run
- name: Upload mutmut results
uses: actions/upload-artifact@v4
with:
name: coverage-data.${{ matrix.python-version }}-${{ matrix.use-crypto-lib }}
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@v4
with:
submodules: 'recursive'
- name: Setup Python 3.11
uses: actions/setup-python@v5
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 .
- name: Test with mypy
run : |
mypy pypdf
- name: Test docs build
run: |
pip install -r requirements/docs.txt
sphinx-build -n -W --keep-going -T -b html docs build/sphinx/html
package:
name: Build & verify package
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
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@v4
- uses: actions/setup-python@v5
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@v4
with:
pattern: coverage-data*
merge-multiple: true

- name: Check Number of Downloaded Files
run: |
downloaded_files_count=$(find \.coverage* -type f | wc -l)
if [ $downloaded_files_count -eq 8 ]; then
echo "The expected number of files (8) were downloaded."
else
echo "ERROR: Expected 8 files, but found $downloaded_files_count files."
exit 1
fi
- name: Combine coverage & create xml report
run: |
python -m coverage combine
python -m coverage xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
name: mutmut-cache
path: .mutmut-cache

0 comments on commit de1b50f

Please sign in to comment.