Files
resolutionflow/.github/workflows/ci.yml
chihlasm e216d5039e test: add export security tests and CI coverage reporting
Export security tests (26 new tests):
- 11 XSS prevention tests covering all user-supplied fields in HTML export
  (tree name, ticket, client, decisions, notes, timestamps, scratchpad)
- 7 edge case tests (unicode/emoji, empty decisions, missing fields, long content)
- 5 format-specific tests (markdown headers, text numbering)
- 3 HTML structure tests (valid document, CSS, timestamp toggle)

CI coverage reporting:
- Add --cov=app --cov-report flags to pytest in GitHub Actions
- Display per-module coverage summary after test run
- Baseline: 63% overall, 98% on export_service.py

Total tests: 215 (189 existing + 26 new)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 14:53:22 -05:00

94 lines
2.5 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
backend:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: patherly_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/patherly_test
DATABASE_URL_SYNC: postgresql://postgres:postgres@localhost:5432/patherly_test
SECRET_KEY: ci-test-secret-key-not-for-production
DEBUG: "true"
APP_NAME: ResolutionFlow
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-path: |
backend/requirements.txt
backend/requirements-dev.txt
- name: Install dependencies
run: pip install -r backend/requirements.txt -r backend/requirements-dev.txt
- name: Run tests with coverage
run: cd backend && python -m pytest --override-ini="addopts=" --cov=app --cov-report=term-missing --cov-report=json:coverage.json
- name: Display coverage summary
if: always()
run: |
cd backend
python -c "
import json
with open('coverage.json') as f:
data = json.load(f)
total = data['totals']['percent_covered_display']
print(f'Total coverage: {total}%')
print()
print('Module coverage:')
for fname, fdata in sorted(data['files'].items()):
pct = fdata['summary']['percent_covered_display']
if float(pct) < 80:
print(f' ⚠ {fname}: {pct}%')
else:
print(f' ✓ {fname}: {pct}%')
"
frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: cd frontend && npm ci
- name: Lint
run: cd frontend && npm run lint
- name: Build
run: cd frontend && npm run build