Extracted from three near-identical bespoke implementations (Heretic, HordeWorker, InfiniteVideo), each ~800-1000 lines hand-rolling the same status/setup/login/logout/TOTP/admin-user-CRUD proxy around AuthClient. build_auth_router(get_client, get_store) returns a ready-to-mount APIRouter matching shared/backend/auth (Go)'s Service response shapes. Gated behind an optional `fastapi` extra so the rest of this framework-agnostic package is unaffected. 18 new tests, including a regression test for a real bug this had (request models nested inside build_auth_router silently broke under `from __future__ import annotations`, misrouting every JSON body as a missing query param). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
84 lines
1.9 KiB
YAML
84 lines
1.9 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
paths:
|
|
- '.changeset/**'
|
|
- '.github/workflows/**'
|
|
- 'backend/**'
|
|
- 'packages/**'
|
|
- 'scripts/**'
|
|
- 'package.json'
|
|
- 'package-lock.json'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- master
|
|
paths:
|
|
- '.changeset/**'
|
|
- '.github/workflows/**'
|
|
- 'backend/**'
|
|
- 'packages/**'
|
|
- 'scripts/**'
|
|
- 'package.json'
|
|
- 'package-lock.json'
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
node:
|
|
name: Test (Node/Svelte)
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24'
|
|
cache: npm
|
|
cache-dependency-path: package-lock.json
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
- name: Build and test Node/Svelte packages
|
|
run: npm test
|
|
|
|
go:
|
|
name: Test (Go)
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
defaults:
|
|
run:
|
|
working-directory: backend
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: backend/go.mod
|
|
cache: true
|
|
- name: Run Go tests
|
|
run: go test ./...
|
|
|
|
python:
|
|
name: Test (Python)
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
- name: Install package
|
|
run: python -m pip install --upgrade pip -e "packages/python-backend[fastapi]"
|
|
- name: Run Python tests
|
|
run: python -m unittest discover -s packages/python-backend/tests -p 'test_*.py'
|