Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 180 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
name: CI Pipeline

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

env:
PYTHON_VERSION: "3.11"
NODE_VERSION: "20"

jobs:
# ==================== API Tests ====================
api-tests:
name: API Tests
runs-on: ubuntu-latest

services:
postgres:
image: postgres:15
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: nerdlearn_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'

- name: Install dependencies
working-directory: ./apps/api
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-asyncio pytest-cov httpx aiosqlite

- name: Run tests
working-directory: ./apps/api
env:
DATABASE_URL: postgresql+asyncpg://test:test@localhost:5432/nerdlearn_test
REDIS_URL: redis://localhost:6379/0
SECRET_KEY: test-secret-key
run: |
pytest tests/ -v --cov=app --cov-report=xml --cov-report=term

- name: Upload coverage
uses: codecov/codecov-action@v4
with:
file: ./apps/api/coverage.xml
flags: api
fail_ci_if_error: false

# ==================== Worker Tests ====================
worker-tests:
name: Worker Tests
runs-on: ubuntu-latest

services:
redis:
image: redis:7
ports:
- 6379:6379

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'

- name: Install dependencies
working-directory: ./apps/worker
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov

- name: Run tests
working-directory: ./apps/worker
env:
REDIS_URL: redis://localhost:6379/0
run: |
pytest tests/ -v --cov=app --cov-report=xml || true

# ==================== Web Tests ====================
web-tests:
name: Web Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: './apps/web/package-lock.json'

- name: Install dependencies
working-directory: ./apps/web
run: npm ci

- name: Type check
working-directory: ./apps/web
run: npm run typecheck || true

- name: Lint
working-directory: ./apps/web
run: npm run lint || true

- name: Build
working-directory: ./apps/web
run: npm run build

# ==================== Lint ====================
lint:
name: Lint & Type Check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install linters
run: |
pip install ruff mypy

- name: Run ruff (API)
working-directory: ./apps/api
run: ruff check . || true

- name: Run ruff (Worker)
working-directory: ./apps/worker
run: ruff check . || true

# ==================== Security Scan ====================
security:
name: Security Scan
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
scan-ref: '.'
severity: 'CRITICAL,HIGH'
exit-code: '0' # Don't fail on findings for now
17 changes: 17 additions & 0 deletions apps/api/app/adaptive/stealth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@
ECDAssessor,
)

from .ml_evidence_rules import (
# Feature Engineering
EngagementFeatures,
FeatureExtractor,
# Neural Evidence Predictor
NeuralEvidencePredictor,
# ML Evidence Rules
MLEvidenceRule,
EnsembleEvidencePredictor,
)

__all__ = [
# Telemetry Collector
"TelemetryCollector",
Expand Down Expand Up @@ -77,4 +88,10 @@
"AssemblyModel",
# Integrated Assessor
"ECDAssessor",
# ML Evidence Rules
"EngagementFeatures",
"FeatureExtractor",
"NeuralEvidencePredictor",
"MLEvidenceRule",
"EnsembleEvidencePredictor",
]
Loading
Loading