update sensor bench
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
param(
|
||||
[string]$EnvName = "sensor-bench-build-py310"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
|
||||
$DistDir = Join-Path $RepoRoot "dist"
|
||||
$WorkDir = Join-Path $RepoRoot "build\pyinstaller_work_operator"
|
||||
$SpecPath = Join-Path $PSScriptRoot "sensor_bench_operator.spec"
|
||||
$RepoConfig = Join-Path $RepoRoot "config"
|
||||
$InternalRoot = Join-Path $RepoRoot "internal"
|
||||
$DistApp = Join-Path $DistDir "SensorBenchOperator"
|
||||
|
||||
if (-not (Get-Command conda -ErrorAction SilentlyContinue)) {
|
||||
throw "conda was not found on PATH. Open an Anaconda Prompt or initialize conda for PowerShell."
|
||||
}
|
||||
|
||||
Push-Location $RepoRoot
|
||||
try {
|
||||
conda run -n $EnvName python -m pip install --upgrade pip
|
||||
if ($LASTEXITCODE -ne 0) { throw "pip upgrade failed in env '$EnvName'." }
|
||||
|
||||
conda run -n $EnvName python -m pip install -e ".[pack]"
|
||||
if ($LASTEXITCODE -ne 0) { throw "Editable install failed in env '$EnvName'." }
|
||||
|
||||
conda run -n $EnvName python -m pip install --upgrade orisys
|
||||
if ($LASTEXITCODE -ne 0) { throw "orisys install failed in env '$EnvName'." }
|
||||
|
||||
# Sync Orisys wheel sensor configs into repo config/ before packaging.
|
||||
conda run -n $EnvName python build/sync_wheel_configs.py
|
||||
if ($LASTEXITCODE -ne 0) { throw "Config sync failed." }
|
||||
|
||||
conda run -n $EnvName python tests/test_smoke.py
|
||||
if ($LASTEXITCODE -ne 0) { throw "Public smoke tests failed." }
|
||||
|
||||
conda run -n $EnvName python internal/tests/test_operator_smoke.py
|
||||
if ($LASTEXITCODE -ne 0) { throw "Operator smoke tests failed." }
|
||||
|
||||
if (Test-Path $WorkDir) {
|
||||
Remove-Item -Recurse -Force $WorkDir
|
||||
}
|
||||
if (Test-Path $DistApp) {
|
||||
Remove-Item -Recurse -Force $DistApp
|
||||
}
|
||||
|
||||
conda run -n $EnvName python -m PyInstaller --noconfirm --clean --distpath "$DistDir" --workpath "$WorkDir" "$SpecPath"
|
||||
if ($LASTEXITCODE -ne 0) { throw "PyInstaller (operator) failed." }
|
||||
|
||||
# Editable sidecars beside the EXE: public sensor configs + operator overlays.
|
||||
# Copy sensor JSON first, then replace locales/options/steps so public
|
||||
# exhibition locales (no workflow) cannot win over operator catalogs.
|
||||
$DistConfig = Join-Path $DistApp "config"
|
||||
$DistLocales = Join-Path $DistConfig "locales"
|
||||
$DistSteps = Join-Path $DistApp "steps"
|
||||
if (Test-Path $DistConfig) {
|
||||
Remove-Item -Recurse -Force $DistConfig
|
||||
}
|
||||
if (Test-Path $DistSteps) {
|
||||
Remove-Item -Recurse -Force $DistSteps
|
||||
}
|
||||
Copy-Item -Recurse -Force $RepoConfig $DistConfig
|
||||
Copy-Item -Force (Join-Path $InternalRoot "config\options.json") (Join-Path $DistConfig "options.json")
|
||||
if (Test-Path $DistLocales) {
|
||||
Remove-Item -Recurse -Force $DistLocales
|
||||
}
|
||||
Copy-Item -Recurse -Force (Join-Path $InternalRoot "config\locales") $DistLocales
|
||||
Copy-Item -Recurse -Force (Join-Path $InternalRoot "steps") $DistSteps
|
||||
|
||||
conda run -n $EnvName python build/verify_operator_dist.py
|
||||
if ($LASTEXITCODE -ne 0) { throw "Operator distribution verification failed." }
|
||||
|
||||
Write-Host "Build complete: dist\SensorBenchOperator\SensorBenchOperator.exe"
|
||||
Write-Host "INTERNAL USE ONLY - do not ship this folder to customers."
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
Reference in New Issue
Block a user