69 lines
2.4 KiB
YAML
69 lines
2.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
|
|
jobs:
|
|
# Catches the v0.4.13 release-day miss: pyproject.toml + plugin.yaml +
|
|
# CHANGELOG header must all carry the same version, or PyPI ships with
|
|
# a stale Hermes-side manifest. Cheap static check, runs once per PR.
|
|
version-sync:
|
|
name: Version sync
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Verify version surfaces match
|
|
run: |
|
|
set -euo pipefail
|
|
PYPROJECT=$(grep -E '^version = ' pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
|
|
PLUGIN_YAML=$(grep -E '^version: ' yantrikdb/plugin.yaml | head -1 | sed 's/version: //')
|
|
CHANGELOG=$(grep -oE '^## \[[0-9]+\.[0-9]+\.[0-9]+\]' yantrikdb/CHANGELOG.md | head -1 | sed 's/## \[\(.*\)\]/\1/')
|
|
echo "pyproject.toml = $PYPROJECT"
|
|
echo "plugin.yaml = $PLUGIN_YAML"
|
|
echo "CHANGELOG.md = $CHANGELOG"
|
|
if [ "$PYPROJECT" != "$PLUGIN_YAML" ] || [ "$PYPROJECT" != "$CHANGELOG" ]; then
|
|
echo "::error::Version drift — pyproject.toml=$PYPROJECT, plugin.yaml=$PLUGIN_YAML, CHANGELOG=$CHANGELOG"
|
|
echo ""
|
|
echo "Bump all three together. The repo has bump-my-version configured:"
|
|
echo " pipx run bump-my-version bump patch # 0.4.14 -> 0.4.15"
|
|
echo " pipx run bump-my-version bump minor # 0.4.14 -> 0.5.0"
|
|
echo " pipx run bump-my-version bump major # 0.4.14 -> 1.0.0"
|
|
echo "Then add a matching CHANGELOG entry."
|
|
exit 1
|
|
fi
|
|
echo "All three version sources match: $PYPROJECT"
|
|
|
|
test:
|
|
name: Python ${{ matrix.python-version }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ["3.11", "3.12", "3.13", "3.14"]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: pip
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install requests pytest ruff mypy types-requests
|
|
|
|
- name: Lint (ruff)
|
|
run: ruff check yantrikdb/ tests/
|
|
|
|
- name: Type check (mypy)
|
|
run: mypy --ignore-missing-imports yantrikdb/
|
|
|
|
- name: Run tests
|
|
run: python -m pytest tests/ -v
|