mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 07:20:44 +08:00
- Add SQLAlchemy Core repos, pg adapter/compat, assistant_store factory, Alembic bootstrap and migration/cutover scripts. - Harden chat_message writes (NUL scrub for PG), turn_uuid on attempt failure, WS turn_runner fallbacks and gateway executed_turn_uuid init. - start_gateway: log paths, PS7 stderr handling via cmd, background stdout/stderr redirect; runtime assistant_runtime_log_dir export. - Ops: clear_all_chat_sessions with PG-only --postgresql and env-gated wipe; clear_postgres_chat_sessions.ps1. - Tests: SA repos, pg compat, persist fallback, smoke env isolation; CI and docs touch-ups. Co-authored-by: Cursor <cursoragent@cursor.com>
70 lines
2.8 KiB
YAML
70 lines
2.8 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
- name: Install dependencies
|
|
run: python -m pip install -r requirements.txt ruff mypy
|
|
- name: Lint changed architecture modules
|
|
run: ruff check interfaces runtime svc tests/test_oclaw_gateway_optimizations.py
|
|
- name: Type check critical gateway modules
|
|
run: mypy --ignore-missing-imports interfaces/gateway/context_builder.py interfaces/ws/server_methods_bridge.py interfaces/ws/turn_runner.py
|
|
- name: Run tests
|
|
run: python -m pytest -q tests
|
|
- name: Offline eval sanity
|
|
run: python runtime/operations/scripts/offline_eval.py
|
|
|
|
test-postgresql:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U postgres"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
env:
|
|
AIA_ASSISTANT_DB_BACKEND: postgresql
|
|
AIA_ASSISTANT_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/oclaw
|
|
AIA_TEST_PG_URL: postgresql://postgres:postgres@127.0.0.1:5432/oclaw
|
|
OPS_WORKSPACE_ROOT: ${{ github.workspace }}/.ci_workspace
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
- name: Install dependencies
|
|
run: python -m pip install -r requirements.txt
|
|
- name: Create database and apply migrations
|
|
run: |
|
|
mkdir -p "$OPS_WORKSPACE_ROOT"
|
|
python - <<'PY'
|
|
import os
|
|
|
|
import psycopg
|
|
|
|
dsn = os.environ["AIA_ASSISTANT_DATABASE_URL"]
|
|
admin = dsn.rsplit("/", 1)[0] + "/postgres"
|
|
with psycopg.connect(admin, autocommit=True) as conn:
|
|
cur = conn.execute("SELECT 1 FROM pg_database WHERE datname = %s", ("oclaw",))
|
|
if cur.fetchone() is None:
|
|
conn.execute("CREATE DATABASE oclaw")
|
|
PY
|
|
alembic upgrade head
|
|
- name: Run PostgreSQL-scoped tests
|
|
run: python -m pytest -q tests/test_database_backend.py tests/test_pg_compat.py tests/test_sa_app_settings.py tests/test_sa_auth_sessions.py tests/test_sa_chat_sessions.py tests/test_sa_chat_messages.py tests/test_sa_fork_trim_admin_sessions.py tests/test_sa_admin_user_stats_tool_health.py tests/test_sa_tool_log_trace.py tests/test_sa_prune_orphans.py tests/test_sa_ui_session_owner.py tests/test_sa_tenant_bind_code.py tests/test_sa_app_users.py tests/test_migrate_assistant_sqlite_to_pg.py
|