-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
307 lines (259 loc) · 8.3 KB
/
Taskfile.yaml
File metadata and controls
307 lines (259 loc) · 8.3 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
303
304
305
306
307
version: 3
env:
UV_LINK_MODE: copy
tasks:
default:
desc: Display available tasks
cmds:
- task -l
restart-api:
dir: "{{.USER_WORKING_DIR}}"
cmds:
- echo "tRestarting API service..."
- docker compose restart api
desc: Restart the API service
generate:
dir: ui
dotenv: [.env]
cmds:
- docker compose -f ../compose.yaml restart api && sleep 2
- curl http://api:$API_PORT/openapi.json | jq > ../docs/oas/openapi.json
- bunx orval@7.14.0 --config ./orval.config.cjs
- bunx prettier . --write --log-level error
- bunx eslint . --fix -c eslint.config.mjs --quiet
desc: Generate the TypeScript client
knowledge:
desc: Generate task knowledge JSON from markdown files
cmds:
- uv run scripts/generate_task_knowledge.py
knowledge-pull:
desc: Pull task-knowledge.json from the knowledge repository (KNOWLEDGE_REPO_URL)
dotenv: [.env]
cmds:
- |
KNOWLEDGE_DIR="config/task-knowledge"
if [ -z "$KNOWLEDGE_REPO_URL" ]; then
echo "KNOWLEDGE_REPO_URL not set, skipping pull"
exit 0
fi
# Build auth URL if credentials available
AUTH_URL="$KNOWLEDGE_REPO_URL"
if [ -n "$GITHUB_USER" ] && [ -n "$GITHUB_TOKEN" ]; then
AUTH_URL=$(echo "$KNOWLEDGE_REPO_URL" | sed "s|https://|https://${GITHUB_USER}:${GITHUB_TOKEN}@|")
fi
# Clone or pull
if [ -d "$KNOWLEDGE_DIR/.git" ]; then
echo "Pulling latest from $KNOWLEDGE_REPO_URL..."
git -C "$KNOWLEDGE_DIR" remote set-url origin "$AUTH_URL"
git -C "$KNOWLEDGE_DIR" fetch origin && git -C "$KNOWLEDGE_DIR" reset --hard origin/main || {
echo "Pull failed, re-cloning..."
rm -rf "$KNOWLEDGE_DIR"
git clone --depth 1 "$AUTH_URL" "$KNOWLEDGE_DIR"
}
else
echo "Cloning $KNOWLEDGE_REPO_URL..."
rm -rf "$KNOWLEDGE_DIR"
mkdir -p config
git clone --depth 1 "$AUTH_URL" "$KNOWLEDGE_DIR"
fi
# Verify JSON exists in the cloned repo
if [ -f "$KNOWLEDGE_DIR/task-knowledge.json" ]; then
echo "task-knowledge.json ready ($(du -h "$KNOWLEDGE_DIR/task-knowledge.json" | cut -f1))"
else
echo "WARNING: task-knowledge.json not found in repo; it will be generated on next PR merge" >&2
fi
docs:
dir: docs
cmds:
- bun install
- bun run docs:dev --host
# =============================================================================
# Python Tests (all tests run in-memory, no MongoDB required)
# =============================================================================
test:
desc: Run all Python tests
cmds:
- uv run pytest tests/ -v
test-fast:
desc: Run tests, stop on first failure
cmds:
- uv run pytest tests/ -v -x --tb=short
test-api:
desc: Run API router tests
cmds:
- uv run pytest tests/qdash/api/ -v
test-workflow:
desc: Run workflow engine tests
cmds:
- uv run pytest tests/qdash/workflow/ -v
test-repository:
desc: Run repository tests
cmds:
- uv run pytest tests/qdash/workflow/engine/repository/ -v
test-ui:
desc: Run UI tests
dir: ui
cmds:
- bun run test:run
test-coverage:
desc: Run tests with coverage report
cmds:
- uv run pytest tests/ --cov=src/qdash --cov-report=term --cov-report=html
test-parallel:
desc: Run tests in parallel (requires pytest-xdist)
cmds:
- uv run pytest tests/ -v -n auto
test-watch:
desc: Run tests in watch mode (requires pytest-watch)
cmds:
- uv run ptw -- -v --tb=short
build:
dir: ui
cmds:
- bun run build
drawio-export:
desc: Export .drawio files to .drawio.png (requires draw.io desktop CLI)
cmds:
- |
n=10
for f in docs/diagrams/*.drawio; do
out="${f}.png"
echo "Exporting $f -> $out"
xvfb-run -n $n drawio --no-sandbox --export --format png --embed-diagram --scale 2 --output "$out" "$f"
n=$((n + 1))
done
build-docs:
dir: docs
cmds:
- npm run docs:build
# =============================================================================
# Linting & Formatting (local development - auto-fix)
# =============================================================================
lint:
desc: Run all linting and formatting (Python + UI)
cmds:
- task: lint-python
- task: lint-ui
lint-python:
desc: Run Python linting and formatting (auto-fix)
cmds:
- uv run ruff check --fix --quiet .
- uv run ruff format --quiet .
lint-ui:
dir: ui
desc: Run UI linting and formatting (auto-fix)
cmds:
- bunx prettier . --write --log-level error
- bunx eslint . --fix -c eslint.config.mjs --quiet
# =============================================================================
# Local Check (run before push)
# =============================================================================
check:
desc: Run all checks locally (lint, typecheck, test)
cmds:
- task: ci-lint
- task: ci-typecheck
- task: ci-test
check-all:
desc: Run all checks including UI
cmds:
- task: check
- task: ci-ui
# =============================================================================
# CI Checks (check-only, no auto-fix)
# =============================================================================
ci:
desc: "[CI] Run all Python CI checks"
cmds:
- task: ci-lint
- task: ci-typecheck
- task: ci-test
ci-lint:
desc: Check Python linting (no auto-fix)
cmds:
- uv run ruff check .
- uv run ruff format --check .
ci-typecheck:
desc: Run mypy type checking
cmds:
- uv run mypy src/qdash/common src/qdash/datamodel src/qdash/dbmodel src/qdash/repository src/qdash/api src/qdash/workflow tests
ci-test:
desc: Run all tests with coverage
cmds:
- uv run pytest tests/ -v --tb=short --cov=src/qdash --cov-report=xml --cov-report=term
knip:
desc: Check for unused exports, dependencies, and files in UI
dir: ui
cmds:
- bun run knip
knip-fix:
desc: Auto-fix unused exports and dependencies in UI
dir: ui
cmds:
- bun run knip:fix
ci-ui:
desc: Run all UI CI checks
dir: ui
cmds:
- bun run test:run
- bunx eslint . -c eslint.config.mjs
- bunx prettier . --check
ci-ui-build:
desc: Build UI for production
dir: ui
cmds:
- bun run build
# =============================================================================
# Legacy aliases (for backwards compatibility)
# =============================================================================
lint-mypy:
desc: "[Deprecated] Use ci-typecheck instead"
cmds:
- task: ci-typecheck
tbls-docs:
cmds:
- tbls doc -c .tbls.yml -f
desc: Generate DB Schema Docs
export-api:
cmds:
- uv export --group api --no-hashes --no-dev --no-emit-project --no-editable --format requirements-txt > ./src/qdash/api/requirements.txt
desc: Export server requirements
export-workflow:
cmds:
- uv export --group workflow --no-hashes --no-dev --no-emit-project --no-editable --format requirements-txt > ./src/qdash/workflow/requirements.txt
desc: Export qcflow requirements
export-dev:
cmds:
- uv export --all-groups --no-hashes --no-emit-project --no-editable --format requirements-txt > .devcontainer/requirements.txt
desc: Export all requirements
export-all:
cmds:
- task export-api
- task export-workflow
- task export-dev
desc: Export all requirements
build-api:
cmds:
- task export-api
- docker compose build --no-cache api
build-workflow:
cmds:
- task export-workflow
- docker compose build --no-cache workflow
deploy-local:
cmds:
- task: knowledge-pull
- docker compose up -d --build
desc: Deploy the application with Docker Compose in dev mode
dev-ui:
dir: ui
cmds:
- bun run dev
desc: Start the UI development server
deploy:
cmds:
- task: knowledge-pull
- docker compose --profile tunnel up -d --build
- sleep 3
- docker compose restart api
desc: Deploy the application with Docker Compose