Forgejo Actions is not enabled on the instance, so run the same checks locally before pushing: - scripts/check.sh runs ruff, mypy, and pytest (mirrors the CI workflow). - .githooks/pre-push invokes it; enable per clone with `git config core.hooksPath .githooks`. Bypass with `git push --no-verify`. - Fix the pytest invocation in the CI workflow (and document it): use `python -m pytest` so the repo root is on sys.path, otherwise the test modules fail to `import tests.*`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
47 lines
1.1 KiB
YAML
47 lines
1.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install package with dev extras
|
|
run: pip install -e ".[dev]"
|
|
|
|
- name: Ruff (lint)
|
|
run: ruff check src/ tests/
|
|
|
|
- name: Mypy (type check)
|
|
run: mypy
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# requires-python = ">=3.10"; test the floor and a recent version.
|
|
python-version: ["3.10", "3.12"]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install package with dev extras
|
|
run: pip install -e ".[dev]"
|
|
|
|
- name: Run test suite
|
|
# `python -m pytest` puts the repo root on sys.path so the test modules
|
|
# can `import tests.*` (the pytest console script would not).
|
|
run: python -m pytest -q
|