-
Notifications
You must be signed in to change notification settings - Fork 0
259 lines (223 loc) · 8.51 KB
/
test-windows.yml
File metadata and controls
259 lines (223 loc) · 8.51 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
name: Test Windows
on:
push:
branches: [main]
paths:
- 'pkg/hanzo-mcp/**'
- 'pkg/hanzo-tools-*/**'
- 'pkg/hanzo-async/**'
- 'hanzoai/**'
- '.github/workflows/test-windows.yml'
pull_request:
branches: [main]
paths:
- 'pkg/hanzo-mcp/**'
- 'pkg/hanzo-tools-*/**'
- 'pkg/hanzo-async/**'
- 'hanzoai/**'
- '.github/workflows/test-windows.yml'
workflow_dispatch:
jobs:
# Native Windows (no WSL)
test-windows-native:
name: Windows Native (Python ${{ matrix.python-version }})
runs-on: windows-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
python-version: ['3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Install core packages
shell: pwsh
run: |
uv venv
.\.venv\Scripts\Activate.ps1
# hanzoai is the root workspace package
uv pip install -e .
# Async layer (uvloop skipped automatically on Windows)
uv pip install -e ./pkg/hanzo-async
# Test deps
uv pip install pytest pytest-asyncio pytest-cov
- name: Test hanzoai SDK imports
shell: pwsh
run: |
.\.venv\Scripts\Activate.ps1
python -c "from hanzoai import __version__; print(f'hanzoai {__version__}')"
python -c "import hanzo_async; print(f'uvloop active: {hanzo_async.using_uvloop()}')"
- name: Test hanzo-async (no uvloop on Windows)
shell: pwsh
run: |
.\.venv\Scripts\Activate.ps1
python -c "
import sys, asyncio
from hanzo_async import using_uvloop, read_file, write_file, path_exists, mkdir
assert sys.platform == 'win32'
assert not using_uvloop(), 'uvloop should not be active on Windows'
print('hanzo-async: OK (asyncio backend)')
"
- name: Install tool packages
shell: pwsh
run: |
.\.venv\Scripts\Activate.ps1
uv pip install -e ./pkg/hanzo-tools
uv pip install -e ./pkg/hanzo-tools-core 2>$null; $true
uv pip install -e ./pkg/hanzo-tools-fs
uv pip install -e ./pkg/hanzo-tools-shell
uv pip install -e ./pkg/hanzo-tools-reasoning
uv pip install -e ./pkg/hanzo-tools-memory
uv pip install -e ./pkg/hanzo-tools-todo
uv pip install -e ./pkg/hanzo-tools-config
- name: Test tool imports on Windows
shell: pwsh
run: |
.\.venv\Scripts\Activate.ps1
python -c "
import sys
assert sys.platform == 'win32'
# Shell tools should resolve to pwsh/cmd on Windows
from hanzo_tools.shell.cmd_tool import CmdTool
tool = CmdTool()
shell = tool.default_shell
print(f'Resolved shell: {shell}')
assert 'pwsh' in shell.lower() or 'powershell' in shell.lower() or 'cmd' in shell.lower(), (
f'Expected Windows shell, got: {shell}'
)
# FS tools
from hanzo_tools.fs import TOOLS as fs_tools
print(f'FS tools: {len(fs_tools)}')
# Reasoning tools
from hanzo_tools.reasoning import TOOLS as reason_tools
print(f'Reasoning tools: {len(reason_tools)}')
print('All tool imports OK on Windows')
"
- name: Install hanzo-mcp
shell: pwsh
run: |
.\.venv\Scripts\Activate.ps1
uv pip install -e ./pkg/hanzo-mcp 2>$null; $true
# Override with local tool packages
uv pip install -e ./pkg/hanzo-tools -e ./pkg/hanzo-tools-fs `
-e ./pkg/hanzo-tools-shell -e ./pkg/hanzo-tools-memory `
-e ./pkg/hanzo-tools-todo -e ./pkg/hanzo-tools-reasoning `
-e ./pkg/hanzo-tools-config 2>$null; $true
- name: Test hanzo-mcp CLI
shell: pwsh
run: |
.\.venv\Scripts\Activate.ps1
python -m hanzo_mcp.cli --version
python -m hanzo_mcp.cli --help
- name: Run unit tests (Windows-compatible subset)
shell: pwsh
run: |
.\.venv\Scripts\Activate.ps1
cd pkg/hanzo-mcp
python -m pytest tests/test_llm_warnings.py -v -o "addopts=" 2>$null; $true
python -m pytest tests/test_hanzo_mcp_simple.py -v -o "addopts=" -k "test_cli_help or test_cli_version or test_import_tools" 2>$null; $true
# WSL2 (Ubuntu on Windows)
test-wsl:
name: WSL2 Ubuntu
runs-on: windows-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: Vampire/setup-wsl@v5
with:
distribution: Ubuntu-24.04
additional-packages: python3 python3-pip python3-venv curl
- name: Install uv in WSL
shell: wsl-bash {0}
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
- name: Install and test in WSL
shell: wsl-bash {0}
run: |
export PATH="$HOME/.local/bin:$PATH"
WORKSPACE=$(wslpath "$(powershell.exe -Command 'Write-Host -NoNewline $env:GITHUB_WORKSPACE')")
cd "$WORKSPACE"
uv venv
source .venv/bin/activate
# hanzoai is the root workspace package
uv pip install -e .
uv pip install -e ./pkg/hanzo-async
uv pip install pytest pytest-asyncio
# Test imports
python -c "from hanzoai import __version__; print(f'hanzoai {__version__}')"
python -c "
import hanzo_async
print(f'uvloop active: {hanzo_async.using_uvloop()}')
import sys
print(f'platform: {sys.platform}')
"
- name: Install tool packages in WSL
shell: wsl-bash {0}
run: |
export PATH="$HOME/.local/bin:$PATH"
WORKSPACE=$(wslpath "$(powershell.exe -Command 'Write-Host -NoNewline $env:GITHUB_WORKSPACE')")
cd "$WORKSPACE"
source .venv/bin/activate
uv pip install -e ./pkg/hanzo-tools
uv pip install -e ./pkg/hanzo-tools-core 2>/dev/null || true
uv pip install -e ./pkg/hanzo-tools-fs
uv pip install -e ./pkg/hanzo-tools-shell
uv pip install -e ./pkg/hanzo-tools-reasoning
uv pip install -e ./pkg/hanzo-tools-memory
uv pip install -e ./pkg/hanzo-tools-todo
uv pip install -e ./pkg/hanzo-tools-config
- name: Test tools in WSL
shell: wsl-bash {0}
run: |
export PATH="$HOME/.local/bin:$PATH"
WORKSPACE=$(wslpath "$(powershell.exe -Command 'Write-Host -NoNewline $env:GITHUB_WORKSPACE')")
cd "$WORKSPACE"
source .venv/bin/activate
python -c "
import sys
print(f'Platform: {sys.platform}')
assert sys.platform == 'linux', f'WSL should report linux, got {sys.platform}'
from hanzo_tools.shell.cmd_tool import CmdTool
tool = CmdTool()
print(f'Shell: {tool.default_shell}')
# WSL has bash/zsh
assert '/bin/' in tool.default_shell or 'zsh' in tool.default_shell or 'bash' in tool.default_shell
from hanzo_tools.fs import TOOLS as fs_tools
print(f'FS tools: {len(fs_tools)}')
from hanzo_tools.reasoning import TOOLS as reason_tools
print(f'Reasoning tools: {len(reason_tools)}')
print('All WSL tool imports OK')
"
- name: Install and test hanzo-mcp in WSL
shell: wsl-bash {0}
run: |
export PATH="$HOME/.local/bin:$PATH"
WORKSPACE=$(wslpath "$(powershell.exe -Command 'Write-Host -NoNewline $env:GITHUB_WORKSPACE')")
cd "$WORKSPACE"
source .venv/bin/activate
uv pip install -e ./pkg/hanzo-mcp 2>/dev/null || true
uv pip install -e ./pkg/hanzo-tools -e ./pkg/hanzo-tools-fs \
-e ./pkg/hanzo-tools-shell -e ./pkg/hanzo-tools-memory \
-e ./pkg/hanzo-tools-todo -e ./pkg/hanzo-tools-reasoning \
-e ./pkg/hanzo-tools-config 2>/dev/null || true
python -m hanzo_mcp.cli --version
python -m hanzo_mcp.cli --help
- name: Run tests in WSL
shell: wsl-bash {0}
run: |
export PATH="$HOME/.local/bin:$PATH"
WORKSPACE=$(wslpath "$(powershell.exe -Command 'Write-Host -NoNewline $env:GITHUB_WORKSPACE')")
cd "$WORKSPACE"
source .venv/bin/activate
cd pkg/hanzo-mcp
python -m pytest tests/test_llm_warnings.py -v -o "addopts=" 2>/dev/null || true
python -m pytest tests/test_hanzo_mcp_simple.py -v -o "addopts=" \
-k "test_cli_help or test_cli_version or test_import_tools" 2>/dev/null || true