Repository navigation
Expand file tree
/
Copy pathTiltfile
More file actions
176 lines (158 loc) · 5.52 KB
/
Copy pathTiltfile
File metadata and controls
176 lines (158 loc) · 5.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# ===============================================================================
# FORGE — LOCAL IMAGE GENERATION PLATFORM - TILTFILE
# ===============================================================================
#
# A standalone Tiltfile for the Forge project.
# Run with: tilt up --port=10352
#
# Resource Groups:
# Backend - Python FastAPI backend (port 7860)
# Frontend - React + Vite dev server (port 5173)
# Testing - Backend pytest, frontend type-check
# Quality - Lint, security audit, dependency health
#
# ===============================================================================
# ===============================================================================
# 1. BACKEND
# ===============================================================================
# --- Backend Dev Server (FastAPI + uvicorn --reload) ---
local_resource(
name='forge-backend',
labels=['Backend'],
serve_cmd='.venv\\Scripts\\python -m uvicorn forge.main:app --reload --host 0.0.0.0 --port 7860',
serve_dir='backend',
links=[
link('http://localhost:7860/docs', 'API Docs (Swagger)'),
link('http://localhost:7860/redoc', 'API Docs (ReDoc)'),
link('http://localhost:7860/api/system/health', 'Health Check'),
link('http://localhost:7860/api/system/info', 'System Info'),
],
readiness_probe=probe(
http_get=http_get_action(port=7860, path='/api/system/health'),
initial_delay_secs=5,
period_secs=10,
),
)
# --- Backend Install Dependencies ---
local_resource(
name='forge-backend-install',
labels=['Backend'],
cmd='cd backend && .venv\\Scripts\\pip install -e ".[dev]"',
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False,
allow_parallel=True,
)
# ===============================================================================
# 2. FRONTEND
# ===============================================================================
# --- Frontend Dev Server (Vite, proxies /api + /ws to backend) ---
local_resource(
name='forge-frontend',
labels=['Frontend'],
serve_cmd='npm run dev',
serve_dir='frontend',
resource_deps=['forge-backend'],
links=[
link('http://localhost:5173', 'Forge UI'),
link('http://localhost:5173/gallery', 'Gallery'),
link('http://localhost:5173/models', 'Models'),
link('http://localhost:5173/settings', 'Settings'),
],
)
# --- Frontend Install Dependencies ---
local_resource(
name='forge-frontend-install',
labels=['Frontend'],
cmd='cd frontend && npm install',
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False,
allow_parallel=True,
)
# ===============================================================================
# 3. TESTING
# ===============================================================================
# --- Backend Tests (pytest) ---
local_resource(
name='forge-backend-tests',
labels=['Testing'],
cmd='cd backend && .venv\\Scripts\\python -m pytest tests/ -v --tb=short',
trigger_mode=TRIGGER_MODE_MANUAL,
allow_parallel=True,
)
# --- Backend Tests with Coverage ---
local_resource(
name='forge-backend-tests-coverage',
labels=['Testing'],
cmd='cd backend && .venv\\Scripts\\python -m pytest tests/ -v --cov=forge --cov-report=term-missing',
trigger_mode=TRIGGER_MODE_MANUAL,
allow_parallel=True,
)
# --- Frontend Type Check ---
local_resource(
name='forge-frontend-typecheck',
labels=['Testing'],
cmd='cd frontend && npx tsc --noEmit',
trigger_mode=TRIGGER_MODE_MANUAL,
allow_parallel=True,
)
# --- Frontend Build (production) ---
local_resource(
name='forge-frontend-build',
labels=['Testing'],
cmd='cd frontend && npx vite build',
trigger_mode=TRIGGER_MODE_MANUAL,
allow_parallel=True,
)
# --- E2E Tests (Playwright, depends on frontend + backend) ---
local_resource(
name='forge-e2e',
labels=['Testing'],
cmd='cd e2e && npx playwright test',
resource_deps=['forge-frontend', 'forge-backend'],
trigger_mode=TRIGGER_MODE_MANUAL,
)
# --- E2E Tests (headed, for debugging) ---
local_resource(
name='forge-e2e-headed',
labels=['Testing'],
cmd='cd e2e && npx playwright test --headed',
resource_deps=['forge-frontend', 'forge-backend'],
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False,
)
# ===============================================================================
# 4. QUALITY
# ===============================================================================
# --- Backend Lint (ruff) ---
local_resource(
name='forge-backend-lint',
labels=['Quality'],
cmd='cd backend && .venv\\Scripts\\ruff check forge/',
trigger_mode=TRIGGER_MODE_MANUAL,
allow_parallel=True,
)
# --- Backend Lint Fix ---
local_resource(
name='forge-backend-lint-fix',
labels=['Quality'],
cmd='cd backend && .venv\\Scripts\\ruff check --fix forge/',
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False,
allow_parallel=True,
)
# --- Frontend Security Audit ---
local_resource(
name='forge-frontend-audit',
labels=['Quality'],
cmd='cd frontend && npm audit --audit-level=high',
trigger_mode=TRIGGER_MODE_MANUAL,
allow_parallel=True,
)
# --- Dependency Health Check ---
local_resource(
name='forge-deps-health',
labels=['Quality'],
cmd='powershell -Command "cd frontend; npm outdated; exit 0"',
trigger_mode=TRIGGER_MODE_MANUAL,
allow_parallel=True,
)