-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
133 lines (114 loc) · 4.64 KB
/
Taskfile.yml
File metadata and controls
133 lines (114 loc) · 4.64 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
version: '3'
# Taskfile for copier-fullstack-template (template source verification)
# Runs verification on the template itself, NOT on rendered projects.
# Requires: python, copier (via uvx), bun
vars:
BACKEND_SRC: template/backend/src
tasks:
# ── Architecture checks ──
architecture:boundaries:
desc: Verify core layer has zero outward imports (Clean Architecture)
cmds:
- python scripts/check-architecture-boundaries.py {{.BACKEND_SRC}}
# ── Convention checks ──
conventions:no-final:
desc: Verify no Final[] type annotations on module-level constants
cmds:
- python scripts/check-no-final.py {{.BACKEND_SRC}}
conventions:fastapi-status-codes:
desc: Verify FastAPI status constants are used (no numeric status_code literals)
cmds:
- python scripts/check-fastapi-status-codes.py {{.BACKEND_SRC}}
conventions:module-docstrings:
desc: Verify module-level docstrings exist in Python/Python-template files
cmds:
- python scripts/check-module-docstrings.py scripts template/backend/src template/tools
github:alignment:
desc: Enforce core template/.github alignment conventions
cmds:
- bash scripts/check-github-alignment.sh
# ── Render smoke test ──
render:
desc: Render template with test defaults and verify output
platforms: [linux, darwin]
preconditions:
- sh: command -v copier || command -v uvx
msg: "copier is required -- install via 'uv tool install copier' or use 'uvx copier'"
vars:
OUT_DIR:
sh: python -c "import tempfile, pathlib; print(pathlib.Path(tempfile.mkdtemp(prefix='copier-test-render-')).as_posix())"
SRC_DIR: "{{.OUT_DIR}}/template-src"
RENDER_DIR: "{{.OUT_DIR}}/rendered"
cmds:
- python scripts/copy-template-snapshot.py . {{.SRC_DIR}} {{.OUT_DIR}}
- |
echo "Rendering template to {{.RENDER_DIR}}..."
uvx copier copy --trust --defaults \
-d project_name="Test Project" \
-d project_slug="test_project" \
-d project_description="Smoke test render" \
-d author_name="CI Bot" \
-d author_email="ci@test.local" \
-d github_username="ci-bot" \
"{{.SRC_DIR}}" "{{.RENDER_DIR}}"
echo "[OK] Template rendered successfully"
echo "Checking rendered output structure..."
for f in backend/pyproject.toml frontend/package.json Taskfile.yml .github/workflows/ci.yml; do
if [ ! -f "{{.RENDER_DIR}}/$f" ]; then
echo "[FAIL] Missing expected file: $f"
exit 1
fi
done
echo "[OK] All expected files present in rendered output"
test:rendered:
desc: Render template and run generated backend/frontend test suites
platforms: [linux, darwin]
preconditions:
- sh: command -v uvx
msg: "uvx is required -- install uv from https://docs.astral.sh/uv/getting-started/"
- sh: command -v bun
msg: "bun is required -- install from https://bun.sh/docs/installation"
vars:
OUT_DIR:
sh: python -c "import tempfile, pathlib; print(pathlib.Path(tempfile.mkdtemp(prefix='copier-test-render-tests-')).as_posix())"
SRC_DIR: "{{.OUT_DIR}}/template-src"
RENDER_DIR: "{{.OUT_DIR}}/rendered"
cmds:
- python scripts/copy-template-snapshot.py . {{.SRC_DIR}} {{.OUT_DIR}}
- |
echo "Rendering template to {{.RENDER_DIR}} for test execution..."
uvx copier copy --trust --defaults \
-d project_name="Test Project" \
-d project_slug="test_project" \
-d project_description="Rendered test suite" \
-d author_name="CI Bot" \
-d author_email="ci@test.local" \
-d github_username="ci-bot" \
"{{.SRC_DIR}}" "{{.RENDER_DIR}}"
echo "Running generated backend quality + tests..."
cd "{{.RENDER_DIR}}/backend"
uv sync --all-extras
uv run tox -e lint,typecheck,security
uv run pytest tests/unit tests/property -v --tb=short
echo "Running generated frontend quality + tests..."
cd "{{.RENDER_DIR}}/frontend"
bun install
bun run lint
bun run typecheck
bun run test
echo "[OK] Rendered backend/frontend tests passed"
# ── Aggregate ──
verify-all:
desc: Run all template verification checks
cmds:
- task: architecture:boundaries
- task: conventions:no-final
- task: conventions:fastapi-status-codes
- task: conventions:module-docstrings
- task: github:alignment
ci:
desc: Full CI suite (verify + render smoke test)
cmds:
- task: verify-all
- task: render
- task: test:rendered