Add TUI release request contract
This commit is contained in:
parent
d71e9fc4e1
commit
ff1387f1eb
8 changed files with 292 additions and 3 deletions
|
|
@ -103,11 +103,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 "EveTui release contract missing $field"
|
||||
}
|
||||
}
|
||||
if ($releaseContract.requestSchema -ne "gamecult.eve.runtime_release_request.v1") {
|
||||
throw "EveTui release contract has unexpected request schema: $($releaseContract.requestSchema)"
|
||||
}
|
||||
foreach ($pathProperty in @("packageRoot", "versionSource")) {
|
||||
$relativePath = $releaseContract.$pathProperty
|
||||
$absolutePath = Join-Path $projectRoot $relativePath
|
||||
|
|
@ -115,6 +118,13 @@ foreach ($pathProperty in @("packageRoot", "versionSource")) {
|
|||
throw "EveTui 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 "EveTui 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")) {
|
||||
|
|
@ -161,6 +171,7 @@ foreach ($pathProperty in @("requestBuilder", "advertisementPath")) {
|
|||
}
|
||||
|
||||
& (Join-Path $projectRoot "scripts\run-evetui-split-handoff-smoke.ps1")
|
||||
& (Join-Path $projectRoot "scripts\run-evetui-release-contract-smoke.ps1")
|
||||
& (Join-Path $projectRoot "scripts\run-evetui-provider-shell-smoke.ps1")
|
||||
& (Join-Path $projectRoot "scripts\run-evetui-capture-contract-smoke.ps1")
|
||||
|
||||
|
|
|
|||
98
scripts/run-evetui-release-contract-smoke.ps1
Normal file
98
scripts/run-evetui-release-contract-smoke.ps1
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
param(
|
||||
[string] $CapabilityManifestPath = "runtimes\incubating\eve-tui\eve-runtime-capability.json",
|
||||
[string] $OutputPath = "artifacts\evetui-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 "EveTui release contract input not found: $absoluteCapabilityPath"
|
||||
}
|
||||
|
||||
$manifest = Get-Content -LiteralPath $absoluteCapabilityPath -Raw | ConvertFrom-Json
|
||||
$releaseContract = $manifest.lifecycle.release.releaseContract
|
||||
if ($null -eq $releaseContract) {
|
||||
throw "EveTui release contract missing lifecycle.release.releaseContract"
|
||||
}
|
||||
foreach ($field in @("ownerRepo", "packageName", "packageRoot", "versionSource", "tagPattern", "artifactKind", "requestSchema", "requestBuilder", "artifactPattern", "publishProof")) {
|
||||
if (-not $releaseContract.$field) {
|
||||
throw "EveTui release contract missing $field"
|
||||
}
|
||||
}
|
||||
if ($releaseContract.ownerRepo -ne "EveTui") {
|
||||
throw "Unexpected EveTui release owner: $($releaseContract.ownerRepo)"
|
||||
}
|
||||
if ($releaseContract.packageName -ne "eve-tui") {
|
||||
throw "Unexpected EveTui package name: $($releaseContract.packageName)"
|
||||
}
|
||||
if ($releaseContract.requestSchema -ne "gamecult.eve.runtime_release_request.v1") {
|
||||
throw "Unexpected EveTui release request schema: $($releaseContract.requestSchema)"
|
||||
}
|
||||
if ($releaseContract.artifactKind -ne "terminal-runtime") {
|
||||
throw "Unexpected EveTui 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 "EveTui release contract path not found: $path"
|
||||
}
|
||||
}
|
||||
|
||||
node --test (Join-Path $projectRoot "tools\evetui\evetui-release-contract.test.mjs")
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "EveTui release contract tests failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
node $builderPath --capability $absoluteCapabilityPath --package $packagePath --output $absoluteOutputPath
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "EveTui release request builder failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $absoluteOutputPath)) {
|
||||
throw "EveTui 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 = "EveTui" },
|
||||
@{ field = "repository"; value = "GameCult/EveTui" },
|
||||
@{ field = "packageName"; value = "eve-tui" },
|
||||
@{ field = "version"; value = $packageManifest.version },
|
||||
@{ field = "packageRoot"; value = "runtimes/incubating/eve-tui" },
|
||||
@{ field = "versionSource"; value = "runtimes/incubating/eve-tui/package.json" },
|
||||
@{ field = "artifactKind"; value = "terminal-runtime" }
|
||||
)) {
|
||||
if ($request.($expectation.field) -ne $expectation.value) {
|
||||
throw "EveTui 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 EveTui release tag: $($request.tagName)"
|
||||
}
|
||||
$expectedArtifactPath = $releaseContract.artifactPattern.Replace("{version}", $packageManifest.version)
|
||||
if ($request.artifactPath -ne $expectedArtifactPath) {
|
||||
throw "Unexpected EveTui release artifact path: $($request.artifactPath)"
|
||||
}
|
||||
if ($request.main -ne $packageManifest.main) {
|
||||
throw "EveTui release request lost package main entry"
|
||||
}
|
||||
|
||||
Write-Host "EveTui release contract smoke passed: $absoluteOutputPath"
|
||||
|
|
@ -191,6 +191,10 @@ node $consumerScript $consumerExport `
|
|||
--expect-runtime-lifecycle-pending "tui:test:TUI provider-advertisement smoke runs from EveTui with durable terminal transcript or cell-grid artifacts" `
|
||||
--expect-runtime-lifecycle-pending "tui:capture:TUI terminal transcript or cell-grid capture artifact" `
|
||||
--expect-runtime-lifecycle-field "tui:release:releaseContract.artifactKind:terminal-runtime" `
|
||||
--expect-runtime-lifecycle-field "tui:release:releaseContract.versionSource:runtimes/incubating/eve-tui/package.json" `
|
||||
--expect-runtime-lifecycle-field "tui:release:releaseContract.requestSchema:gamecult.eve.runtime_release_request.v1" `
|
||||
--expect-runtime-lifecycle-field "tui:release:releaseContract.requestBuilder:tools/evetui/evetui-release-contract.mjs" `
|
||||
--expect-runtime-lifecycle-field "tui:release:releaseContract.artifactPattern:artifacts/evetui-release/{version}/eve-tui-{version}.tgz" `
|
||||
--expect-runtime-lifecycle-field "tui:test:testContract.runnerKind:terminal-provider-shell-smoke" `
|
||||
--expect-runtime-lifecycle-field "tui:test:testContract.runnerScript:scripts/run-evetui-provider-shell-smoke.ps1" `
|
||||
--expect-runtime-lifecycle-field "tui:capture:captureContract.captureKind:terminal-transcript-or-cell-grid" `
|
||||
|
|
|
|||
Loading…
Reference in a new issue