Files
game_voice_recorder/tools/win-ci/gvr.ps1
EJClaw b230443409 v1.3.3: 따라갈 사람 목록 · 롤 채팅 OCR 제거 · 표시 이름(실명 숨기기)
- 따라갈 사람: 봇이 서버를 지켜보기 전 멤버 요청을 사이트 서버가 forbidden 으로 거절하고 앱이 오류를 숨겨 빈 목록이 됐다
  → 가입한 서버면 지켜보기 전에도 응답(source.members 가 멤버 확인), 앱은 오류 · 다시 불러오기 표시
  → 내 계정 → 관리자(GET /app/admins) → 이름순, 녹음할 서버를 바꾸면 봇을 다시 붙여 새 서버를 지켜봄
- 롤 채팅 OCR 제거: 앱 설정 · 마법사 · 진단 · lol.ts · 워커 ocr.py/ocr_* op · pywinrt/mss/Pillow · win-ci ocr_lang
  롤은 게임 중 전체/팀 채팅 API 가 없어 LCU(챔피언 선택 · 게임 후) + r3dlog(남아 있을 때, LCU 채팅을 지우지 않고 추가)
- 표시 이름: 서버 store.displayNames (세션 · 앱 유저 · 접속 기록 이름까지 바꿈), GET /app/names, PUT /app/admin/names,
  cli name. 앱은 받아서 users · 지난 범인 분석 이름을 바꾸고 이후 디스코드 이름 대신 저장. 관리자 탭에 편집 UI
- 저장소 시연 · 테스트 데이터 · 화면 캡처 · 계획서 PDF 의 실제 이름을 가짜 이름으로 교체
- 테스트: 앱 41 · 서버 16 · 워커 39 통과

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 02:42:57 +09:00

160 lines
7.2 KiB
PowerShell

