-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
302 lines (269 loc) · 9.72 KB
/
Copy pathTaskfile.yml
File metadata and controls
302 lines (269 loc) · 9.72 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# https://taskfile.dev
version: "3"
vars:
CONTAINER_NAME: ghcr.io/openimagingdata/findingmodelforge
DATE_TAG: "{{now | date \"20060102\"}}"
tasks:
default:
desc: "Show available tasks"
cmds:
- task -l
silent: true
install:
desc: "Install dependencies and setup environment"
cmds:
- echo "📦 Installing Python dependencies..."
- uv sync --all-extras --dev
- echo "📦 Installing Node.js dependencies..."
- npm install
- echo "✅ Dependencies installed!"
silent: true
setup:
desc: "Setup development environment (install deps + create .env + build assets)"
cmds:
- task: install
- |
if [ ! -f ".env" ]; then
echo "📝 Creating .env file from template..."
cp .env.example .env
echo "⚠️ Please edit .env file with your GitHub OAuth credentials"
else
echo "✅ .env file already exists"
fi
- echo "🎨 Building frontend assets..."
- npm run build
- echo "✅ Setup complete!"
silent: true
# Development tasks
dev:
desc: "Start development server"
cmds:
- echo "🚀 Starting Finding Model Forge development server..."
- task: setup
- echo "🌐 Starting server on http://localhost:8000"
- uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload --proxy-headers --forwarded-allow-ips "*"
silent: true
dev-vite:
desc: "Start development server with Vite dev mode"
cmds:
- echo "🚀 Starting Finding Model Forge with Vite dev mode..."
- task: setup
- echo "👀 Starting Vite dev server in background..."
- npm run dev &
- echo "🌐 Starting FastAPI server on http://localhost:8000"
- echo "💡 Vite dev server running on http://localhost:5173"
- echo "💡 Frontend changes will auto-reload. Press Ctrl+C to stop both processes."
- uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload --proxy-headers --forwarded-allow-ips "*"
silent: true
dev-watch:
desc: "Start development server with CSS watch mode"
cmds:
- echo "🚀 Starting Finding Model Forge with CSS watching..."
- task: setup
- echo "👀 Starting CSS watch mode in background..."
- npm run watch:css &
- echo "🌐 Starting server on http://localhost:8000"
- echo "💡 CSS changes will auto-rebuild. Press Ctrl+C to stop both processes."
- uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload --proxy-headers --forwarded-allow-ips "*"
silent: true
run:
desc: "Run the app (alias for dev)"
cmds:
- task: dev
# Frontend tasks
build-css:
desc: "Build CSS from Tailwind sources"
cmds:
- echo "🎨 Building CSS..."
- npm run build:css
- echo "✅ CSS build complete!"
silent: true
watch-css:
desc: "Watch and rebuild CSS on changes"
cmds:
- echo "👀 Watching CSS for changes..."
- npm run watch:css
silent: true
watch-js:
desc: "Watch and rebuild JavaScript on changes (Vite dev mode)"
cmds:
- echo "� Starting Vite dev server for JavaScript watching..."
- npm run dev
silent: true
build-frontend:
desc: "Build all frontend assets (CSS + JS)"
cmds:
- echo "🎨 Building frontend assets..."
- npm run build
- echo "✅ Frontend build complete!"
silent: true
# Code quality tasks
format:
desc: "Format code and markdown (fixes formatting issues)"
cmds:
- echo "🎨 Formatting Finding Model Forge code..."
- uv run ruff format .
- echo "🎨 Formatting Markdown files..."
- npm run format
- echo "✅ Code and Markdown formatting complete!"
silent: true
format-code:
desc: "Format Python code only"
cmds:
- echo "🎨 Formatting Python code..."
- uv run ruff format .
- echo "✅ Code formatting complete!"
silent: true
format-markdown:
desc: "Format Markdown files only"
cmds:
- echo "🎨 Formatting Markdown files..."
- npm run format
- echo "✅ Markdown formatting complete!"
silent: true
lint:
desc: "Lint and fix code and markdown issues"
cmds:
- echo "🎨 Formatting and linting Finding Model Forge code..."
- uv run ruff format .
- echo "🔍 Fixing linting issues..."
- uv run ruff check --fix .
- echo "🎨 Formatting Markdown files..."
- npm run format
- echo "🔎 Running type checking..."
- uv run mypy .
- echo "✅ Code and Markdown formatting and linting complete!"
silent: true
check:
desc: "Run quality checks (read-only, for CI)"
cmds:
- echo "🔍 Running Finding Model Forge quality checks..."
- echo "🔍 Checking linting..."
- uv run ruff check .
- echo "🎨 Checking code formatting..."
- uv run ruff format --check .
- echo "🎨 Checking Markdown formatting..."
- npm run format:check
- echo "🔎 Running type checking..."
- uv run mypy .
- echo "✅ All quality checks passed!"
silent: true
# Testing tasks
test:
desc: "Run tests with coverage"
cmds:
- echo "🧪 Running Finding Model Forge tests..."
- echo "📋 Running tests with coverage..."
- uv run pytest -m "not playwright" --cov=app --cov-report=term-missing --cov-report=html
- echo "✅ All tests passed!"
silent: true
test-unit:
desc: "Run unit tests only (fast, for development)"
cmds:
- echo "⚡ Running unit tests (excluding integration tests)..."
- uv run pytest -m "not integration and not playwright" --no-cov -q
- echo "✅ Unit tests passed!"
silent: true
test-integration:
desc: "Run integration tests only"
cmds:
- echo "🔗 Running integration tests..."
- uv run pytest -m "integration and not playwright" --no-cov -q
- echo "✅ Integration tests passed!"
silent: true
test-ui:
desc: "Run all UI/browser tests (organized in tests/ui/)"
cmds:
- echo "🎭 Running UI/browser tests..."
- echo "💡 Make sure the development server is running on localhost:8000"
- uv run pytest tests/ui/ -v --no-cov
- echo "✅ UI tests passed!"
silent: true
test-ui-headed:
desc: "Run UI tests with visible browser (for debugging)"
cmds:
- echo "🎭 Running UI tests with visible browser..."
- echo "💡 Make sure the development server is running on localhost:8000"
- PLAYWRIGHT_HEADLESS=false uv run pytest tests/ui/ -v --no-cov -s
- echo "✅ UI tests completed!"
silent: true
test-ui-profile:
desc: "Run only profile page UI tests"
cmds:
- echo "🏠 Running profile page tests..."
- echo "💡 Make sure the development server is running on localhost:8000"
- uv run pytest tests/ui/test_profile.py -v --no-cov
- echo "✅ Profile tests passed!"
silent: true
test-ui-creation:
desc: "Run only creation workflow UI tests"
cmds:
- echo "⚡ Running creation workflow tests..."
- echo "💡 Make sure the development server is running on localhost:8000"
- uv run pytest tests/ui/test_creation_workflow.py -v --no-cov
- echo "✅ Creation workflow tests passed!"
silent: true
test-ui-drafts:
desc: "Run only draft management UI tests"
cmds:
- echo "📝 Running draft management tests..."
- echo "💡 Make sure the development server is running on localhost:8000"
- uv run pytest tests/ui/test_draft_management.py -v --no-cov
- echo "✅ Draft management tests passed!"
silent: true
# Legacy commands for backward compatibility
test-playwright:
desc: "Run all UI tests (alias for test-ui)"
cmds:
- task: test-ui
test-playwright-headed:
desc: "Run UI tests with visible browser (alias for test-ui-headed)"
cmds:
- task: test-ui-headed
test-full:
desc: "Run full test suite with quality checks"
cmds:
- task: check
- task: test
silent: true
# Docker tasks
build:
desc: "Build Docker image"
cmds:
- echo "🐳 Building Finding Model Forge Docker image..."
- docker build --platform linux/amd64 -t {{.CONTAINER_NAME}}:latest -t {{.CONTAINER_NAME}}:{{.DATE_TAG}} .
- echo "📊 Image sizes:"
- docker images {{.CONTAINER_NAME}} --format "table {{`{{.Repository}}`}}\t{{`{{.Tag}}`}}\t{{`{{.Size}}`}}" | head -6 || echo "No images found"
- echo "✅ Docker build complete!"
silent: true
run-container:
desc: "Run the app in a Docker container"
cmds:
- echo "🐳 Running FindingModelForge container..."
- docker run --name findingmodelforge --platform linux/amd64 -d --env-file .env.container -p 8000:8000 --rm {{.CONTAINER_NAME}}:latest
- echo "🌐 Container running on http://localhost:8000"
- echo "💡 Use 'docker logs findingmodelforge' to see logs"
- echo "💡 Use 'docker stop findingmodelforge' to stop"
- echo "✅ Container automatically handles proxy headers (X-Forwarded-Proto, etc.)"
silent: true
# Utility tasks
clean:
desc: "Clean up build artifacts and caches"
cmds:
- echo "🧹 Cleaning up Python artifacts..."
- rm -rf .pytest_cache/ .mypy_cache/ .ruff_cache/ htmlcov/ .coverage
- echo "🧹 Cleaning up frontend build artifacts..."
- rm -f static/css/output.css
- rm -rf static/.vite/ static/js/
- echo "🧹 Cleaning up Node.js artifacts..."
- rm -rf node_modules/
- echo "✅ Cleanup complete!"
silent: true
pre-commit:
desc: "Install and run pre-commit hooks"
cmds:
- echo "🔗 Setting up pre-commit..."
- uv run pre-commit install
- echo "🔍 Running pre-commit on all files..."
- uv run pre-commit run --all-files
silent: true