|
| 1 | +# vMK CI Benchmark — Windows cold boot + binary size |
| 2 | +# Triggers: push/PR to vMK-dev, manual dispatch |
| 3 | +# Runs: Build binary → benchmark cold boot → upload results |
| 4 | +# |
| 5 | +# vMK: Fork-specific benchmark workflow for tracking vMK performance |
| 6 | +# over time. Not intended for upstream. |
| 7 | + |
| 8 | +name: vmk-bench |
| 9 | + |
| 10 | +on: |
| 11 | + push: |
| 12 | + branches: [vMK-dev] |
| 13 | + pull_request: |
| 14 | + branches: [vMK-dev] |
| 15 | + workflow_dispatch: |
| 16 | + inputs: |
| 17 | + runs: |
| 18 | + description: "Number of benchmark timing runs" |
| 19 | + required: true |
| 20 | + default: 5 |
| 21 | + type: number |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +env: |
| 28 | + OPENCODE_DISABLE_EMBEDDED_WEB_UI: "1" |
| 29 | + |
| 30 | +jobs: |
| 31 | + bench-windows: |
| 32 | + runs-on: windows-latest |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + with: |
| 36 | + ref: ${{ github.ref }} |
| 37 | + |
| 38 | + - uses: oven-sh/setup-bun@v2 |
| 39 | + with: |
| 40 | + bun-version-file: package.json |
| 41 | + |
| 42 | + - name: Install dependencies |
| 43 | + run: bun install --frozen-lockfile |
| 44 | + |
| 45 | + - name: Build binary (--single --skip-embed-web-ui) |
| 46 | + run: | |
| 47 | + bun run packages/opencode/script/build.ts --single --skip-embed-web-ui |
| 48 | + timeout-minutes: 15 |
| 49 | + |
| 50 | + - name: Smoke test (--version) |
| 51 | + run: | |
| 52 | + $bin = "packages/opencode/dist/opencode-windows-x64/bin/opencode-vMK.exe" |
| 53 | + if (-not (Test-Path $bin)) { throw "Binary not found: $bin" } |
| 54 | + $ver = & $bin --version |
| 55 | + if ($LASTEXITCODE -ne 0) { throw "Smoke test failed (exit $LASTEXITCODE)" } |
| 56 | + Write-Host "Binary version: $ver" |
| 57 | + $size = (Get-Item $bin).Length |
| 58 | + Write-Host "Binary size: $([math]::Round($size / 1MB, 2)) MB" |
| 59 | + shell: pwsh |
| 60 | + |
| 61 | + - name: Run benchmark |
| 62 | + id: bench |
| 63 | + run: | |
| 64 | + $runs = if ("${{ inputs.runs }}") { ${{ inputs.runs }} } else { 5 } |
| 65 | + $label = "ci-$(Get-Date -Format 'yyyyMMdd-HHmmss')" |
| 66 | + & "scripts/vmk-bench.ps1" -Runs $runs -WarmupRuns 2 -Label $label -Save |
| 67 | + if ($LASTEXITCODE -ne 0) { throw "Benchmark failed" } |
| 68 | + # Read saved result for summary |
| 69 | + $latest = Get-ChildItem "docs/metricas/bench-*.json" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 |
| 70 | + $data = Get-Content $latest.FullName -Raw | ConvertFrom-Json |
| 71 | + Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "## vMK Benchmark Results" |
| 72 | + Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "| Metric | Value |" |
| 73 | + Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "|---|---|" |
| 74 | + Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "| Binary Size | $($data.binary.size_mb) MB |" |
| 75 | + Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "| Cold boot --help (avg) | $($data.performance.cold_boot_help_ms.avg) ms |" |
| 76 | + Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "| Cold boot --help (p95) | $($data.performance.cold_boot_help_ms.p95) ms |" |
| 77 | + Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "| Smoke test (--version) | $(if ($data.smoke.version) { 'PASS' } else { 'FAIL' }) |" |
| 78 | + Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "| Runs | $($data.performance.cold_boot_help_ms.n) |" |
| 79 | + shell: pwsh |
| 80 | + |
| 81 | + - name: Upload benchmark artifact |
| 82 | + uses: actions/upload-artifact@v4 |
| 83 | + with: |
| 84 | + name: vmk-bench-results |
| 85 | + path: docs/metricas/bench-*.json |
| 86 | + retention-days: 90 |
0 commit comments