# ==================================================================
# 겜녹이 (game_voice_recorder) Windows 검증 · 빌드
# $TargetRev : 검증할 커밋 (run.sh 가 박는다)
# $Phase : worker = 워커 테스트 + PyInstaller / full = + Electron 포터블 exe 빌드 · 기동 확인
# 결과는 호스트 /home/claude/win-ci/results/gvr-* 로 회수된다.
# 이 블록은 실패해도 exit 0 (agent 가 무한 재시도하지 않게) - 판정은 summary 로 한다.
# ==================================================================
$TargetRev = '__REV__'
$Phase = '__PHASE__'
$Repo = 'C:\win-ci\gvr'
$OutDir = 'C:\win-ci\gvr-out'
New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
function Send-Artifact($name, $path) {
if (-not (Test-Path $path)) { return }
try {
$bytes = [IO.File]::ReadAllBytes($path)
$req = @{ Uri = "http://10.0.2.2:8099/artifact/$name"; Method = 'Post'; TimeoutSec = 3600; Body = $bytes; ContentType = 'application/octet-stream' }
Invoke-RestMethod @req | Out-Null
Log " -> 호스트로 $name ($($bytes.Length) bytes)"
} catch {
Log " -> $name 업로드 실패: $($_.Exception.Message)"
}
}
function Step($name, $block) {
$log = Join-Path $OutDir "$name.log"
Remove-Item $log -Force -ErrorAction SilentlyContinue
Log "--- [$name] 시작"
$sw = [IO.StreamWriter]::new($log, $false, [Text.UTF8Encoding]::new($false))
$sw.AutoFlush = $true
$tail = [System.Collections.Generic.Queue[string]]::new()
$ok = $true
$t0 = Get-Date
try {
& $block 2>&1 | ForEach-Object {
$line = "$_"
$sw.WriteLine($line)
$tail.Enqueue($line)
if ($tail.Count -gt 15) { [void]$tail.Dequeue() }
}
} catch {
$ok = $false
$sw.WriteLine("[step 예외] $($_.Exception.Message)")
}
$sw.WriteLine("[소요] $([int]((Get-Date) - $t0).TotalSeconds)s")
$sw.Close()
foreach ($l in $tail) { Log " $l" }
if ($ok) { Log "--- [$name] 통과" } else { Log "--- [$name] 실패" }
Send-Artifact "gvr-$name.log" $log
return $ok
}
$ErrorActionPreference = 'Continue'
$env:PYTHONUTF8 = '1'
$env:PYTHONIOENCODING = 'utf-8'
$r = [ordered]@{}
try {
Sync-Path
if (-not (Test-Path $Repo)) {
Log "gvr clone"
& git clone -q https://git.tkrmagid.kr/tkrmagid/game_voice_recorder $Repo
}
Push-Location $Repo
& git fetch --all -q
& git reset --hard $TargetRev -q
& git clean -fdq -e node_modules -e .venv -e worker/dist -e worker/build
Log "gvr rev $(& git rev-parse --short HEAD)"
$py = Join-Path $Repo 'worker\.venv\Scripts\python.exe'
if ($Phase -eq 'debug') {
# 원인 조사용: worker/scripts/win_debug.py 만 돌린다 (venv 는 이전 실행 것을 그대로 씀)
$r['debug'] = Step 'debug' {
& $py -X faulthandler worker\scripts\win_debug.py protocol
"exit $LASTEXITCODE"
}
$sum = Join-Path $OutDir 'summary.log'
Set-Content -Path $sum -Value @("phase=debug", "debug $($r['debug'])") -Encoding UTF8
Send-Artifact 'gvr-summary.log' $sum
Pop-Location
Log "=== gvr 끝 ==="
exit 0
}
$r['worker_setup'] = Step 'worker_setup' {
Push-Location (Join-Path $Repo 'worker')
if (-not (Test-Path $py)) { & python -m venv .venv }
& $py -m pip install --upgrade pip -q
& $py -m pip install -r requirements.txt -r requirements-dev.txt -q
if ($LASTEXITCODE -ne 0) { Pop-Location; throw "pip exit $LASTEXITCODE" }
# pywinrt 가 넣어 둔 오래된 MSVC 런타임(msvcp140 14.29)은 지운다. 남겨 두면 PyInstaller 분석과 실행 중에
# onnxruntime 이 0xC0000005 로 죽는다 (시스템/번들의 새 런타임을 쓰게 한다)
Get-ChildItem (Join-Path $Repo 'worker\.venv\Lib\site-packages\winrt') -Filter 'msvcp140*.dll' -ErrorAction SilentlyContinue | ForEach-Object { "삭제: $($_.FullName)"; Remove-Item $_.FullName -Force }
& $py -c "import onnxruntime, faster_whisper, ctranslate2; print('faster-whisper', faster_whisper.__version__, 'ct2', ctranslate2.__version__, 'ort', onnxruntime.__version__)"
Pop-Location
}
$r['worker_pytest'] = Step 'worker_pytest' {
Push-Location (Join-Path $Repo 'worker')
& $py -m pytest -q -rf
$c = $LASTEXITCODE
Pop-Location
if ($c -ne 0) { throw "pytest exit $c" }
}
$r['win_smoke'] = Step 'win_smoke' {
& $py worker\scripts\win_smoke.py --out (Join-Path $OutDir 'win_smoke.json')
if ($LASTEXITCODE -ne 0) { throw "smoke exit $LASTEXITCODE" }
}
Send-Artifact 'gvr-win_smoke.json' (Join-Path $OutDir 'win_smoke.json')
$r['worker_build'] = Step 'worker_build' {
Push-Location (Join-Path $Repo 'worker')
& $py -m PyInstaller gvr-worker.spec --noconfirm --clean
$c = $LASTEXITCODE
Pop-Location
if ($c -ne 0) { throw "PyInstaller exit $c" }
"크기 $([math]::Round((Get-ChildItem worker\dist\gvr-worker -Recurse | Measure-Object Length -Sum).Sum / 1MB, 1)) MB"
}
$r['worker_exe_smoke'] = Step 'worker_exe_smoke' {
& $py worker\scripts\win_smoke.py --exe worker\dist\gvr-worker\gvr-worker.exe --out (Join-Path $OutDir 'win_smoke_exe.json')
if ($LASTEXITCODE -ne 0) { throw "exe smoke exit $LASTEXITCODE" }
}
if ($Phase -eq 'full') {
$r['app_build'] = Step 'app_build' {
Push-Location (Join-Path $Repo 'app')
& npm.cmd ci --no-audit --no-fund
if ($LASTEXITCODE -ne 0) { Pop-Location; throw "npm ci exit $LASTEXITCODE" }
& npm.cmd run dist:win
$c = $LASTEXITCODE
Pop-Location
if ($c -ne 0) { throw "electron-builder exit $c" }
Get-ChildItem app\release -File | ForEach-Object { "$($_.Name) $([math]::Round($_.Length / 1MB, 1)) MB" }
}
$r['app_smoke'] = Step 'app_smoke' {
$exe = Get-ChildItem app\release\win-unpacked\GameVoiceRecorder.exe
$data = Join-Path $OutDir 'smoke-data'
Remove-Item $data -Recurse -Force -ErrorAction SilentlyContinue
$p = Start-Process $exe.FullName -ArgumentList '--smoke', "--data-dir=$data" -PassThru -Wait
Get-Content (Join-Path $data 'smoke.json') -ErrorAction SilentlyContinue
if ($p.ExitCode -ne 0) { throw "app smoke exit $($p.ExitCode)" }
}
if ($r['app_build'] -and $r['app_smoke']) {
foreach ($f in Get-ChildItem app\release\* -File -Include *.exe, *.zip) { Send-Artifact $f.Name $f.FullName }
}
}
$rev = (& git rev-parse --short HEAD 2>&1 | Select-Object -First 1)
$sum = Join-Path $OutDir 'summary.log'
$lines = @("rev=$rev", "phase=$Phase", "utc=$([DateTime]::UtcNow.ToString('yyyy-MM-dd HH:mm:ss'))")
foreach ($k in $r.Keys) { $lines += ("{0,-18} {1}" -f $k, $(if ($r[$k]) { 'PASS' } else { 'FAIL' })) }
Set-Content -Path $sum -Value $lines -Encoding UTF8
foreach ($l in $lines) { Log $l }
Send-Artifact 'gvr-summary.log' $sum
Pop-Location
} catch {
Log "gvr 검증 준비 실패: $($_.Exception.Message)"
try { Pop-Location } catch {}
}
Log "=== gvr 끝 ==="
exit 0