-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
189 lines (166 loc) · 6.31 KB
/
Taskfile.yml
File metadata and controls
189 lines (166 loc) · 6.31 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
version: '3'
set: ['pipefail']
vars:
PYTEST_TMPDIR: '{{if eq OS "linux"}}/dev/shm/pytest-tmp-{{else}}/tmp/pytest-tmp-{{end}}{{ substr 0 8 (sha256sum .ROOT_DIR) }}'
PYTEST_CACHEDIR: '{{if eq OS "linux"}}/dev/shm/pytest-cache-{{else}}/tmp/pytest-cache-{{end}}{{ substr 0 8 (sha256sum .ROOT_DIR) }}'
tasks:
_tmpdir-setup:
internal: true
desc: Wipe and recreate pytest tmpdir so each run starts clean (platform-aware)
cmds:
- rm -rf {{.PYTEST_TMPDIR}}
- mkdir -p {{.PYTEST_TMPDIR}} {{.PYTEST_CACHEDIR}}
test-all:
desc: Run all tests with parallel workers
deps: [install-worktree, _tmpdir-setup]
env:
PYTHONDONTWRITEBYTECODE: "1"
OMP_NUM_THREADS: "1"
TMPDIR: "{{.PYTEST_TMPDIR}}"
cmds:
- |
mkdir -p temp
TEST_OUTPUT="temp/test-$(date +%Y-%m-%d_%H%M%S).txt"
echo "Running all tests with -n 4"
echo "Output: $TEST_OUTPUT"
if [[ -d ".venv" ]]; then
.venv/bin/lint-imports
PYTEST_CMD=".venv/bin/python -m pytest"
else
lint-imports
PYTEST_CMD="pytest"
fi
set -o pipefail
set +e
$PYTEST_CMD tests/ -q --tb=short -n 4 -m "not smoke" --disable-warnings -o "addopts=" --basetemp={{.PYTEST_TMPDIR}} -o "cache_dir={{.PYTEST_CACHEDIR}}" 2>&1 | tee "$TEST_OUTPUT"
PYTEST_EXIT=$?
set +o pipefail
set -e
echo ""
echo "Test output saved to: $TEST_OUTPUT"
exit $PYTEST_EXIT
test-check:
desc: Run all tests and return unambiguous PASS/FAIL (for automation)
deps: [install-worktree, _tmpdir-setup]
env:
PYTHONDONTWRITEBYTECODE: "1"
OMP_NUM_THREADS: "1"
TMPDIR: "{{.PYTEST_TMPDIR}}"
cmds:
- |
mkdir -p temp
TEST_OUTPUT="temp/test-$(date +%Y-%m-%d_%H%M%S).txt"
if [[ -d ".venv" ]]; then
PYTEST_CMD=".venv/bin/python -m pytest"
else
PYTEST_CMD="pytest"
fi
set -o pipefail
set +e
$PYTEST_CMD tests/ -q --tb=short -n 4 -m "not smoke" --disable-warnings -o "addopts=" --basetemp={{.PYTEST_TMPDIR}} -o "cache_dir={{.PYTEST_CACHEDIR}}" 2>&1 | tee "$TEST_OUTPUT"
PYTEST_EXIT=$?
set +o pipefail
set -e
echo ""
echo "Test output saved to: $TEST_OUTPUT"
if [ "$PYTEST_EXIT" -ne 0 ]; then
echo ""
echo "TEST_RESULT=FAIL"
echo "PYTEST_EXIT_CODE=$PYTEST_EXIT"
exit 1
else
echo ""
echo "TEST_RESULT=PASS"
exit 0
fi
test-smoke:
desc: Run smoke tests (requires ANTHROPIC_API_KEY)
deps: [_tmpdir-setup]
env:
PYTHONDONTWRITEBYTECODE: "1"
OMP_NUM_THREADS: "1"
SMOKE_TEST: "1"
TMPDIR: "{{.PYTEST_TMPDIR}}"
cmds:
- |
mkdir -p temp
TEST_OUTPUT="temp/smoke-$(date +%Y-%m-%d_%H%M%S).txt"
echo "Running smoke tests"
echo "Output: $TEST_OUTPUT"
if [[ -d ".venv" ]]; then
PYTEST_CMD=".venv/bin/python -m pytest"
else
PYTEST_CMD="pytest"
fi
set -o pipefail
set +e
$PYTEST_CMD tests/recipe/test_smoke_pipeline.py -m smoke -v --tb=short -o "addopts=" --basetemp={{.PYTEST_TMPDIR}} -o "cache_dir={{.PYTEST_CACHEDIR}}" 2>&1 | tee "$TEST_OUTPUT"
PYTEST_EXIT=$?
set +o pipefail
set -e
echo ""
echo "Smoke test output saved to: $TEST_OUTPUT"
exit $PYTEST_EXIT
test-smoke-record:
desc: Record smoke test scenario by running autoskillit order with recording enabled
env:
RECORD_SCENARIO: "1"
RECORD_SCENARIO_DIR: '{{.RECORD_SCENARIO_DIR | default "tests/fixtures/scenarios/smoke-happy"}}'
RECORD_SCENARIO_RECIPE: "smoke-test"
cmds:
- |
mkdir -p "$RECORD_SCENARIO_DIR"
echo "Recording smoke-test scenario"
echo " RECORD_SCENARIO_DIR=$RECORD_SCENARIO_DIR"
echo ""
autoskillit order smoke-test
check-docs:
desc: Verify documentation counts match source code
cmds:
- python scripts/check_doc_counts.py
sync-plugin-version:
desc: Sync plugin.json version from pyproject.toml
cmds:
- python scripts/sync_plugin_json.py
sync-hooks-hash:
desc: "Regenerate src/autoskillit/hooks/registry.sha256 from the live HOOK_REGISTRY"
cmds:
- uv run python -c "from autoskillit.hook_registry import HOOK_REGISTRY_HASH, HOOKS_DIR; (HOOKS_DIR / 'registry.sha256').write_text(HOOK_REGISTRY_HASH + '\n')"
install-worktree:
desc: Set up development environment (isolated venv in worktrees, direct install in main)
status:
- test -x .venv/bin/python
- uv sync --check --all-extras 2>/dev/null
cmds:
- |
# Detect if we're in a git worktree (worktrees have .git as a file, not a directory)
if [[ -f ".git" ]]; then
echo "Worktree detected — creating isolated venv"
uv venv --clear .venv
uv pip install -e '.[dev]' --python .venv/bin/python
elif [[ -d ".venv" ]]; then
echo "Main directory — installing into existing venv"
uv pip install -e '.[dev]' --python .venv/bin/python
else
echo "Main directory — creating venv and installing"
uv venv --clear .venv
uv pip install -e '.[dev]' --python .venv/bin/python
fi
echo "Done: $(python --version 2>/dev/null || .venv/bin/python --version)"
install-dev:
desc: Install dev version of autoskillit from the integration branch
cmds:
- uv tool install --force "autoskillit[dev] @ git+https://github.com/TalonT-Org/AutoSkillit.git@integration"
- "$(uv tool dir)/autoskillit/bin/autoskillit install"
vendor-mermaid:
desc: Download latest mermaid v11 UMD bundle to src/autoskillit/assets/mermaid/
cmds:
- mkdir -p src/autoskillit/assets/mermaid
- |
VERSION=$(curl -sfL https://unpkg.com/mermaid@11/package.json \
| python3 -c "import sys, json; print(json.load(sys.stdin)['version'])")
echo "Fetching mermaid ${VERSION}..."
curl -sfL "https://unpkg.com/mermaid@${VERSION}/dist/mermaid.min.js" \
-o src/autoskillit/assets/mermaid/mermaid.min.js
echo "${VERSION}" > src/autoskillit/assets/mermaid/VERSION
echo "Vendored mermaid ${VERSION} ($(wc -c < src/autoskillit/assets/mermaid/mermaid.min.js) bytes)"