Files
xiaobaijizhang/scripts/verify.ps1
T

33 lines
1.3 KiB
PowerShell

$ErrorActionPreference = "Stop"
Write-Host "[1/3] Running domain tests"
npm test
Write-Host "[2/3] Building production interface"
npm run build
Write-Host "[3/3] Testing desktop project"
$cargoBin = Join-Path $env:USERPROFILE ".cargo\bin"
$cargo = Join-Path $cargoBin "cargo.exe"
$vcVarsCandidates = @(
"C:\VSBuildTools2022\VC\Auxiliary\Build\vcvars64.bat",
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
)
$vcVars = $vcVarsCandidates | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1
if ((Test-Path -LiteralPath $cargo) -and $vcVars) {
$asciiTarget = Join-Path $env:USERPROFILE ".cargo\xiaobai-target"
$perlBin = Join-Path $env:USERPROFILE ".cargo\strawberry-perl\perl\bin"
$extraPath = if (Test-Path -LiteralPath $perlBin) { ";$perlBin" } else { "" }
$desktopCheck = "call `"$vcVars`" && set `"PATH=$cargoBin;%PATH%$extraPath`" && set `"CARGO_TARGET_DIR=$asciiTarget`" && cargo test --offline --manifest-path src-tauri\Cargo.toml --lib"
& cmd.exe /d /s /c $desktopCheck
if ($LASTEXITCODE -ne 0) {
throw "Desktop tests failed with exit code $LASTEXITCODE"
}
}
else {
Write-Warning "Rust or Visual C++ Build Tools not found; skipped desktop compile check."
}
Write-Host "Xiaobai Bookkeeping verification completed."