Files
site_aegisone/.github/workflows/tests.yml
T
angel bd048ea23d v1.5.4: test infrastructure + bug fixes + CI/CD + deploy gate
- 6 new test files: route discovery, strict permissions, role switch,
  CRUD operations, 500 error protection
- permission_config.py: central permission definitions for all 110+ routes
- Bug fixes: is_active checkbox in users_edit, int(id) 500 crash,
  missing validation in users_create/users_delete
- Pre-commit hooks: lint + static routing tests
- GitHub Actions CI: full pytest suite on push
- Deploy gate: pytest runs before deploy, aborts on failure
- All 3 deploy scripts: --skip-tests flag support
2026-05-22 20:45:27 +03:00

63 lines
1.5 KiB
YAML

name: Tests
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: aegisone
POSTGRES_USER: aegisone
POSTGRES_PASSWORD: aegisone_pass
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
working-directory: py_service
run: |
pip install -r requirements.txt
pip install ruff
- name: Pre-test lint & static analysis
working-directory: py_service
run: |
ruff check .
pytest tests/test_routes_defined.py -v --no-header -q
python -c "from tests.test_00_discover_routes import collect_app_routes; r=collect_app_routes(); print(f'Discovered {len(r)} routes')"
- name: Start server
working-directory: py_service
run: |
uvicorn app.main:app --host 0.0.0.0 --port 8000 &
sleep 3
curl -sf http://localhost:8000/health || (echo "Server failed to start" && exit 1)
- name: Run tests
working-directory: py_service
run: |
pytest -v --tb=short -x
- name: Test summary
if: always()
run: echo "CI test run complete"