App factory, data model, initial migration and HTTP metrics
- Flask app factory with env-driven config (.env loaded at import) - SQLAlchemy models: users, API apps, UI tokens, Last.fm auth tokens, sessions, scrobbles (deduplicated) and now-playing - Initial Alembic migration; CI checks migrations match the models - Prometheus metric definitions, per-endpoint RED hooks with bounded labels, and a standalone metrics server - docker compose Postgres with a test database; CI test job runs against a Postgres service container Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
606348800b
commit
98c8f2e824
21 files changed
+1777
-6
No files matched your search
@@ -20,10 +20,29 @@ jobs:
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16
|
||||
env:
|
||||
POSTGRES_USER: scrobbler
|
||||
POSTGRES_PASSWORD: scrobbler
|
||||
POSTGRES_DB: scrobbler_test
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U scrobbler"
|
||||
--health-interval 5s
|
||||
--health-timeout 3s
|
||||
--health-retries 10
|
||||
env:
|
||||
DATABASE_URL: postgresql+psycopg://scrobbler:scrobbler@postgres:5432/scrobbler_test
|
||||
TEST_DATABASE_URL: postgresql+psycopg://scrobbler:scrobbler@postgres:5432/scrobbler_test
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: https://github.com/astral-sh/setup-uv@v6
|
||||
- run: uv sync --locked
|
||||
- name: Migrations are in sync with the models
|
||||
run: |
|
||||
uv run flask --app scrobbler db upgrade
|
||||
uv run flask --app scrobbler db check
|
||||
- run: uv run pytest
|
||||
|
||||
notify:
|
||||
|
||||
Reference in new issue
Block a user