Skip to content

Commit 3857199

Browse files
committed
feat: enhance Windows support by setting up WSL for Spice installation and runtime management
1 parent 442869e commit 3857199

1 file changed

Lines changed: 34 additions & 47 deletions

File tree

.github/workflows/test.yml

Lines changed: 34 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,26 @@ jobs:
9191
brew install spiceai/spiceai/spice
9292
brew install spiceai/spiceai/spiced
9393
94-
- name: install Spice (Windows)
94+
# Spice on Windows is only supported via WSL. Set up Ubuntu under WSL
95+
# and install Spice there; the tests on the Windows host then talk to
96+
# the runtime over localhost (WSL2 forwards localhost between host and
97+
# guest).
98+
- name: Set up WSL (Windows)
9599
if: matrix.os == 'windows-latest'
96-
run: |
97-
curl -L "https://install.spiceai.org/Install.ps1" -o Install.ps1 && PowerShell -ExecutionPolicy Bypass -File ./Install.ps1
100+
uses: Vampire/setup-wsl@v6
101+
with:
102+
distribution: Ubuntu-24.04
103+
additional-packages: |
104+
curl
105+
ca-certificates
98106
99-
- name: add Spice bin to PATH (Windows)
107+
- name: install Spice in WSL (Windows)
100108
if: matrix.os == 'windows-latest'
109+
shell: wsl-bash {0}
101110
run: |
102-
Add-Content $env:GITHUB_PATH (Join-Path $HOME ".spice\bin")
103-
shell: pwsh
111+
curl https://install.spiceai.org | /bin/bash
112+
echo "$HOME/.spice/bin" >> $GITHUB_PATH
113+
$HOME/.spice/bin/spice install
104114
105115
- name: Init and start spice app
106116
if: matrix.os != 'windows-latest'
@@ -121,44 +131,25 @@ jobs:
121131
122132
- name: Init and start spice app (Windows)
123133
if: matrix.os == 'windows-latest'
134+
shell: wsl-bash {0}
124135
run: |
125-
spice install
126136
spice init spice_qs
127137
cd spice_qs
128138
spice add spiceai/quickstart
129-
# Use spiced directly; `spice run` on Windows has a bug where it
130-
# reinstalls the runtime and then fails to locate it.
131-
$spiced = Join-Path $HOME ".spice\bin\spiced.exe"
132-
if (-not (Test-Path $spiced)) {
133-
throw "spiced not found at $spiced after `spice install`"
134-
}
135-
Start-Process -FilePath $spiced -RedirectStandardOutput spice.out.log -RedirectStandardError spice.err.log
139+
nohup spiced > spice.log 2>&1 &
136140
# Wait for runtime to be ready (poll /v1/ready endpoint)
137-
$timeout = 120
138-
$elapsed = 0
139-
$ready = $false
140-
while ($elapsed -lt $timeout) {
141-
try {
142-
$response = Invoke-WebRequest -Uri "http://localhost:8090/v1/ready" -UseBasicParsing -TimeoutSec 2 -ErrorAction Stop
143-
if ($response.StatusCode -eq 200) {
144-
Write-Host "Spice runtime is ready"
145-
$ready = $true
146-
break
147-
}
148-
} catch {
149-
Write-Host "Waiting for Spice runtime to be ready... ($elapsed/$timeout)"
150-
}
151-
Start-Sleep -Seconds 1
152-
$elapsed++
153-
}
154-
if (-not $ready) {
155-
Write-Host "=== spice stdout log ==="
156-
if (Test-Path spice.out.log) { Get-Content spice.out.log }
157-
Write-Host "=== spice stderr log ==="
158-
if (Test-Path spice.err.log) { Get-Content spice.err.log }
159-
throw "Spice runtime did not become ready within $timeout seconds"
160-
}
161-
shell: pwsh
141+
for i in $(seq 1 120); do
142+
if curl -s http://localhost:8090/v1/ready > /dev/null 2>&1; then
143+
echo "Spice runtime is ready"
144+
exit 0
145+
fi
146+
echo "Waiting for Spice runtime to be ready... ($i/120)"
147+
sleep 1
148+
done
149+
echo "=== spice log ==="
150+
cat spice.log || true
151+
echo "Spice runtime did not become ready within 120 seconds"
152+
exit 1
162153
163154
- name: Running tests
164155
env:
@@ -176,16 +167,12 @@ jobs:
176167
cat spice.log
177168
178169
- name: Stop spice and check logs (Windows)
179-
working-directory: spice_qs
180170
if: matrix.os == 'windows-latest' && always()
171+
shell: wsl-bash {0}
181172
run: |
182-
Get-Process -Name spice -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
183-
Get-Process -Name spiced -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
184-
Write-Host "=== spice stdout log ==="
185-
if (Test-Path spice.out.log) { Get-Content spice.out.log }
186-
Write-Host "=== spice stderr log ==="
187-
if (Test-Path spice.err.log) { Get-Content spice.err.log }
188-
shell: pwsh
173+
pkill -f spiced || true
174+
echo "=== spice log ==="
175+
cat spice_qs/spice.log || true
189176
190177
pytest-cloud:
191178
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)