Skip to content

Run pre-commit checks and tests on PR or manually #14

Run pre-commit checks and tests on PR or manually

Run pre-commit checks and tests on PR or manually #14

Workflow file for this run

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 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 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