Skip to content

build: add mypy to pre-commit (#33) #51

build: add mypy to pre-commit (#33)

build: add mypy to pre-commit (#33) #51

Workflow file for this run

name: Unit tests
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
linter:
name: Linters
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Cache python packages
uses: actions/cache@v3
with:
path: ${{ env.Python3_ROOT_DIR }}/lib/python3.11/site-packages
key: linting-packages-${{ hashFiles('**/pyproject.toml') }}-3.11
- name: Install dependencies
run: pip install -e '.[linting,testing]'
- name: Lint with ruff
run: |
pip3 install --upgrade --force-reinstall ruff
python3 -m ruff .
- name: Run mypy
run: python -m mypy
# - name: Use as an external package
# run: |
# mkdir $HOME/test_external_dir
# cd $HOME/test_external_dir
# python -m venv venv
# source venv/bin/activate
# pip install $GITHUB_WORKSPACE
# python -c "from hotpdf import Hotpdf; print(Hotpdf())"
tests:
name: Unit tests
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install ghostscript
run: sudo apt-get install ghostscript
- name: Cache python packages
uses: actions/cache@v3
with:
path: ${{ env.Python3_ROOT_DIR }}/lib/python3.11/site-packages
key: testing-packages-${{ hashFiles('**/pyproject.toml') }}-3.11
- name: Install dependencies
run: pip install -e '.[testing]'
- name: Run tests with coverage
run:
python -m pytest --cov=hotpdf -n=auto tests/ --cov-fail-under=100