|
| 1 | +name: Windows smoke |
| 2 | + |
| 3 | +# Validates the native Windows build, Windows path handling, setup/update |
| 4 | +# integration points, and the MCP stdio protocol. GPU availability is not a |
| 5 | +# property of the hosted runner, so the deterministic smoke path forces the |
| 6 | +# documented CPU fallback while the release build still includes the gpu feature. |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: [main] |
| 11 | + pull_request: |
| 12 | + branches: [main] |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +jobs: |
| 18 | + smoke: |
| 19 | + runs-on: windows-2022 |
| 20 | + timeout-minutes: 30 |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Install Rust |
| 26 | + uses: dtolnay/rust-toolchain@stable |
| 27 | + |
| 28 | + - name: Build release (gpu feature) |
| 29 | + run: cargo build --workspace --release --features gpu |
| 30 | + |
| 31 | + - name: Run workspace tests |
| 32 | + run: cargo test --workspace --features gpu |
| 33 | + |
| 34 | + - name: Run Windows CLI and setup smoke |
| 35 | + shell: pwsh |
| 36 | + run: | |
| 37 | + $ErrorActionPreference = 'Stop' |
| 38 | + $root = (Get-Location).Path |
| 39 | + $graphiq = Join-Path $root 'target\release\graphiq.exe' |
| 40 | + $mcp = Join-Path $root 'target\release\graphiq-mcp.exe' |
| 41 | + $env:GRAPHIQ_DISABLE_GPU = '1' |
| 42 | +
|
| 43 | + $version = & $graphiq --version |
| 44 | + if ($LASTEXITCODE -ne 0 -or $version -notmatch '^graphiq ') { |
| 45 | + throw "graphiq --version failed: $version" |
| 46 | + } |
| 47 | +
|
| 48 | + $fixture = Join-Path $env:RUNNER_TEMP 'graphiq Windows fixture with spaces' |
| 49 | + Remove-Item -LiteralPath $fixture -Recurse -Force -ErrorAction SilentlyContinue |
| 50 | + New-Item -ItemType Directory -Path (Join-Path $fixture 'src') -Force | Out-Null |
| 51 | + @' |
| 52 | + pub struct RateLimiter { max: u32 } |
| 53 | + impl RateLimiter { |
| 54 | + pub fn check_rate(&self) -> bool { true } |
| 55 | + pub fn reset(&self) {} |
| 56 | + } |
| 57 | + pub fn handle_request(rl: &RateLimiter) -> bool { rl.check_rate() } |
| 58 | + '@ | Set-Content -LiteralPath (Join-Path $fixture 'src\lib.rs') -Encoding utf8 |
| 59 | +
|
| 60 | + & git -C $fixture init --quiet |
| 61 | + & git -C $fixture config user.email ci@example.invalid |
| 62 | + & git -C $fixture config user.name 'GraphIQ CI' |
| 63 | + & git -C $fixture add --all |
| 64 | + & git -C $fixture commit --quiet -m init |
| 65 | + if ($LASTEXITCODE -ne 0) { throw 'failed to create the Windows fixture repository' } |
| 66 | +
|
| 67 | + $db = Join-Path $fixture '.graphiq\graphiq.db' |
| 68 | + & $graphiq index $fixture --db $db |
| 69 | + if ($LASTEXITCODE -ne 0) { throw 'graphiq index failed on Windows' } |
| 70 | +
|
| 71 | + $search = (& $graphiq search 'rate limit' --db $db --top 3 | Out-String) |
| 72 | + if ($LASTEXITCODE -ne 0 -or $search -notmatch 'RateLimiter') { |
| 73 | + throw "Windows search did not find RateLimiter: $search" |
| 74 | + } |
| 75 | +
|
| 76 | + $status = (& $graphiq status --db $db | Out-String) |
| 77 | + if ($LASTEXITCODE -ne 0 -or $status -notmatch 'GPU: unavailable \(disabled by GRAPHIQ_DISABLE_GPU\)') { |
| 78 | + throw "Windows status did not report the CPU fallback: $status" |
| 79 | + } |
| 80 | +
|
| 81 | + # This exercises sibling graphiq-mcp.exe discovery, Windows command |
| 82 | + # lookup, and the no-Unix-package-manager setup path. |
| 83 | + & $graphiq setup --project $fixture --skip-index --persistent --harness claude-code |
| 84 | + if ($LASTEXITCODE -ne 0) { throw 'graphiq setup failed on Windows' } |
| 85 | + $configPath = Join-Path $fixture '.claude\.mcp.json' |
| 86 | + $config = Get-Content -LiteralPath $configPath -Raw | ConvertFrom-Json |
| 87 | + if ($null -eq $config.mcpServers.graphiq) { throw 'setup did not write the Claude Code MCP entry' } |
| 88 | + if ($config.mcpServers.graphiq.args[0] -ne $fixture) { throw 'setup wrote the wrong Windows project path' } |
| 89 | +
|
| 90 | + $sync = (& $graphiq sync --project $fixture --harness claude-code | Out-String) |
| 91 | + if ($LASTEXITCODE -ne 0 -or $sync -notmatch 'connected:') { |
| 92 | + throw "graphiq sync did not verify the Windows MCP entry: $sync" |
| 93 | + } |
| 94 | +
|
| 95 | + function Read-McpJsonLine([System.Diagnostics.Process]$Process) { |
| 96 | + $read = $Process.StandardOutput.ReadLineAsync() |
| 97 | + if (-not $read.Wait(10000)) { throw 'timed out waiting for MCP response' } |
| 98 | + if ($null -eq $read.Result) { throw 'MCP exited before returning a response' } |
| 99 | + return ($read.Result | ConvertFrom-Json) |
| 100 | + } |
| 101 | +
|
| 102 | + $psi = New-Object System.Diagnostics.ProcessStartInfo |
| 103 | + $psi.FileName = $mcp |
| 104 | + $quotedFixture = '"' + $fixture.Replace('"', '\"') + '"' |
| 105 | + $quotedDb = '"' + $db.Replace('"', '\"') + '"' |
| 106 | + $psi.Arguments = "$quotedFixture --db $quotedDb" |
| 107 | + $psi.WorkingDirectory = $root |
| 108 | + $psi.UseShellExecute = $false |
| 109 | + $psi.CreateNoWindow = $true |
| 110 | + $psi.RedirectStandardInput = $true |
| 111 | + $psi.RedirectStandardOutput = $true |
| 112 | + $psi.RedirectStandardError = $true |
| 113 | + $mcpProcess = New-Object System.Diagnostics.Process |
| 114 | + $mcpProcess.StartInfo = $psi |
| 115 | + [void]$mcpProcess.Start() |
| 116 | + try { |
| 117 | + $mcpProcess.StandardInput.WriteLine('{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"ci","version":"1"}}}') |
| 118 | + $mcpProcess.StandardInput.WriteLine('{"jsonrpc":"2.0","method":"notifications/initialized"}') |
| 119 | + $mcpProcess.StandardInput.WriteLine('{"jsonrpc":"2.0","id":2,"method":"ping"}') |
| 120 | + $mcpProcess.StandardInput.WriteLine('{"jsonrpc":"2.0","id":3,"method":"shutdown"}') |
| 121 | +
|
| 122 | + $initialize = Read-McpJsonLine $mcpProcess |
| 123 | + $ping = Read-McpJsonLine $mcpProcess |
| 124 | + $shutdown = Read-McpJsonLine $mcpProcess |
| 125 | + if ($initialize.id -ne 1 -or $initialize.result.serverInfo.name -ne 'graphiq') { throw 'invalid MCP initialize response on Windows' } |
| 126 | + if ($ping.id -ne 2 -or $null -eq $ping.result) { throw 'invalid MCP ping response on Windows' } |
| 127 | + if ($shutdown.id -ne 3) { throw 'invalid MCP shutdown response on Windows' } |
| 128 | + } finally { |
| 129 | + $mcpProcess.StandardInput.Close() |
| 130 | + if (-not $mcpProcess.WaitForExit(10000)) { |
| 131 | + $mcpProcess.Kill() |
| 132 | + throw 'MCP process did not exit after stdin closed' |
| 133 | + } |
| 134 | + $mcpProcess.Dispose() |
| 135 | + } |
| 136 | +
|
| 137 | + - name: Test PowerShell installer with the local release archive |
| 138 | + shell: pwsh |
| 139 | + run: | |
| 140 | + $ErrorActionPreference = 'Stop' |
| 141 | + $root = (Get-Location).Path |
| 142 | + $stage = Join-Path $env:RUNNER_TEMP 'graphiq Windows package' |
| 143 | + $installDir = Join-Path $env:RUNNER_TEMP 'graphiq Windows install' |
| 144 | + Remove-Item -LiteralPath $stage -Recurse -Force -ErrorAction SilentlyContinue |
| 145 | + Remove-Item -LiteralPath $installDir -Recurse -Force -ErrorAction SilentlyContinue |
| 146 | + New-Item -ItemType Directory -Path $stage -Force | Out-Null |
| 147 | + foreach ($binary in @('graphiq.exe', 'graphiq-mcp.exe', 'graphiq-bench.exe')) { |
| 148 | + Copy-Item -LiteralPath (Join-Path $root "target\release\$binary") -Destination (Join-Path $stage $binary) |
| 149 | + } |
| 150 | + $archiveName = 'graphiq-x86_64-pc-windows-msvc.zip' |
| 151 | + $archive = Join-Path $stage $archiveName |
| 152 | + Compress-Archive -Path (Join-Path $stage 'graphiq.exe'), (Join-Path $stage 'graphiq-mcp.exe'), (Join-Path $stage 'graphiq-bench.exe') -DestinationPath $archive -Force |
| 153 | + $hash = (Get-FileHash -LiteralPath $archive -Algorithm SHA256).Hash.ToLowerInvariant() |
| 154 | + "$hash $archiveName" | Set-Content -LiteralPath ([IO.Path]::ChangeExtension($archive, 'sha256')) |
| 155 | +
|
| 156 | + & (Join-Path $root 'install.ps1') -ArchivePath $archive -InstallDir $installDir -NoPathUpdate -Version 'ci' |
| 157 | + if (-not (Test-Path -LiteralPath (Join-Path $installDir 'graphiq.exe'))) { |
| 158 | + throw 'PowerShell installer did not install graphiq.exe' |
| 159 | + } |
| 160 | + $installedVersion = & (Join-Path $installDir 'graphiq.exe') --version |
| 161 | + if ($LASTEXITCODE -ne 0 -or $installedVersion -notmatch '^graphiq ') { |
| 162 | + throw "installed Windows binary failed: $installedVersion" |
| 163 | + } |
| 164 | +
|
| 165 | + & (Join-Path $root 'install.ps1') -Uninstall -InstallDir $installDir -NoPathUpdate |
| 166 | + if (Test-Path -LiteralPath (Join-Path $installDir 'graphiq.exe')) { |
| 167 | + throw 'PowerShell installer did not uninstall graphiq.exe' |
| 168 | + } |
0 commit comments