Update examples #57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build-test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - windows-latest | |
| - ubuntu-latest | |
| defaults: | |
| run: | |
| shell: pwsh | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up MSVC environment | |
| if: runner.os == 'Windows' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Configure | |
| run: >- | |
| cmake -S . -B build -G Ninja | |
| -D CMAKE_BUILD_TYPE=Release | |
| -D LLM_INVOKE_CPP_BUILD_MCP_HTTP_DEMO=OFF | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Test | |
| run: ctest --test-dir build --output-on-failure | |
| - name: Smoke test main demos | |
| run: | | |
| $demoNames = @( | |
| 'func_registry_demo', | |
| 'json_invoke_demo', | |
| 'json_stateful_demo', | |
| 'json_tracing_demo', | |
| 'task_scheduler_demo' | |
| ) | |
| foreach ($demoName in $demoNames) { | |
| $demoPath = Join-Path $PWD "build/$demoName" | |
| if ($env:RUNNER_OS -eq 'Windows') { | |
| $demoPath = "$demoPath.exe" | |
| } | |
| if (-not (Test-Path $demoPath)) { | |
| throw "Expected demo executable not found: $demoPath" | |
| } | |
| & $demoPath | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "Demo failed with exit code ${LASTEXITCODE}: $demoName" | |
| } | |
| } | |
| # mcp_filesystem_demo is a blocking stdio server; verify it starts cleanly then stop it | |
| $mcpPath = Join-Path $PWD "build/mcp_filesystem_demo" | |
| if ($env:RUNNER_OS -eq 'Windows') { $mcpPath = "$mcpPath.exe" } | |
| if (-not (Test-Path $mcpPath)) { throw "Expected demo executable not found: $mcpPath" } | |
| $tempRoot = $env:RUNNER_TEMP | |
| if ([string]::IsNullOrWhiteSpace($tempRoot)) { | |
| $tempRoot = [System.IO.Path]::GetTempPath() | |
| } | |
| $stderrPath = Join-Path $tempRoot "mcp_stderr_$PID.txt" | |
| $proc = Start-Process -FilePath $mcpPath -RedirectStandardError $stderrPath -PassThru -NoNewWindow | |
| Start-Sleep -Seconds 3 | |
| $proc.Kill() | |
| $stderr = Get-Content $stderrPath -Raw -ErrorAction SilentlyContinue | |
| if ($stderr -notmatch 'mcp_filesystem ready') { | |
| throw "mcp_filesystem_demo did not emit readiness line. stderr: $stderr" | |
| } |