Own Unity package tests in generic client
This commit is contained in:
parent
9af9e2c4fb
commit
d8d0bd5eff
7 changed files with 104 additions and 110 deletions
|
|
@ -4,11 +4,14 @@
|
|||
"com.unity.modules.assetbundle": "1.0.0",
|
||||
"com.unity.modules.imageconversion": "1.0.0",
|
||||
"com.unity.modules.physics": "1.0.0",
|
||||
"com.unity.modules.uielements": "1.0.0",
|
||||
"org.gamecult.cultlib": "file:../../../CultLib/artifacts/unity/org.gamecult.cultlib",
|
||||
"org.gamecult.eve.surface": "file:../../packages/org.gamecult.eve.surface",
|
||||
"org.gamecult.eve.unity-scene": "file:../../packages/org.gamecult.eve.unity-scene"
|
||||
"org.gamecult.eve.unity-scene": "file:../../packages/org.gamecult.eve.unity-scene",
|
||||
"org.gamecult.eve.unity-uitoolkit": "file:../../packages/org.gamecult.eve.unity-uitoolkit"
|
||||
},
|
||||
"testables": [
|
||||
"org.gamecult.eve.unity-scene"
|
||||
"org.gamecult.eve.unity-scene",
|
||||
"org.gamecult.eve.unity-uitoolkit"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,12 +39,26 @@
|
|||
"org.gamecult.eve.surface": "0.1.0"
|
||||
}
|
||||
},
|
||||
"org.gamecult.eve.unity-uitoolkit": {
|
||||
"version": "file:../../packages/org.gamecult.eve.unity-uitoolkit",
|
||||
"depth": 0,
|
||||
"source": "local",
|
||||
"dependencies": {
|
||||
"org.gamecult.eve.surface": "0.1.0"
|
||||
}
|
||||
},
|
||||
"com.unity.modules.assetbundle": {
|
||||
"version": "1.0.0",
|
||||
"depth": 0,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.hierarchycore": {
|
||||
"version": "1.0.0",
|
||||
"depth": 1,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.imageconversion": {
|
||||
"version": "1.0.0",
|
||||
"depth": 0,
|
||||
|
|
@ -68,6 +82,24 @@
|
|||
"depth": 0,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.ui": {
|
||||
"version": "1.0.0",
|
||||
"depth": 1,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.uielements": {
|
||||
"version": "1.0.0",
|
||||
"depth": 0,
|
||||
"source": "builtin",
|
||||
"dependencies": {
|
||||
"com.unity.modules.ui": "1.0.0",
|
||||
"com.unity.modules.imgui": "1.0.0",
|
||||
"com.unity.modules.jsonserialize": "1.0.0",
|
||||
"com.unity.modules.hierarchycore": "1.0.0",
|
||||
"com.unity.modules.physics": "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,22 +151,20 @@
|
|||
"ownerRepo": "EveUnity",
|
||||
"runnerKind": "unity-editmode-batchmode",
|
||||
"runnerScript": "scripts/run-package-tests.ps1",
|
||||
"consumerProject": "E:\\Projects\\Aetheria",
|
||||
"consumerProject": "TestProject",
|
||||
"packageName": "org.gamecult.eve.unity-scene",
|
||||
"testAssembly": "GameCult.Eve.UnityScene.Tests",
|
||||
"testPlatform": "EditMode",
|
||||
"resultsArtifact": "artifacts/aetheria-unity-scene-editmode/{stamp}/unity-editmode-results.xml",
|
||||
"logArtifact": "artifacts/aetheria-unity-scene-editmode/{stamp}/unity-editmode.log",
|
||||
"manifestMutation": "Temporarily adds org.gamecult.eve.unity-scene to Aetheria Unity testables, runs GameCult.Eve.UnityScene.Tests, and restores Packages/manifest.json."
|
||||
"resultsArtifact": "artifacts/package-tests/{stamp}/unity-editmode-results.xml",
|
||||
"logArtifact": "artifacts/package-tests/{stamp}/unity-editmode.log",
|
||||
"manifestMutation": "none"
|
||||
},
|
||||
"evidencePaths": [
|
||||
"packages/org.gamecult.eve.unity-scene/Tests/Editor/GameCult.Eve.UnityScene.Tests.asmdef",
|
||||
"packages/org.gamecult.eve.unity-scene/Tests/Editor/EveUnitySceneSurfaceLowererTests.cs",
|
||||
"scripts/run-package-tests.ps1"
|
||||
],
|
||||
"pendingProofs": [
|
||||
"Move the Aetheria consumer scenario into a provider-owned conformance pack that installs EveUnity from its owner repository."
|
||||
]
|
||||
"pendingProofs": []
|
||||
},
|
||||
"capture": {
|
||||
"ownerRepo": "EveUnity",
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ evidence:
|
|||
|
||||
- release: typed UPM release request contract, UPM `.tgz` artifact smoke, and
|
||||
incubating package identity;
|
||||
- test: package-owned EditMode tests run through Aetheria in Unity batchmode,
|
||||
plus Aetheria consumer-build smoke through Unity's generated project;
|
||||
- test: package-owned EditMode tests run through EveUnity's clean `TestProject`
|
||||
consumer in Unity batchmode;
|
||||
- capture: typed capture request contract and pending Unity editor or
|
||||
batchmode PNG artifact.
|
||||
|
||||
|
|
@ -60,12 +60,11 @@ release.
|
|||
`org.gamecult.eve.unity-uitoolkit-{version}.tgz` artifact as local smoke
|
||||
evidence. The tagged release still belongs in the EveUnity repo.
|
||||
|
||||
The test stage declares the Unity EditMode runner contract: the current runner
|
||||
is `scripts/run-aetheria-unity-editmode-tests.ps1`, runs
|
||||
`GameCult.Eve.UnityUIToolkit.Tests` on `EditMode`, writes XML and log artifacts
|
||||
under `artifacts/aetheria-unity-editmode/{stamp}`, and temporarily adds
|
||||
`org.gamecult.eve.unity-uitoolkit` to Aetheria's Unity `testables`. This is a
|
||||
Unity package consumption proof. The test contract names the CultLib-owned
|
||||
The test stage declares the Unity EditMode runner contract:
|
||||
`scripts/run-uitoolkit-tests.ps1` runs `GameCult.Eve.UnityUIToolkit.Tests` on
|
||||
`EditMode` from EveUnity's package-only `TestProject` and writes XML and log
|
||||
artifacts under `artifacts/uitoolkit-tests/{stamp}`. This is a generic Unity
|
||||
package consumption proof. The test contract names the CultLib-owned
|
||||
NuGet/precompiled assembly inputs Unity needs during incubation; CultLib still
|
||||
owns the .NET/NuGet dependency story for its assemblies.
|
||||
Each managed dependency record carries a nested `dependencyContract` naming
|
||||
|
|
|
|||
|
|
@ -107,14 +107,14 @@
|
|||
"ownerRepo": "EveUnity",
|
||||
"runnerKind": "unity-editmode-batchmode",
|
||||
"runnerScript": "scripts/run-uitoolkit-tests.ps1",
|
||||
"consumerProject": "E:\\Projects\\Aetheria",
|
||||
"consumerProject": "TestProject",
|
||||
"unityExeDefault": "C:\\Program Files\\Unity\\Hub\\Editor\\6000.4.2f1\\Editor\\Unity.exe",
|
||||
"packageName": "org.gamecult.eve.unity-uitoolkit",
|
||||
"testAssembly": "GameCult.Eve.UnityUIToolkit.Tests",
|
||||
"testPlatform": "EditMode",
|
||||
"resultsArtifact": "artifacts/aetheria-unity-editmode/{stamp}/unity-editmode-results.xml",
|
||||
"logArtifact": "artifacts/aetheria-unity-editmode/{stamp}/unity-editmode.log",
|
||||
"manifestMutation": "Temporarily adds org.gamecult.eve.unity-uitoolkit to Aetheria Packages/manifest.json testables and restores the manifest after the run.",
|
||||
"resultsArtifact": "artifacts/uitoolkit-tests/{stamp}/unity-editmode-results.xml",
|
||||
"logArtifact": "artifacts/uitoolkit-tests/{stamp}/unity-editmode.log",
|
||||
"manifestMutation": "none",
|
||||
"managedAssemblyDependencies": [
|
||||
{
|
||||
"assemblyName": "GameCult.Caching.dll",
|
||||
|
|
|
|||
|
|
@ -1,77 +1,42 @@
|
|||
param(
|
||||
[string] $AetheriaRoot = "E:\Projects\Aetheria",
|
||||
[string] $UnityExe = "C:\Program Files\Unity\Hub\Editor\6000.4.2f1\Editor\Unity.exe",
|
||||
[string] $OutputRoot = "artifacts\aetheria-consumer"
|
||||
[string] $CultLibRoot = "E:\Projects\CultLib",
|
||||
[string] $ProjectRoot = "TestProject",
|
||||
[string] $OutputRoot = "artifacts\package-tests"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$packageRoot = Join-Path $repoRoot "packages\org.gamecult.eve.unity-scene"
|
||||
$manifestPath = Join-Path $AetheriaRoot "Packages\manifest.json"
|
||||
$output = if ([System.IO.Path]::IsPathRooted($OutputRoot)) {
|
||||
$OutputRoot
|
||||
} else {
|
||||
Join-Path $repoRoot $OutputRoot
|
||||
$projectPath = if ([IO.Path]::IsPathRooted($ProjectRoot)) { $ProjectRoot } else { Join-Path $repoRoot $ProjectRoot }
|
||||
$output = if ([IO.Path]::IsPathRooted($OutputRoot)) { $OutputRoot } else { Join-Path $repoRoot $OutputRoot }
|
||||
$cultLibBuilder = Join-Path $CultLibRoot "scripts\build-unity-package.ps1"
|
||||
foreach ($required in @($UnityExe, $projectPath, $cultLibBuilder)) {
|
||||
if (-not (Test-Path -LiteralPath $required)) { throw "Required EveUnity package-test path not found: $required" }
|
||||
}
|
||||
|
||||
foreach ($required in @($packageRoot, $manifestPath, $UnityExe)) {
|
||||
if (-not (Test-Path -LiteralPath $required)) {
|
||||
throw "Required EveUnity consumer-test path not found: $required"
|
||||
}
|
||||
}
|
||||
powershell -ExecutionPolicy Bypass -File $cultLibBuilder
|
||||
if ($LASTEXITCODE -ne 0) { throw "CultLib Unity package build failed with exit code $LASTEXITCODE" }
|
||||
|
||||
$stamp = Get-Date -Format "yyyyMMddTHHmmss"
|
||||
$runRoot = Join-Path $output $stamp
|
||||
$runRoot = Join-Path $output (Get-Date -Format "yyyyMMddTHHmmss")
|
||||
New-Item -ItemType Directory -Force -Path $runRoot | Out-Null
|
||||
$resultsPath = Join-Path $runRoot "unity-editmode-results.xml"
|
||||
$logPath = Join-Path $runRoot "unity-editmode.log"
|
||||
$originalManifest = Get-Content -Raw -LiteralPath $manifestPath
|
||||
|
||||
try {
|
||||
$manifest = $originalManifest | ConvertFrom-Json
|
||||
$manifestUri = [Uri] (($AetheriaRoot.TrimEnd('\\') + '\\'))
|
||||
$packageUri = [Uri] (($packageRoot.TrimEnd('\\') + '\\'))
|
||||
$relativePackageRoot = [Uri]::UnescapeDataString(
|
||||
$manifestUri.MakeRelativeUri($packageUri).ToString()).TrimEnd('/')
|
||||
$dependency = "file:" + ($relativePackageRoot -replace '\\', '/')
|
||||
$manifest.dependencies.'org.gamecult.eve.unity-scene' = $dependency
|
||||
$testables = @($manifest.testables) | Where-Object { $_ }
|
||||
if ($testables -notcontains 'org.gamecult.eve.unity-scene') {
|
||||
$testables += 'org.gamecult.eve.unity-scene'
|
||||
}
|
||||
if ($manifest.PSObject.Properties.Name -contains 'testables') {
|
||||
$manifest.testables = $testables
|
||||
} else {
|
||||
$manifest | Add-Member -NotePropertyName testables -NotePropertyValue $testables
|
||||
}
|
||||
$manifest | ConvertTo-Json -Depth 32 | Set-Content -LiteralPath $manifestPath
|
||||
|
||||
$arguments = @(
|
||||
'-batchmode',
|
||||
'-projectPath', $AetheriaRoot,
|
||||
'-runTests',
|
||||
'-testPlatform', 'EditMode',
|
||||
'-assemblyNames', 'GameCult.Eve.UnityScene.Tests',
|
||||
'-testResults', $resultsPath,
|
||||
'-logFile', $logPath
|
||||
)
|
||||
$process = Start-Process -FilePath $UnityExe -ArgumentList $arguments -Wait -PassThru -WindowStyle Hidden
|
||||
if ($process.ExitCode -ne 0) {
|
||||
if (Test-Path -LiteralPath $logPath) {
|
||||
Get-Content -LiteralPath $logPath -Tail 120
|
||||
}
|
||||
throw "EveUnity consumer tests failed with exit code $($process.ExitCode)"
|
||||
}
|
||||
} finally {
|
||||
Set-Content -NoNewline -LiteralPath $manifestPath -Value $originalManifest
|
||||
$arguments = @(
|
||||
"-batchmode", "-projectPath", $projectPath,
|
||||
"-runTests", "-testPlatform", "EditMode",
|
||||
"-assemblyNames", "GameCult.Eve.UnityScene.Tests",
|
||||
"-testResults", $resultsPath, "-logFile", $logPath
|
||||
)
|
||||
$process = Start-Process -FilePath $UnityExe -ArgumentList $arguments -Wait -PassThru -WindowStyle Hidden
|
||||
if ($process.ExitCode -ne 0) {
|
||||
if (Test-Path -LiteralPath $logPath) { Get-Content -LiteralPath $logPath -Tail 120 }
|
||||
throw "EveUnity package tests failed with exit code $($process.ExitCode)"
|
||||
}
|
||||
|
||||
[xml] $results = Get-Content -Raw -LiteralPath $resultsPath
|
||||
$run = $results.SelectSingleNode('//test-run')
|
||||
if ($null -eq $run -or [int] $run.failed -gt 0) {
|
||||
throw "EveUnity consumer tests did not pass: $resultsPath"
|
||||
[xml]$results = Get-Content -LiteralPath $resultsPath -Raw
|
||||
$run = $results.SelectSingleNode("//test-run")
|
||||
if ($null -eq $run -or [int]$run.total -eq 0 -or [int]$run.failed -gt 0) {
|
||||
throw "EveUnity package tests did not pass: $resultsPath"
|
||||
}
|
||||
|
||||
Write-Host "EveUnity consumer tests: $($run.passed) passed, $($run.total) total"
|
||||
Write-Host "Results: $resultsPath"
|
||||
Write-Host "EveUnity generic package tests: $($run.passed) passed, $($run.total) total"
|
||||
Write-Host "Consumer: $projectPath"
|
||||
|
|
|
|||
|
|
@ -1,45 +1,42 @@
|
|||
param(
|
||||
[string] $AetheriaRoot = "E:\Projects\Aetheria",
|
||||
[string] $UnityExe = "C:\Program Files\Unity\Hub\Editor\6000.4.2f1\Editor\Unity.exe",
|
||||
[string] $OutputRoot = "artifacts\uitoolkit-consumer"
|
||||
[string] $CultLibRoot = "E:\Projects\CultLib",
|
||||
[string] $ProjectRoot = "TestProject",
|
||||
[string] $OutputRoot = "artifacts\uitoolkit-tests"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$manifestPath = Join-Path $AetheriaRoot "Packages\manifest.json"
|
||||
$projectPath = if ([IO.Path]::IsPathRooted($ProjectRoot)) { $ProjectRoot } else { Join-Path $repoRoot $ProjectRoot }
|
||||
$output = if ([IO.Path]::IsPathRooted($OutputRoot)) { $OutputRoot } else { Join-Path $repoRoot $OutputRoot }
|
||||
foreach ($required in @($manifestPath, $UnityExe, (Join-Path $repoRoot "packages\org.gamecult.eve.unity-uitoolkit"))) {
|
||||
$cultLibBuilder = Join-Path $CultLibRoot "scripts\build-unity-package.ps1"
|
||||
foreach ($required in @($UnityExe, $projectPath, $cultLibBuilder)) {
|
||||
if (-not (Test-Path -LiteralPath $required)) { throw "Required EveUnity UI Toolkit test path not found: $required" }
|
||||
}
|
||||
|
||||
powershell -ExecutionPolicy Bypass -File $cultLibBuilder
|
||||
if ($LASTEXITCODE -ne 0) { throw "CultLib Unity package build failed with exit code $LASTEXITCODE" }
|
||||
|
||||
$runRoot = Join-Path $output (Get-Date -Format "yyyyMMddTHHmmss")
|
||||
New-Item -ItemType Directory -Force -Path $runRoot | Out-Null
|
||||
$resultsPath = Join-Path $runRoot "unity-editmode-results.xml"
|
||||
$logPath = Join-Path $runRoot "unity-editmode.log"
|
||||
$originalManifest = Get-Content -LiteralPath $manifestPath -Raw
|
||||
try {
|
||||
$manifest = $originalManifest | ConvertFrom-Json
|
||||
$testables = @($manifest.testables) | Where-Object { $_ }
|
||||
if ($testables -notcontains "org.gamecult.eve.unity-uitoolkit") { $testables += "org.gamecult.eve.unity-uitoolkit" }
|
||||
if ($manifest.PSObject.Properties.Name -contains "testables") { $manifest.testables = $testables }
|
||||
else { $manifest | Add-Member -NotePropertyName testables -NotePropertyValue $testables }
|
||||
$manifest | ConvertTo-Json -Depth 32 | Set-Content -LiteralPath $manifestPath
|
||||
$arguments = @(
|
||||
"-batchmode", "-projectPath", $AetheriaRoot,
|
||||
"-runTests", "-testPlatform", "EditMode",
|
||||
"-assemblyNames", "GameCult.Eve.UnityUIToolkit.Tests",
|
||||
"-testResults", $resultsPath, "-logFile", $logPath
|
||||
)
|
||||
$process = Start-Process -FilePath $UnityExe -ArgumentList $arguments -Wait -PassThru -WindowStyle Hidden
|
||||
if ($process.ExitCode -ne 0) {
|
||||
Get-Content -LiteralPath $logPath -Tail 120
|
||||
throw "EveUnity UI Toolkit tests failed with exit code $($process.ExitCode)"
|
||||
}
|
||||
} finally {
|
||||
Set-Content -NoNewline -LiteralPath $manifestPath -Value $originalManifest
|
||||
$arguments = @(
|
||||
"-batchmode", "-projectPath", $projectPath,
|
||||
"-runTests", "-testPlatform", "EditMode",
|
||||
"-assemblyNames", "GameCult.Eve.UnityUIToolkit.Tests",
|
||||
"-testResults", $resultsPath, "-logFile", $logPath
|
||||
)
|
||||
$process = Start-Process -FilePath $UnityExe -ArgumentList $arguments -Wait -PassThru -WindowStyle Hidden
|
||||
if ($process.ExitCode -ne 0) {
|
||||
if (Test-Path -LiteralPath $logPath) { Get-Content -LiteralPath $logPath -Tail 120 }
|
||||
throw "EveUnity UI Toolkit tests failed with exit code $($process.ExitCode)"
|
||||
}
|
||||
|
||||
[xml]$results = Get-Content -LiteralPath $resultsPath -Raw
|
||||
$run = $results.SelectSingleNode("//test-run")
|
||||
if ($null -eq $run -or [int]$run.total -eq 0 -or [int]$run.failed -gt 0) { throw "EveUnity UI Toolkit tests did not pass: $resultsPath" }
|
||||
Write-Host "EveUnity UI Toolkit tests: $($run.passed) passed, $($run.total) total"
|
||||
if ($null -eq $run -or [int]$run.total -eq 0 -or [int]$run.failed -gt 0) {
|
||||
throw "EveUnity UI Toolkit tests did not pass: $resultsPath"
|
||||
}
|
||||
Write-Host "EveUnity generic UI Toolkit tests: $($run.passed) passed, $($run.total) total"
|
||||
Write-Host "Consumer: $projectPath"
|
||||
|
|
|
|||
Reference in a new issue