Skip to content

Commit 6793e40

Browse files
ashwin-antclaude
andauthored
Add Windows support to test workflows (#222)
Add cross-platform testing for Windows alongside Linux across all test jobs (unit tests, e2e tests, and examples). Uses native Windows installation via PowerShell script and platform-specific timeout handling for example scripts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <[email protected]>
1 parent 14f0714 commit 6793e40

File tree

2 files changed

+53
-6
lines changed

2 files changed

+53
-6
lines changed

.github/workflows/test.yml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ on:
88

99
jobs:
1010
test:
11-
runs-on: ubuntu-latest
11+
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
1415
python-version: ["3.10", "3.11", "3.12", "3.13"]
1516

1617
steps:
@@ -37,10 +38,11 @@ jobs:
3738
fail_ci_if_error: false
3839

3940
test-e2e:
40-
runs-on: ubuntu-latest
41+
runs-on: ${{ matrix.os }}
4142
needs: test # Run after unit tests pass
4243
strategy:
4344
matrix:
45+
os: [ubuntu-latest, macos-latest, windows-latest]
4446
python-version: ["3.10", "3.11", "3.12", "3.13"]
4547

4648
steps:
@@ -51,11 +53,20 @@ jobs:
5153
with:
5254
python-version: ${{ matrix.python-version }}
5355

54-
- name: Install Claude Code
56+
- name: Install Claude Code (Linux/macOS)
57+
if: runner.os == 'Linux' || runner.os == 'macOS'
5558
run: |
5659
curl -fsSL https://claude.ai/install.sh | bash
5760
echo "$HOME/.local/bin" >> $GITHUB_PATH
5861
62+
- name: Install Claude Code (Windows)
63+
if: runner.os == 'Windows'
64+
run: |
65+
irm https://claude.ai/install.ps1 | iex
66+
$claudePath = "$env:USERPROFILE\.local\bin"
67+
echo "$claudePath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
68+
shell: pwsh
69+
5970
- name: Verify Claude Code installation
6071
run: claude -v
6172

@@ -85,11 +96,20 @@ jobs:
8596
with:
8697
python-version: ${{ matrix.python-version }}
8798

88-
- name: Install Claude Code
99+
- name: Install Claude Code (Linux)
100+
if: runner.os == 'Linux'
89101
run: |
90102
curl -fsSL https://claude.ai/install.sh | bash
91103
echo "$HOME/.local/bin" >> $GITHUB_PATH
92104
105+
- name: Install Claude Code (Windows)
106+
if: runner.os == 'Windows'
107+
run: |
108+
irm https://claude.ai/install.ps1 | iex
109+
$claudePath = "$env:USERPROFILE\.local\bin"
110+
echo "$claudePath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
111+
shell: pwsh
112+
93113
- name: Verify Claude Code installation
94114
run: claude -v
95115

@@ -98,9 +118,22 @@ jobs:
98118
python -m pip install --upgrade pip
99119
pip install -e .
100120
101-
- name: Run example scripts
121+
- name: Run example scripts (Linux)
122+
if: runner.os == 'Linux'
102123
env:
103124
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
104125
run: |
105126
python examples/quick_start.py
106127
timeout 120 python examples/streaming_mode.py all
128+
129+
- name: Run example scripts (Windows)
130+
if: runner.os == 'Windows'
131+
env:
132+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
133+
run: |
134+
python examples/quick_start.py
135+
$job = Start-Job { python examples/streaming_mode.py all }
136+
Wait-Job $job -Timeout 120 | Out-Null
137+
Stop-Job $job
138+
Receive-Job $job
139+
shell: pwsh

e2e-tests/test_agents_and_settings.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""End-to-end tests for agents and setting sources with real Claude API calls."""
22

3+
import asyncio
4+
import sys
35
import tempfile
46
from pathlib import Path
57

@@ -80,6 +82,10 @@ async def test_setting_sources_default():
8082
), f"outputStyle should be 'default', got: {output_style}"
8183
break
8284

85+
# On Windows, wait for file handles to be released before cleanup
86+
if sys.platform == "win32":
87+
await asyncio.sleep(0.5)
88+
8389

8490
@pytest.mark.e2e
8591
@pytest.mark.asyncio
@@ -120,6 +126,10 @@ async def test_setting_sources_user_only():
120126
), f"testcmd should NOT be available with user-only sources, got: {commands}"
121127
break
122128

129+
# On Windows, wait for file handles to be released before cleanup
130+
if sys.platform == "win32":
131+
await asyncio.sleep(0.5)
132+
123133

124134
@pytest.mark.e2e
125135
@pytest.mark.asyncio
@@ -152,4 +162,8 @@ async def test_setting_sources_project_included():
152162
assert (
153163
output_style == "local-test-style"
154164
), f"outputStyle should be from local settings, got: {output_style}"
155-
break
165+
break
166+
167+
# On Windows, wait for file handles to be released before cleanup
168+
if sys.platform == "win32":
169+
await asyncio.sleep(0.5)

0 commit comments

Comments
 (0)