Add Unity scene release request contract

This commit is contained in:
Meta Vens 2026-07-09 11:24:24 +01:00
commit 7af447fa57
7 changed files with 165 additions and 5 deletions

View file

@ -105,11 +105,14 @@ foreach ($stage in @("release", "test", "capture")) {
}
$releaseContract = $manifest.lifecycle.release.releaseContract
foreach ($field in @("ownerRepo", "packageName", "packageRoot", "versionSource", "tagPattern", "artifactKind", "publishProof")) {
foreach ($field in @("ownerRepo", "packageName", "packageRoot", "versionSource", "tagPattern", "artifactKind", "requestSchema", "requestBuilder", "artifactPattern", "publishProof")) {
if (-not $releaseContract.$field) {
throw "EveUnity scene release contract missing $field"
}
}
if ($releaseContract.requestSchema -ne "gamecult.eve.runtime_release_request.v1") {
throw "EveUnity scene release contract has unexpected request schema: $($releaseContract.requestSchema)"
}
foreach ($pathProperty in @("packageRoot", "versionSource")) {
$relativePath = $releaseContract.$pathProperty
$absolutePath = Join-Path $projectRoot $relativePath
@ -117,6 +120,13 @@ foreach ($pathProperty in @("packageRoot", "versionSource")) {
throw "EveUnity scene release contract $pathProperty does not exist: $relativePath"
}
}
foreach ($pathProperty in @("requestBuilder")) {
$relativePath = $releaseContract.$pathProperty
$absolutePath = Join-Path $projectRoot $relativePath
if (-not (Test-Path -LiteralPath $absolutePath)) {
throw "EveUnity scene release contract $pathProperty does not exist: $relativePath"
}
}
$testContract = $manifest.lifecycle.test.testContract
foreach ($field in @("ownerRepo", "runnerKind", "runnerScript", "consumerProject", "packageName", "testAssembly", "testPlatform", "resultsArtifact", "logArtifact", "manifestMutation")) {
@ -164,6 +174,7 @@ foreach ($pathProperty in @("requestBuilder", "advertisementPath")) {
& (Join-Path $projectRoot "scripts\run-eveunity-scene-split-handoff-smoke.ps1")
& (Join-Path $projectRoot "scripts\run-eveunity-scene-provider-shell-smoke.ps1")
& (Join-Path $projectRoot "scripts\run-eveunity-scene-release-contract-smoke.ps1")
& (Join-Path $projectRoot "scripts\run-eveunity-scene-capture-contract-smoke.ps1")
Write-Host "EveUnity scene lifecycle smoke passed: $absoluteManifestPath"

View file

@ -0,0 +1,98 @@
param(
[string] $CapabilityManifestPath = "runtimes\incubating\eve-unity-scene\eve-runtime-capability.json",
[string] $OutputPath = "artifacts\eveunity-scene-release-contract\latest\release-request.json"
)
$ErrorActionPreference = "Stop"
$projectRoot = Split-Path -Parent $PSScriptRoot
$absoluteCapabilityPath = if ([System.IO.Path]::IsPathRooted($CapabilityManifestPath)) {
$CapabilityManifestPath
} else {
Join-Path $projectRoot $CapabilityManifestPath
}
$absoluteOutputPath = if ([System.IO.Path]::IsPathRooted($OutputPath)) {
$OutputPath
} else {
Join-Path $projectRoot $OutputPath
}
if (-not (Test-Path -LiteralPath $absoluteCapabilityPath)) {
throw "EveUnity scene release contract input not found: $absoluteCapabilityPath"
}
$manifest = Get-Content -LiteralPath $absoluteCapabilityPath -Raw | ConvertFrom-Json
$releaseContract = $manifest.lifecycle.release.releaseContract
if ($null -eq $releaseContract) {
throw "EveUnity scene release contract missing lifecycle.release.releaseContract"
}
foreach ($field in @("ownerRepo", "packageName", "packageRoot", "versionSource", "tagPattern", "artifactKind", "requestSchema", "requestBuilder", "artifactPattern", "publishProof")) {
if (-not $releaseContract.$field) {
throw "EveUnity scene release contract missing $field"
}
}
if ($releaseContract.ownerRepo -ne "EveUnity") {
throw "Unexpected EveUnity scene release owner: $($releaseContract.ownerRepo)"
}
if ($releaseContract.packageName -ne "org.gamecult.eve.unity-scene") {
throw "Unexpected EveUnity scene package name: $($releaseContract.packageName)"
}
if ($releaseContract.requestSchema -ne "gamecult.eve.runtime_release_request.v1") {
throw "Unexpected EveUnity scene release request schema: $($releaseContract.requestSchema)"
}
if ($releaseContract.artifactKind -ne "upm-package") {
throw "Unexpected EveUnity scene release artifact kind: $($releaseContract.artifactKind)"
}
$builderPath = Join-Path $projectRoot $releaseContract.requestBuilder
$packagePath = Join-Path $projectRoot $releaseContract.versionSource
$packageRoot = Join-Path $projectRoot $releaseContract.packageRoot
foreach ($path in @($builderPath, $packagePath, $packageRoot)) {
if (-not (Test-Path -LiteralPath $path)) {
throw "EveUnity scene release contract path not found: $path"
}
}
node --test (Join-Path $projectRoot "tools\eveunity\eveunity-release-contract.test.mjs")
if ($LASTEXITCODE -ne 0) {
throw "EveUnity release contract tests failed with exit code $LASTEXITCODE"
}
node $builderPath --capability $absoluteCapabilityPath --package $packagePath --output $absoluteOutputPath
if ($LASTEXITCODE -ne 0) {
throw "EveUnity scene release request builder failed with exit code $LASTEXITCODE"
}
if (-not (Test-Path -LiteralPath $absoluteOutputPath)) {
throw "EveUnity scene release request was not written: $absoluteOutputPath"
}
$request = Get-Content -LiteralPath $absoluteOutputPath -Raw | ConvertFrom-Json
$packageManifest = Get-Content -LiteralPath $packagePath -Raw | ConvertFrom-Json
foreach ($expectation in @(
@{ field = "schema"; value = "gamecult.eve.runtime_release_request.v1" },
@{ field = "ownerRepo"; value = "EveUnity" },
@{ field = "repository"; value = "GameCult/EveUnity" },
@{ field = "packageName"; value = "org.gamecult.eve.unity-scene" },
@{ field = "version"; value = $packageManifest.version },
@{ field = "packageRoot"; value = "runtimes/incubating/eve-unity-scene" },
@{ field = "versionSource"; value = "runtimes/incubating/eve-unity-scene/package.json" },
@{ field = "artifactKind"; value = "upm-package" }
)) {
if ($request.($expectation.field) -ne $expectation.value) {
throw "EveUnity scene release request $($expectation.field) expected $($expectation.value) got $($request.($expectation.field))"
}
}
$expectedTagName = $releaseContract.tagPattern.Replace("{version}", $packageManifest.version)
if ($request.tagName -ne $expectedTagName) {
throw "Unexpected EveUnity scene release tag: $($request.tagName)"
}
$expectedArtifactPath = $releaseContract.artifactPattern.Replace("{version}", $packageManifest.version)
if ($request.artifactPath -ne $expectedArtifactPath) {
throw "Unexpected EveUnity scene release artifact path: $($request.artifactPath)"
}
if ($request.dependencies."org.gamecult.eve.surface" -ne $packageManifest.dependencies."org.gamecult.eve.surface") {
throw "EveUnity scene release request lost org.gamecult.eve.surface dependency"
}
Write-Host "EveUnity scene release contract smoke passed: $absoluteOutputPath"

View file

@ -153,6 +153,10 @@ node $consumerScript $consumerExport `
--expect-runtime-lifecycle-field "unity-scene:release:releaseContract.packageName:org.gamecult.eve.unity-scene" `
--expect-runtime-lifecycle-field "unity-scene:release:releaseContract.artifactKind:upm-package" `
--expect-runtime-lifecycle-field "unity-scene:release:releaseContract.tagPattern:eveunity-scene-v{version}" `
--expect-runtime-lifecycle-field "unity-scene:release:releaseContract.versionSource:runtimes/incubating/eve-unity-scene/package.json" `
--expect-runtime-lifecycle-field "unity-scene:release:releaseContract.requestSchema:gamecult.eve.runtime_release_request.v1" `
--expect-runtime-lifecycle-field "unity-scene:release:releaseContract.requestBuilder:tools/eveunity/eveunity-release-contract.mjs" `
--expect-runtime-lifecycle-field "unity-scene:release:releaseContract.artifactPattern:artifacts/eveunity-scene-release/{version}/org.gamecult.eve.unity-scene-{version}.tgz" `
--expect-runtime-lifecycle-field "unity-scene:test:testContract.runnerKind:unity-scene-provider-shell-smoke" `
--expect-runtime-lifecycle-field "unity-scene:test:testContract.runnerScript:scripts/run-eveunity-scene-provider-shell-smoke.ps1" `
--expect-runtime-lifecycle-field "unity-scene:capture:captureContract.captureKind:unity-scene-frame-png" `