The Test Suite job failed on every push since the black check was added because the tree had never been formatted, and pre-commit said 120 columns while CI ran black's default 88. pyproject.toml now carries [tool.black] / [tool.isort] (88, black profile) as the single source; pre-commit reads it; `make format` applied it (13 files, whitespace only, 146 insertions / 128 deletions, tests unchanged at 146 passed). ci.yml: lint (black, isort, flake8 hard errors) + pytest. The Docker registry push, VictoriaMetrics integration test, staging/production deploy and Apache-Bench jobs were template scaffolding for hosts and registries that do not exist; production is a systemd unit updated by git pull. Removed rather than left permanently skipped. docs.yml: the "Check markdown links" step curl'd every URL in every .md and failed on localhost examples and the Tailscale IP, and the Sphinx jobs built artifacts nobody read. Replaced by two checks that mean something: relative links/images in README, CONTRIBUTING and docs/ resolve inside the repo, and the FastAPI OpenAPI schema exports with the documented endpoints present (uploaded as an artifact).
76 lines
2.3 KiB
YAML
76 lines
2.3 KiB
YAML
name: CI
|
|
|
|
# What this checks, on every push and PR to master:
|
|
# 1. formatting contract (black + isort, config in pyproject.toml)
|
|
# 2. flake8 hard-error gate (syntax, undefined names)
|
|
# 3. the pytest suite (synthetic data, no DB/network; ~1 min)
|
|
# Docker build / staging / production / perf jobs from the original template
|
|
# were removed: there is no registry, no staging host, and production is a
|
|
# systemd unit deployed by `git pull` on the server (docs/FLOOD_FORECASTING.md
|
|
# section 6, scripts/install.sh). Re-add a job when the thing it deploys exists.
|
|
|
|
on:
|
|
push:
|
|
branches: [master, develop]
|
|
pull_request:
|
|
branches: [master]
|
|
schedule:
|
|
# daily, catches dependency drift / upstream API changes in the tests
|
|
- cron: "0 2 * * *"
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
PYTHON_VERSION: "3.11" # pandas 2.0.3 ships no 3.12 wheels; psycopg2-binary 2.9.9 breaks on 3.13
|
|
|
|
jobs:
|
|
lint:
|
|
name: Format & lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
cache: pip
|
|
cache-dependency-path: requirements-dev.txt
|
|
|
|
- name: Install tools
|
|
run: |
|
|
python -m pip install --upgrade pip --root-user-action=ignore
|
|
pip install --root-user-action=ignore black==23.11.0 isort==5.12.0 flake8==6.1.0
|
|
|
|
- name: black
|
|
run: black --check --diff src/ *.py
|
|
|
|
- name: isort
|
|
run: isort --check-only --diff src/ *.py
|
|
|
|
- name: flake8 (errors only)
|
|
run: flake8 src/ --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
|
|
test:
|
|
name: Test suite
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
cache: pip
|
|
cache-dependency-path: |
|
|
requirements.txt
|
|
requirements-dev.txt
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip --root-user-action=ignore
|
|
pip install --root-user-action=ignore -r requirements.txt
|
|
pip install --root-user-action=ignore pytest==7.4.3 pytest-asyncio==0.21.1
|
|
|
|
- name: pytest
|
|
env:
|
|
DB_TYPE: sqlite
|
|
run: pytest -q -p no:cacheprovider
|