Update pyproject.toml (#26) #36
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
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 |