Files
jhartworks c19c77334f Add setup wizard and smoke tests for SE-LTD installation
- Implemented SetupSmokeTests.cs to validate installation prerequisites and configurations.
- Created SetupWizard.cs for user interaction during the setup process, including folder selection and variable input.
- Added build.ps1 script to automate the build process and run smoke tests.
- Introduced compose.override.template.yml for Docker configuration management.
- Defined setup.config.json to manage repository settings, prerequisites, and installation variables.
2026-11-25 10:06:11 +01:00

47 lines
2.1 KiB
PowerShell

[CmdletBinding()]
param([switch] $Test, [switch] $TestDatabase)
$ErrorActionPreference = 'Stop'
$source = $PSScriptRoot
$dist = Join-Path $source 'dist'
$package = Join-Path $dist 'SE-LTD-Setup'
$archive = Join-Path $dist 'SE-LTD-Setup.zip'
$framework = Join-Path $env:WINDIR 'Microsoft.NET'
$csc = @('Framework64', 'Framework') |
ForEach-Object { Join-Path $framework "$_\v4.0.30319\csc.exe" } |
Where-Object { Test-Path -LiteralPath $_ } |
Select-Object -First 1
if (-not $csc) { throw 'Der .NET-Framework-C#-Compiler fehlt.' }
New-Item -ItemType Directory -Force -Path $package | Out-Null
$exe = Join-Path $package 'SE-LTD-Setup.exe'
$arguments = @(
'/nologo', '/target:winexe', '/platform:anycpu', '/optimize+', '/codepage:65001', "/out:$exe",
'/reference:System.Windows.Forms.dll', '/reference:System.Drawing.dll', '/reference:System.Web.Extensions.dll',
(Join-Path $source 'SetupEngine.cs'), (Join-Path $source 'SetupWizard.cs')
)
& $csc @arguments
if ($LASTEXITCODE -ne 0) { throw 'SE-LTD Setup konnte nicht kompiliert werden.' }
if ($Test -or $TestDatabase) {
$testExe = Join-Path $dist 'SE-LTD-Setup-SmokeTests.exe'
$testArguments = @(
'/nologo', '/target:exe', '/codepage:65001', '/main:SeLtd.Setup.SetupSmokeTests', "/out:$testExe",
'/reference:System.Windows.Forms.dll', '/reference:System.Drawing.dll', '/reference:System.Web.Extensions.dll',
(Join-Path $source 'SetupEngine.cs'), (Join-Path $source 'SetupWizard.cs'), (Join-Path $source 'SetupSmokeTests.cs')
)
& $csc @testArguments
if ($LASTEXITCODE -ne 0) { throw 'Der Setup-Test konnte nicht kompiliert werden.' }
if ($TestDatabase) { & $testExe $source --database }
else { & $testExe $source }
if ($LASTEXITCODE -ne 0) { throw 'Der Setup-Test ist fehlgeschlagen.' }
}
$files = 'setup.config.json', 'compose.override.template.yml', 'README.md' |
ForEach-Object {
Copy-Item -LiteralPath (Join-Path $source $_) -Destination $package -Force
Join-Path $package $_
}
Compress-Archive -Path (@($exe) + $files) -DestinationPath $archive -Force
Get-Item -LiteralPath $exe, $archive