Add EveUnity release request contract
This commit is contained in:
parent
ce7a7040c8
commit
6a3d01cb00
13 changed files with 323 additions and 11 deletions
|
|
@ -100,10 +100,16 @@ if ($releaseContract.packageName -ne "org.gamecult.eve.unity-uitoolkit") {
|
|||
if ($releaseContract.artifactKind -ne "upm-package") {
|
||||
throw "EveUnity release contract has unexpected artifact kind: $($releaseContract.artifactKind)"
|
||||
}
|
||||
if ($releaseContract.requestSchema -ne "gamecult.eve.runtime_release_request.v1") {
|
||||
throw "EveUnity release contract has unexpected request schema: $($releaseContract.requestSchema)"
|
||||
}
|
||||
if (-not ($releaseContract.tagPattern -match "\{version\}")) {
|
||||
throw "EveUnity release contract tag pattern must include {version}: $($releaseContract.tagPattern)"
|
||||
}
|
||||
foreach ($pathProperty in @("packageRoot", "versionSource")) {
|
||||
if (-not ($releaseContract.artifactPattern -match "\{version\}")) {
|
||||
throw "EveUnity release contract artifact pattern must include {version}: $($releaseContract.artifactPattern)"
|
||||
}
|
||||
foreach ($pathProperty in @("packageRoot", "versionSource", "requestBuilder")) {
|
||||
$relativePath = $releaseContract.$pathProperty
|
||||
if (-not $relativePath) {
|
||||
throw "EveUnity release contract missing $pathProperty"
|
||||
|
|
@ -117,6 +123,17 @@ $packageManifest = Get-Content -LiteralPath (Join-Path $projectRoot $releaseCont
|
|||
if ($packageManifest.name -ne $releaseContract.packageName) {
|
||||
throw "EveUnity release contract package name does not match package manifest: $($releaseContract.packageName) vs $($packageManifest.name)"
|
||||
}
|
||||
if (-not $packageManifest.version) {
|
||||
throw "EveUnity release contract package manifest missing version"
|
||||
}
|
||||
if ($packageManifest.dependencies."org.gamecult.eve.surface" -ne "0.1.0") {
|
||||
throw "EveUnity package manifest missing org.gamecult.eve.surface dependency"
|
||||
}
|
||||
|
||||
& (Join-Path $projectRoot "scripts\run-eveunity-release-contract-smoke.ps1")
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "EveUnity release contract smoke failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
$testContract = $manifest.lifecycle.test.testContract
|
||||
if ($null -eq $testContract) {
|
||||
|
|
|
|||
95
scripts/run-eveunity-release-contract-smoke.ps1
Normal file
95
scripts/run-eveunity-release-contract-smoke.ps1
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
param(
|
||||
[string] $CapabilityManifestPath = "packages\org.gamecult.eve.unity-uitoolkit\eve-runtime-capability.json",
|
||||
[string] $OutputPath = "artifacts\eveunity-uitoolkit-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 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 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 release contract missing $field"
|
||||
}
|
||||
}
|
||||
if ($releaseContract.ownerRepo -ne "EveUnity") {
|
||||
throw "Unexpected EveUnity release owner: $($releaseContract.ownerRepo)"
|
||||
}
|
||||
if ($releaseContract.requestSchema -ne "gamecult.eve.runtime_release_request.v1") {
|
||||
throw "Unexpected EveUnity release request schema: $($releaseContract.requestSchema)"
|
||||
}
|
||||
if ($releaseContract.artifactKind -ne "upm-package") {
|
||||
throw "Unexpected EveUnity 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 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 release request builder failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $absoluteOutputPath)) {
|
||||
throw "EveUnity 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-uitoolkit" },
|
||||
@{ field = "version"; value = $packageManifest.version },
|
||||
@{ field = "packageRoot"; value = "packages/org.gamecult.eve.unity-uitoolkit" },
|
||||
@{ field = "versionSource"; value = "packages/org.gamecult.eve.unity-uitoolkit/package.json" },
|
||||
@{ field = "artifactKind"; value = "upm-package" }
|
||||
)) {
|
||||
if ($request.($expectation.field) -ne $expectation.value) {
|
||||
throw "EveUnity 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 release tag: $($request.tagName)"
|
||||
}
|
||||
$expectedArtifactPath = $releaseContract.artifactPattern.Replace("{version}", $packageManifest.version)
|
||||
if ($request.artifactPath -ne $expectedArtifactPath) {
|
||||
throw "Unexpected EveUnity release artifact path: $($request.artifactPath)"
|
||||
}
|
||||
if ($request.dependencies."org.gamecult.eve.surface" -ne $packageManifest.dependencies."org.gamecult.eve.surface") {
|
||||
throw "EveUnity release request lost org.gamecult.eve.surface dependency"
|
||||
}
|
||||
|
||||
Write-Host "EveUnity release contract smoke passed: $absoluteOutputPath"
|
||||
|
|
@ -108,6 +108,9 @@ node $consumerScript $consumerExport `
|
|||
--expect-runtime-lifecycle-pending "unity-uitoolkit:capture:Unity batchmode or editor capture artifact" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:release:releaseContract.packageName:org.gamecult.eve.unity-uitoolkit" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:release:releaseContract.artifactKind:upm-package" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:release:releaseContract.requestSchema:gamecult.eve.runtime_release_request.v1" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:release:releaseContract.requestBuilder:tools/eveunity/eveunity-release-contract.mjs" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:release:releaseContract.artifactPattern:artifacts/eveunity-uitoolkit-release/{version}/org.gamecult.eve.unity-uitoolkit-{version}.tgz" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:release:releaseContract.tagPattern:eveunity-uitoolkit-v{version}" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:release:releaseContract.packageRoot:packages/org.gamecult.eve.unity-uitoolkit" `
|
||||
--expect-runtime-lifecycle-field "unity-uitoolkit:test:testContract.runnerKind:unity-editmode-batchmode" `
|
||||
|
|
|
|||
Loading…
Reference in a new issue