Workflow file for this run
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: Run pre-commit checks and tests on PR or manually | |
on: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
# pre-commit hooks job | |
pre-commit: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.12.3 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.12.3" | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v4 | |
- name: Install check dependencies | |
run: | | |
pdm venv create 3.12.3 | |
pdm use .venv/bin/python | |
pdm install --no-default --group check --frozen-lockfile | |
- name: Cache pre-commit hooks | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pre-commit | |
key: ${{ runner.os }}-precommit-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Run pre-commit | |
run: pdm run pre-commit run --all-files | |
# testing job | |
test: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.12.3 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.12.3" | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v4 | |
- name: Install default and test dependencies | |
run: | | |
pdm venv create 3.12.3 | |
pdm use .venv/bin/python | |
pdm install --group test --frozen-lockfile | |
- name: Run unit tests | |
run: pdm run pytest tests/unit | |
- name: Run doc tests | |
run: pdm run pytest tests/doc |