Changeset 0.17.1 (#76)

This commit is contained in:
2026-02-28 01:40:31 +00:00
parent c9141a6896
commit 856dc9b0ac
64 changed files with 8037 additions and 1657 deletions

View File

@@ -1,14 +1,15 @@
# .gitea/workflows/ci.yaml
# ============================================
# Chat Switchboard - CI/CD Pipeline (v0.12.0)
# Chat Switchboard - CI/CD Pipeline (v0.17.1)
# ============================================
# Cluster deployments use SEPARATE FE + BE images.
# Unified image is for Docker Hub only (docker-compose use).
#
# Pipeline:
# 1a. Frontend tests (Node.js — contracts, model logic, policy wiring)
# 1b. Go test (all PRs and pushes)
# 2. Build + Deploy (depends on both test jobs passing)
# 1b. Go test (Postgres — all PRs and pushes)
# 1c. Go test (SQLite — compilation + store verification)
# 2. Build + Deploy (depends on all test jobs passing)
#
# Deployment mapping (single domain, path-based):
# PR → FE + BE :dev → switchboard.DOMAIN/dev/ (DB wipe + fresh schema)
@@ -30,17 +31,19 @@
#
# Required Gitea Variables:
# REGISTRY, NAMESPACE, DOMAIN, POSTGRES_HOST
# SEED_USERS (optional) — CSV: "user:pass:role,..." for dev/test seed accounts
# STORAGE_CLASS — StorageClass for PVC (e.g. "cephfs", required for file storage)
# STORAGE_SIZE — PVC capacity (e.g. "10Gi", default: "10Gi")
# STORAGE_BACKEND — "pvc" or "s3" (default: "pvc")
# PROVIDER — LLM provider type for live tests: "venice", "openai", "anthropic"
# PROVIDER_URL — provider endpoint (optional, uses default for known providers)
# SEED_USERS — (optional) CSV: "user:pass:role,..." for dev/test seed accounts
# STORAGE_CLASS — StorageClass for PVC (e.g. "cephfs", required for file storage)
# STORAGE_SIZE — PVC capacity (e.g. "10Gi", default: "10Gi")
# STORAGE_BACKEND — "pvc" or "s3" (default: "pvc")
#
# Required Gitea Secrets:
# POSTGRES_USER, POSTGRES_PASSWORD
# POSTGRES_ADMIN_USER, POSTGRES_ADMIN_PASSWORD
# SWITCHBOARD_ADMIN_USERNAME, SWITCHBOARD_ADMIN_PASSWORD, SWITCHBOARD_ADMIN_EMAIL
# ENCRYPTION_KEY — AES-256 key for API key encryption (openssl rand -base64 32)
# VENICE_API_KEY (live provider integration tests optional, tests skip if missing)
# ENCRYPTION_KEY — AES-256 key for API key encryption (openssl rand -base64 32)
# PROVIDER_KEY — API key for live provider integration tests (optional, tests skip if missing)
# DOCKERHUB_USERNAME, DOCKERHUB_TOKEN (optional)
# S3_ENDPOINT, S3_BUCKET, S3_ACCESS_KEY, S3_SECRET_KEY (only when STORAGE_BACKEND=s3)
#
@@ -102,12 +105,17 @@ jobs:
- name: Run frontend tests
run: node --test src/js/__tests__/*.test.js
# ── Stage 1b: Go Build & Test ────────────────
# ── Stage 1b: Go Build & Test (Postgres) ─────
test:
runs-on: ubuntu-latest
env:
GOPRIVATE: git.gobha.me/*
GONOSUMCHECK: git.gobha.me/*
# Generic provider config for live integration tests
PROVIDER: ${{ vars.PROVIDER }}
PROVIDER_KEY: ${{ secrets.PROVIDER_KEY }}
PROVIDER_URL: ${{ vars.PROVIDER_URL }}
# Legacy compat: VENICE_API_KEY still works if PROVIDER_KEY is not set
VENICE_API_KEY: ${{ secrets.VENICE_API_KEY }}
steps:
- name: Checkout
@@ -178,10 +186,67 @@ jobs:
working-directory: server
run: CGO_ENABLED=0 go build -o /dev/null .
# ── Stage 1c: Go Build & Test (SQLite) ───────
# Verifies SQLite backend compiles, stores work, and handler
# integration tests pass against an in-memory SQLite database.
# No external database or provider keys required.
test-sqlite:
runs-on: ubuntu-latest
env:
GOPRIVATE: git.gobha.me/*
GONOSUMCHECK: git.gobha.me/*
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Download and tidy
working-directory: server
run: |
go mod download
go mod tidy
- name: Build check (CGO_ENABLED=0)
working-directory: server
run: |
echo "━━━ SQLite Backend Build Check ━━━"
CGO_ENABLED=0 go build -o /dev/null .
echo "✓ Binary compiles with SQLite backend (pure Go, no CGO)"
- name: Run unit tests (no DB)
working-directory: server
run: |
echo "━━━ Unit Tests (no external DB) ━━━"
go test -v -count=1 -p 1 \
./capabilities/... \
./compaction/... \
./crypto/... \
./events/... \
./extraction/... \
./knowledge/... \
./providers/... \
./tools/...
echo "✓ Unit tests complete"
- name: Run SQLite handler integration tests
working-directory: server
env:
DB_DRIVER: sqlite
run: |
echo "━━━ SQLite Integration Tests (handlers + stores) ━━━"
go test -v -count=1 -p 1 \
./handlers/... \
./store/sqlite/...
echo "✓ SQLite integration tests complete"
# ── Stage 2: Build, Database, Deploy ─────────
build-and-deploy:
runs-on: ubuntu-latest
needs: [test, test-frontend]
needs: [test, test-frontend, test-sqlite]
steps:
- name: Checkout
uses: actions/checkout@v4