🆕 Select Alpha versions by suspend compatibility [ci skip]
Publish the version planner and compatibility manifest contract. Wait for a new runtime baseline before building the next Alpha.
This commit is contained in:
1 parent
9a6ace7a3a
commit
98f1677b5f
6 files changed
+323
-53
No files matched your search
@@ -22,7 +22,7 @@ on:
|
||||
type: boolean
|
||||
default: false
|
||||
rebuild:
|
||||
description: "Build a new patch revision (runtime-<commit>-pN) even if this upstream commit is already released"
|
||||
description: "Plan a rebuild of an already published runtime using verified compatibility"
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
@@ -66,56 +66,37 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
# Check released commits inside the build lock, including queued runs.
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
# Select the version inside the build lock, including queued runs.
|
||||
- name: Plan Alpha release
|
||||
id: plan
|
||||
shell: bash
|
||||
shell: pwsh
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RUNTIME_COMMIT: ${{ needs.resolve.outputs.commit }}
|
||||
REBUILD: ${{ github.event_name == 'push' || inputs.rebuild }}
|
||||
PACKAGING_PUSH: ${{ github.event_name == 'push' }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
commit="$RUNTIME_COMMIT"
|
||||
# Already published (alpha or stable) under any short-hash length or -pN revision?
|
||||
max_rev=0
|
||||
tags=$(gh release list -R "$GITHUB_REPOSITORY" --limit 1000 --json tagName,isDraft -q '.[] | select(.isDraft | not) | .tagName')
|
||||
for tag in $tags; do
|
||||
[[ "$tag" == runtime-* ]] || continue
|
||||
rest="${tag#runtime-}"
|
||||
base="${rest%%-p*}"
|
||||
case "$commit" in
|
||||
"$base"*)
|
||||
rev=1
|
||||
if [ "$rest" != "$base" ]; then
|
||||
num="${rest#"$base"-p}"
|
||||
case "$num" in
|
||||
''|*[!0-9]*) ;;
|
||||
*) rev="$num" ;;
|
||||
esac
|
||||
fi
|
||||
if [ "$rev" -gt "$max_rev" ]; then max_rev="$rev"; fi
|
||||
echo "Upstream $commit is already released as $tag (rev $rev)"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
skip=false
|
||||
suffix=""
|
||||
if [ "$max_rev" -gt 0 ]; then
|
||||
if [ "$REBUILD" = "true" ]; then
|
||||
suffix="-p$((max_rev + 1))"
|
||||
echo "Rebuild requested: will publish with suffix $suffix"
|
||||
else
|
||||
skip=true
|
||||
fi
|
||||
fi
|
||||
echo "skip=$skip" >> "$GITHUB_OUTPUT"
|
||||
echo "suffix=$suffix" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
if: steps.plan.outputs.skip != 'true'
|
||||
with:
|
||||
persist-credentials: false
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$work = Join-Path $env:RUNNER_TEMP 'reims-vgpu'
|
||||
git config --global core.autocrlf false
|
||||
git clone -q --filter=blob:none --no-checkout --single-branch --branch $env:UPSTREAM_BRANCH $env:UPSTREAM_URL $work
|
||||
if ($LASTEXITCODE) { throw 'runtime clone failed' }
|
||||
$plan = & ./packaging/windows-runtime/scripts/plan-runtime-release.ps1 `
|
||||
-RuntimeRepo $work -RuntimeCommit $env:RUNTIME_COMMIT `
|
||||
-PackagingRepo $env:GITHUB_WORKSPACE -PackagingCommit $env:GITHUB_SHA `
|
||||
-Repository $env:GITHUB_REPOSITORY -Rebuild:($env:REBUILD -eq 'true') `
|
||||
-PackagingPush:($env:PACKAGING_PUSH -eq 'true')
|
||||
"skip=$($plan.Skip.ToString().ToLowerInvariant())" >> $env:GITHUB_OUTPUT
|
||||
if ($plan.Skip) { return }
|
||||
"UPSTREAM_DIR=$work" >> $env:GITHUB_ENV
|
||||
"RELEASE_ID=$($plan.ReleaseId)" >> $env:GITHUB_ENV
|
||||
"SUSPEND_COMPAT_ID=$($plan.SuspendCompatID)" >> $env:GITHUB_ENV
|
||||
"SUSPEND_VERIFICATION=$($plan.Evidence)" >> $env:GITHUB_ENV
|
||||
"SUSPEND_PREDECESSOR=$($plan.Predecessor)" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Setup MSYS2 CLANG64
|
||||
if: steps.plan.outputs.skip != 'true'
|
||||
@@ -140,13 +121,8 @@ jobs:
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$work = Join-Path $env:RUNNER_TEMP 'reims-vgpu'
|
||||
$work = $env:UPSTREAM_DIR
|
||||
foreach ($d in 'cargo', 'xdg-data', 'xdg-cache') { New-Item -ItemType Directory -Force -Path (Join-Path $env:RUNNER_TEMP $d) | Out-Null }
|
||||
# The runner's git defaults to core.autocrlf=true; LF patches need an LF
|
||||
# checkout (upstream also rewrites CRLF files to LF, install-ctl.sh).
|
||||
git config --global core.autocrlf false
|
||||
git clone -q --single-branch --branch $env:UPSTREAM_BRANCH $env:UPSTREAM_URL $work
|
||||
if ($LASTEXITCODE) { throw 'clone failed' }
|
||||
git -C $work checkout -q '${{ needs.resolve.outputs.commit }}'
|
||||
if ($LASTEXITCODE) { throw 'checkout failed' }
|
||||
git -C $work submodule update --init --depth 1 vendor/qemu
|
||||
@@ -178,7 +154,6 @@ jobs:
|
||||
git -C $m2vRepo checkout -q --detach FETCH_HEAD
|
||||
if ($LASTEXITCODE) { throw 'metal2vulkan checkout failed' }
|
||||
$short = (git -C $work rev-parse --short=7 HEAD).Trim()
|
||||
$releaseId = "$short${{ steps.plan.outputs.suffix }}"
|
||||
|
||||
# Applies what applies, skips what upstream already has, stops on a
|
||||
# conflict without touching the patch (AGENTS.md rule 4).
|
||||
@@ -202,11 +177,9 @@ jobs:
|
||||
metal2vulkan-runtime = { path = "$m2vFwd/crates/metal2vulkan-runtime" }
|
||||
"@ -replace '(?m)^ ', ''
|
||||
[IO.File]::WriteAllText((Join-Path $cargoHome 'config.toml'), ($cargoCfg.Replace("`r`n", "`n") + "`n"), [Text.UTF8Encoding]::new($false))
|
||||
"UPSTREAM_DIR=$work" >> $env:GITHUB_ENV
|
||||
"REIMS_UTIL_DIR=$utilRepo" >> $env:GITHUB_ENV
|
||||
"METAL2VULKAN_DIR=$m2vRepo" >> $env:GITHUB_ENV
|
||||
"SHORT_COMMIT=$short" >> $env:GITHUB_ENV
|
||||
"RELEASE_ID=$releaseId" >> $env:GITHUB_ENV
|
||||
"CARGO_HOME=$cargoHome" >> $env:GITHUB_ENV
|
||||
"XDG_DATA_HOME=$(Join-Path $env:RUNNER_TEMP 'xdg-data')" >> $env:GITHUB_ENV
|
||||
"XDG_CACHE_HOME=$(Join-Path $env:RUNNER_TEMP 'xdg-cache')" >> $env:GITHUB_ENV
|
||||
@@ -250,6 +223,8 @@ jobs:
|
||||
-TempRoot $env:RUNNER_TEMP `
|
||||
-Channel alpha `
|
||||
-ReleaseId $env:RELEASE_ID `
|
||||
-SuspendCompatID $env:SUSPEND_COMPAT_ID `
|
||||
-PackagingCommit $env:GITHUB_SHA `
|
||||
-Patches $applied
|
||||
|
||||
- name: Alpha entry gate
|
||||
@@ -260,6 +235,7 @@ jobs:
|
||||
& ./packaging/windows-runtime/scripts/check-runtime-alpha.ps1 `
|
||||
-OutDir (Join-Path $env:RUNNER_TEMP 'releases') `
|
||||
-Commit $env:RELEASE_ID -RequireSlim -RequiredCapability vm-suspend `
|
||||
-RequiredSuspendCompatID $env:SUSPEND_COMPAT_ID -RequiredPackagingCommit $env:GITHUB_SHA `
|
||||
-Zstd (Join-Path '${{ steps.msys2.outputs.msys2-location }}' 'usr\bin\zstd.exe') `
|
||||
-AppliedPatches @($env:APPLIED_PATCHES -split ',' | Where-Object { $_ })
|
||||
|
||||
@@ -298,6 +274,7 @@ jobs:
|
||||
ForEach-Object { Join-Path $dir $_ }
|
||||
$applied = if ($env:APPLIED_PATCHES) { ($env:APPLIED_PATCHES -split ',' | ForEach-Object { "- ``$_``" }) -join "`n" } else { '- (none)' }
|
||||
$merged = if ($env:MERGED) { "`n`nAlready upstream, skipped (retire from patches/): $env:MERGED" } else { '' }
|
||||
$compatibility = if ($env:SUSPEND_PREDECESSOR) { "`nVerified against $env:SUSPEND_PREDECESSOR. $env:SUSPEND_VERIFICATION" } else { '' }
|
||||
$notes = @"
|
||||
**Alpha** runtime (``$c``), built from [the Reims vGPU fork@$short]($sourceRepo/commit/${{ needs.resolve.outputs.commit }}).
|
||||
|
||||
@@ -308,6 +285,9 @@ jobs:
|
||||
|
||||
The optional ``reims-runtime-symbols-$c.tar.zst`` contains matching debug files for crash analysis.
|
||||
|
||||
Packaging commit: ``$env:GITHUB_SHA``
|
||||
Suspend compatibility ID: ``$env:SUSPEND_COMPAT_ID``$compatibility
|
||||
|
||||
Build: $env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID
|
||||
"@
|
||||
gh release create "runtime-$c" @assets --repo $env:GITHUB_REPOSITORY --target '${{ needs.resolve.outputs.commit }}' --prerelease --latest=false --title "Portable Runtime runtime-$c (alpha)" --notes $notes
|
||||
|
||||
@@ -27,6 +27,8 @@ param(
|
||||
[string]$Zstd,
|
||||
[string[]]$AppliedPatches = @(),
|
||||
[string]$RequiredCapability = '',
|
||||
[string]$RequiredSuspendCompatID = '',
|
||||
[string]$RequiredPackagingCommit = '',
|
||||
[switch]$RequireSlim,
|
||||
# Only for checking packages built before the 2026-11-28 rename ("candidate").
|
||||
[string]$ExpectChannel = 'alpha',
|
||||
@@ -86,6 +88,13 @@ try {
|
||||
if ($m.channel -ne $ExpectChannel) { throw "manifest channel is $($m.channel), expected $ExpectChannel" }
|
||||
if ($m.source_package -ne $names.source) { throw "manifest source_package is $($m.source_package), expected $($names.source)" }
|
||||
if ($RequiredCapability -and $RequiredCapability -notin $m.capabilities) { throw "manifest lacks capability $RequiredCapability" }
|
||||
if ($RequiredSuspendCompatID -and ($m.suspend_compat_id -cne $RequiredSuspendCompatID -or
|
||||
$Commit -cnotmatch ('^' + [regex]::Escape($RequiredSuspendCompatID) + '(?:-p[1-9][0-9]*)?$'))) {
|
||||
throw "manifest suspend_compat_id is $($m.suspend_compat_id), expected $RequiredSuspendCompatID for $Commit"
|
||||
}
|
||||
if ($RequiredPackagingCommit -and $m.packaging_commit -cne $RequiredPackagingCommit) {
|
||||
throw "manifest packaging_commit is $($m.packaging_commit), expected $RequiredPackagingCommit"
|
||||
}
|
||||
$files = @(Get-ChildItem -LiteralPath $root -Recurse -File)
|
||||
if ($m.file_count -ne $files.Count) { throw "manifest file_count is $($m.file_count), actual $($files.Count)" }
|
||||
$rawBytes = [int64](($files | Measure-Object Length -Sum).Sum)
|
||||
|
||||
@@ -49,6 +49,10 @@ param(
|
||||
# Release identifier for archive names and manifest.commit (defaults to short
|
||||
# upstream commit; e.g. "3731afd-p2" for a patch-queue rebuild of 3731afd).
|
||||
[string]$ReleaseId = '',
|
||||
[ValidatePattern('^(?:[0-9a-f]{7,40})?$')]
|
||||
[string]$SuspendCompatID = '',
|
||||
[ValidatePattern('^(?:[0-9a-f]{40})?$')]
|
||||
[string]$PackagingCommit = '',
|
||||
# Names from patches/series.txt actually applied. Not given: all of them.
|
||||
# Given but empty: none (every patch already upstream).
|
||||
[string[]]$Patches = @()
|
||||
@@ -128,6 +132,9 @@ foreach ($p in @($ctlExe, $utilExe, $qemuExe)) {
|
||||
$commit = (git -C $ReimsRepo rev-parse --short HEAD).Trim()
|
||||
$fullCommit = (git -C $ReimsRepo rev-parse HEAD).Trim()
|
||||
$id = if ($ReleaseId -and $ReleaseId.Trim()) { $ReleaseId.Trim() } else { $commit }
|
||||
if ($SuspendCompatID -and $id -cnotmatch ('^' + [regex]::Escape($SuspendCompatID) + '(?:-p[1-9][0-9]*)?$')) {
|
||||
throw "Suspend compatibility ID $SuspendCompatID does not match release $id"
|
||||
}
|
||||
$qemuRepo = Join-Path $ReimsRepo 'vendor\qemu'
|
||||
$qemuCommit = (git -C $qemuRepo rev-parse HEAD).Trim()
|
||||
$reimsOrigin = git -C $ReimsRepo config --get remote.origin.url 2>$null
|
||||
@@ -549,6 +556,8 @@ $manifest = [ordered]@{
|
||||
raw_bytes = [int64]((Get-ChildItem -LiteralPath $bundleDir -Recurse -File | Measure-Object Length -Sum).Sum) # Add the manifest's own size after writing it below.
|
||||
sha256 = $hashes
|
||||
}
|
||||
if ($SuspendCompatID) { $manifest['suspend_compat_id'] = $SuspendCompatID }
|
||||
if ($PackagingCommit) { $manifest['packaging_commit'] = $PackagingCommit }
|
||||
Write-Utf8 "$bundleDir\manifest.json" ($manifest | ConvertTo-Json -Depth 5)
|
||||
$manifest.raw_bytes += (Get-Item -LiteralPath "$bundleDir\manifest.json").Length
|
||||
Write-Utf8 "$bundleDir\manifest.json" ($manifest | ConvertTo-Json -Depth 5)
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$RuntimeRepo,
|
||||
[Parameter(Mandatory)][ValidatePattern('^[0-9a-f]{40}$')][string]$RuntimeCommit,
|
||||
[Parameter(Mandatory)][string]$PackagingRepo,
|
||||
[Parameter(Mandatory)][ValidatePattern('^[0-9a-f]{40}$')][string]$PackagingCommit,
|
||||
[Parameter(Mandatory)][string]$Repository,
|
||||
[switch]$Rebuild,
|
||||
[switch]$PackagingPush
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$tagPattern = '^runtime-(?<base>[0-9a-f]{7,40})(?:-p(?<revision>[1-9][0-9]*))?$'
|
||||
|
||||
function Invoke-VersionCommand([string]$command, [string[]]$argv) {
|
||||
$result = & $command @argv
|
||||
if ($LASTEXITCODE -ne 0) { throw "$command $($argv -join ' ') failed ($LASTEXITCODE)" }
|
||||
return $result
|
||||
}
|
||||
|
||||
function Test-InputsChanged([string]$Repo, [string]$From, [string]$To, [string[]]$Paths) {
|
||||
& git -C $Repo diff --quiet $From $To -- @Paths
|
||||
if ($LASTEXITCODE -gt 1) { throw "Could not compare suspend inputs from $From to $To" }
|
||||
return $LASTEXITCODE -eq 1
|
||||
}
|
||||
|
||||
function New-VersionPlan([string]$ReleaseId, [string]$Family, [string]$Evidence = '', [string]$Predecessor = '') {
|
||||
return [pscustomobject]@{
|
||||
Skip = $false
|
||||
ReleaseId = $ReleaseId
|
||||
SuspendCompatID = $Family
|
||||
Evidence = $Evidence
|
||||
Predecessor = $Predecessor
|
||||
}
|
||||
}
|
||||
|
||||
$remoteTags = @{}
|
||||
foreach ($line in (Invoke-VersionCommand git @('-C', $RuntimeRepo, 'ls-remote', '--tags', 'origin', 'refs/tags/runtime-*'))) {
|
||||
if ($line -match '^(?<sha>[0-9a-f]{40})\s+refs/tags/(?<tag>runtime-[^\s^]+)(?<peeled>\^\{\})?$') {
|
||||
if ($Matches.peeled -or !$remoteTags.ContainsKey($Matches.tag)) {
|
||||
$remoteTags[$Matches.tag] = $Matches.sha
|
||||
}
|
||||
}
|
||||
}
|
||||
$pages = (Invoke-VersionCommand gh @('api', '--paginate', '--slurp', "repos/$Repository/releases?per_page=100")) -join "`n"
|
||||
$releasePages = $pages | ConvertFrom-Json -NoEnumerate
|
||||
$published = @(foreach ($page in $releasePages) {
|
||||
foreach ($release in $page) {
|
||||
if ($release.draft -or $release.tag_name -notmatch $tagPattern) { continue }
|
||||
$family = $Matches.base
|
||||
$revision = if ($Matches.revision) { [int]$Matches.revision } else { 0 }
|
||||
$tag = $release.tag_name
|
||||
if (!$remoteTags.ContainsKey($tag)) { throw "Published runtime tag $tag was not found in Git" }
|
||||
$packaging = if ($release.body -match '(?m)^Packaging commit: `([0-9a-f]{40})`\s*$') { $Matches[1] } else { '' }
|
||||
$verifiedFamily = if ($release.body -match '(?m)^Suspend compatibility ID: `([0-9a-f]{7,40})`\s*$') { $Matches[1] } else { '' }
|
||||
[pscustomobject]@{
|
||||
Tag = $tag
|
||||
RuntimeCommit = $remoteTags[$tag]
|
||||
Packaging = $packaging
|
||||
Family = $family
|
||||
Revision = $revision
|
||||
VerifiedFamily = $verifiedFamily
|
||||
PublishedAt = [DateTimeOffset]$release.published_at
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$sameRuntime = @($published | Where-Object RuntimeCommit -eq $RuntimeCommit)
|
||||
if ($sameRuntime.Count -and (!$Rebuild -or ($PackagingPush -and ($sameRuntime | Where-Object Packaging -eq $PackagingCommit)))) {
|
||||
Write-Host "Skipping the already published runtime $RuntimeCommit."
|
||||
return [pscustomobject]@{ Skip = $true }
|
||||
}
|
||||
|
||||
# The verification belongs to the changed commit and names its exact other input.
|
||||
$approvalRepo = if ($PackagingPush -or $Rebuild) { $PackagingRepo } else { $RuntimeRepo }
|
||||
$approvalCommit = if ($PackagingPush -or $Rebuild) { $PackagingCommit } else { $RuntimeCommit }
|
||||
$otherInput = if ($PackagingPush -or $Rebuild) { $RuntimeCommit } else { $PackagingCommit }
|
||||
$message = (Invoke-VersionCommand git @('-C', $approvalRepo, 'show', '-s', '--format=%B', $approvalCommit)) -join "`n"
|
||||
$trailers = $message | git interpret-trailers --parse
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Could not read suspend compatibility trailers' }
|
||||
$approval = @{}
|
||||
foreach ($line in $trailers) {
|
||||
if ($line -match '^(Suspend-Compatible-With|Suspend-Verified-Inputs|Suspend-Verification):\s+(.+)$') {
|
||||
if ($approval.ContainsKey($Matches[1])) { throw "Repeated compatibility trailer: $($Matches[1])" }
|
||||
$approval[$Matches[1]] = $Matches[2].Trim()
|
||||
}
|
||||
}
|
||||
|
||||
if ($approval.Count) {
|
||||
$previous = $published | Where-Object Tag -eq $approval['Suspend-Compatible-With']
|
||||
$evidence = $approval['Suspend-Verification']
|
||||
if (!$previous -or !$previous.Packaging -or $previous.VerifiedFamily -ne $previous.Family -or
|
||||
$approval['Suspend-Verified-Inputs'] -ne $otherInput -or $evidence -notmatch '^https://[^\s<>]+$') {
|
||||
Write-Warning 'Compatibility evidence does not match these inputs and a published compatibility baseline.'
|
||||
} else {
|
||||
$latest = $published | Sort-Object PublishedAt, Revision -Descending | Select-Object -First 1
|
||||
$familyTip = $published | Where-Object Family -eq $previous.Family | Sort-Object Revision -Descending | Select-Object -First 1
|
||||
& git -C $RuntimeRepo merge-base --is-ancestor $previous.RuntimeCommit $RuntimeCommit
|
||||
if ($LASTEXITCODE -gt 1) { throw 'Could not verify the runtime baseline ancestry' }
|
||||
$ancestor = $LASTEXITCODE -eq 0
|
||||
|
||||
# Direct changes to these inputs require a fresh family even with a trailer.
|
||||
$runtimePaths = @(
|
||||
'vendor/qemu', 'guest', 'firmware', ':(glob)crates/reims-vgpu*/**',
|
||||
'.cargo', 'Cargo.toml', 'Cargo.lock', 'rust-toolchain.toml', 'reims-go-runtime.json',
|
||||
'scripts/install-ctl.sh', 'scripts/install.ps1',
|
||||
'crates/reims-ctl/Cargo.toml', 'crates/reims-ctl/Cargo.lock',
|
||||
'crates/reims-ctl/src/qemu.rs', 'crates/reims-ctl/src/runtime.rs',
|
||||
'crates/reims-ctl/src/main.rs', 'crates/reims-ctl/src/cli.rs', 'crates/reims-ctl/src/vm.rs',
|
||||
'crates/reims-ctl/src/opencore.rs', 'crates/reims-ctl/src/reims_util.rs',
|
||||
'crates/reims-ctl/src/host.rs', 'crates/reims-ctl/src/os'
|
||||
)
|
||||
$packagingPaths = @(
|
||||
':(glob)packaging/windows-runtime/patches/*.patch',
|
||||
'packaging/windows-runtime/patches/series.txt',
|
||||
'packaging/windows-runtime/scripts/apply-patch-series.ps1'
|
||||
)
|
||||
if ($ancestor -and $previous.Tag -eq $latest.Tag -and $previous.Tag -eq $familyTip.Tag) {
|
||||
& git -C $PackagingRepo cat-file -e "$($previous.Packaging)^{commit}" 2>$null
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Invoke-VersionCommand git @('-C', $PackagingRepo, 'fetch', '-q', '--no-tags', 'origin', $previous.Packaging)
|
||||
}
|
||||
$runtimeChange = Test-InputsChanged $RuntimeRepo $previous.RuntimeCommit $RuntimeCommit $runtimePaths
|
||||
$packagingChange = Test-InputsChanged $PackagingRepo $previous.Packaging $PackagingCommit $packagingPaths
|
||||
if (!$runtimeChange -and !$packagingChange) {
|
||||
$id = "$($previous.Family)-p$($familyTip.Revision + 1)"
|
||||
if ($remoteTags.ContainsKey("runtime-$id")) { throw "Runtime tag runtime-$id is already reserved" }
|
||||
return New-VersionPlan $id $previous.Family $evidence $previous.Tag
|
||||
}
|
||||
Write-Warning 'Suspend inputs changed. A new runtime family is required.'
|
||||
} else {
|
||||
Write-Warning 'The verification must cover the latest published runtime and its highest family revision.'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$base = (Invoke-VersionCommand git @('-C', $RuntimeRepo, 'rev-parse', '--short=7', $RuntimeCommit)).Trim()
|
||||
if ($sameRuntime.Count -or $remoteTags.ContainsKey("runtime-$base")) {
|
||||
throw 'A new runtime baseline commit is required, or record verified compatibility for these exact build inputs.'
|
||||
}
|
||||
return New-VersionPlan $base $base
|
||||
@@ -0,0 +1,117 @@
|
||||
[CmdletBinding()]
|
||||
param([Parameter(Mandatory)][string]$TempRoot)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$root = (Resolve-Path -LiteralPath $TempRoot).Path
|
||||
$fixture = Join-Path $root ("alpha-version-test-" + [guid]::NewGuid())
|
||||
$planner = Join-Path $PSScriptRoot 'plan-runtime-release.ps1'
|
||||
$source = Join-Path $fixture 'runtime'
|
||||
$packaging = Join-Path $fixture 'packaging'
|
||||
$fixtureReleases = [System.Collections.Generic.List[hashtable]]::new()
|
||||
$testRepo = 'test/runtime'
|
||||
|
||||
function gh {
|
||||
$global:LASTEXITCODE = 0
|
||||
'[' + (ConvertTo-Json -InputObject $fixtureReleases.ToArray() -Depth 5 -Compress) + ']'
|
||||
}
|
||||
|
||||
function Test-Git([string]$repo, [string[]]$argv) {
|
||||
$result = & git -C $repo @argv
|
||||
if ($LASTEXITCODE) { throw "git $($argv -join ' ') failed in fixture" }
|
||||
return $result
|
||||
}
|
||||
|
||||
function Write-Commit([string]$repo, [string]$path, [string]$content, [string]$message = 'Fixture update') {
|
||||
$file = Join-Path $repo $path
|
||||
New-Item -ItemType Directory -Force -Path (Split-Path -Parent $file) | Out-Null
|
||||
Set-Content -LiteralPath $file -Encoding utf8NoBOM -Value $content
|
||||
Test-Git $repo @('add', '--', $path) | Out-Null
|
||||
Test-Git $repo @('commit', '-q', '-m', $message) | Out-Null
|
||||
return Test-Git $repo @('rev-parse', 'HEAD')
|
||||
}
|
||||
|
||||
function Add-Published([string]$id, [string]$commit, [string]$pack, [string]$family) {
|
||||
$tag = "runtime-$id"
|
||||
Test-Git $source @('tag', $tag, $commit) | Out-Null
|
||||
$fixtureReleases.Add(@{
|
||||
tag_name = $tag
|
||||
draft = $false
|
||||
published_at = [DateTimeOffset]::UnixEpoch.AddMinutes($fixtureReleases.Count).ToString('o')
|
||||
body = "Packaging commit: ``$pack```nSuspend compatibility ID: ``$family``"
|
||||
})
|
||||
}
|
||||
|
||||
function Approval([string]$predecessor, [string]$other) {
|
||||
return "Fixture verified`n`nSuspend-Compatible-With: $predecessor`nSuspend-Verified-Inputs: $other`nSuspend-Verification: https://example.invalid/runtime-test"
|
||||
}
|
||||
|
||||
function Plan([string]$commit, [string]$pack, [switch]$PackagingPush) {
|
||||
& $planner -RuntimeRepo $source -RuntimeCommit $commit -PackagingRepo $packaging -PackagingCommit $pack `
|
||||
-Repository $testRepo -Rebuild:$PackagingPush -PackagingPush:$PackagingPush
|
||||
}
|
||||
|
||||
function Assert-Version($plan, [string]$id, [string]$family) {
|
||||
if ($plan.Skip -or $plan.ReleaseId -ne $id -or $plan.SuspendCompatID -ne $family) {
|
||||
throw "Expected $id in family $family, got $($plan | ConvertTo-Json -Compress)"
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
foreach ($repo in $source, $packaging) {
|
||||
New-Item -ItemType Directory -Path $repo -Force | Out-Null
|
||||
Test-Git $repo @('init', '-q') | Out-Null
|
||||
Test-Git $repo @('config', 'user.name', 'Version Fixture') | Out-Null
|
||||
Test-Git $repo @('config', 'user.email', 'fixture@example.invalid') | Out-Null
|
||||
}
|
||||
Test-Git $source @('remote', 'add', 'origin', $source) | Out-Null
|
||||
$old = Write-Commit $source 'crates/reims-ctl/src/qemu.rs' 'original state path'
|
||||
$pack = Write-Commit $packaging 'packaging/windows-runtime/patches/series.txt' 'original patch queue'
|
||||
$base = Test-Git $source @('rev-parse', '--short=7', $old)
|
||||
Assert-Version (Plan $old $pack) $base $base
|
||||
Add-Published $base $old $pack $base
|
||||
if (!(Plan $old $pack).Skip -or !(Plan $old $pack -PackagingPush).Skip) {
|
||||
throw 'Already published build was not skipped'
|
||||
}
|
||||
|
||||
$compatiblePack = Write-Commit $packaging 'packaging/windows-runtime/notice.txt' 'packaging adjustment' (Approval "runtime-$base" $old)
|
||||
Assert-Version (Plan $old $compatiblePack -PackagingPush) "$base-p1" $base
|
||||
$breakingPack = Write-Commit $packaging 'packaging/windows-runtime/patches/series.txt' 'changed snapshot patch queue' (Approval "runtime-$base" $old)
|
||||
try {
|
||||
$null = Plan $old $breakingPack -PackagingPush
|
||||
throw 'Incompatible packaging change reused the old runtime commit'
|
||||
} catch {
|
||||
if ($_ -notmatch 'A new runtime baseline commit is required') { throw }
|
||||
}
|
||||
|
||||
$compatible = Write-Commit $source 'docs/build.md' 'safe runtime change' (Approval "runtime-$base" $pack)
|
||||
Assert-Version (Plan $compatible $pack) "$base-p1" $base
|
||||
Add-Published "$base-p1" $compatible $pack $base
|
||||
if (!(Plan $compatible $pack).Skip) {
|
||||
throw 'A published revision with a different source prefix rebuilt'
|
||||
}
|
||||
|
||||
$next = Write-Commit $source 'docs/build.md' 'another verified change' (Approval "runtime-$base-p1" $pack)
|
||||
Assert-Version (Plan $next $pack) "$base-p2" $base
|
||||
|
||||
$breaking = Write-Commit $source 'crates/reims-ctl/src/qemu.rs' 'different state path' (Approval "runtime-$base-p1" $pack)
|
||||
$breakingBase = Test-Git $source @('rev-parse', '--short=7', $breaking)
|
||||
Assert-Version (Plan $breaking $pack) $breakingBase $breakingBase
|
||||
Add-Published $breakingBase $breaking $pack $breakingBase
|
||||
|
||||
$reverted = Write-Commit $source 'crates/reims-ctl/src/qemu.rs' 'original state path' (Approval "runtime-$base-p1" $pack)
|
||||
$revertedBase = Test-Git $source @('rev-parse', '--short=7', $reverted)
|
||||
Assert-Version (Plan $reverted $pack) $revertedBase $revertedBase
|
||||
|
||||
$unverified = Write-Commit $source 'docs/build.md' 'unverified change'
|
||||
$unverifiedBase = Test-Git $source @('rev-parse', '--short=7', $unverified)
|
||||
Assert-Version (Plan $unverified $pack) $unverifiedBase $unverifiedBase
|
||||
Write-Host 'PASS Alpha family selection, exact-source deduplication, and suspend input guards'
|
||||
} finally {
|
||||
if (Test-Path -LiteralPath $fixture) {
|
||||
$resolved = (Resolve-Path -LiteralPath $fixture).Path
|
||||
if ($resolved -ne $fixture -or (Split-Path -Parent $resolved) -ne $root) {
|
||||
throw "Unexpected test fixture path: $resolved"
|
||||
}
|
||||
Remove-Item -LiteralPath $resolved -Recurse -Force
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,8 @@
|
||||
|
||||
客户端将发布标识用于下载、安装和定位归档。跨修订恢复使用清单中明确声明的挂起兼容标识,并在保存挂起时将该标识写入记录。获得同一兼容标识的发布必须符合本规范的同主编号规则。客户端仍要验证挂起记录的格式、虚拟硬件配置、附加介质和状态文件完整性。
|
||||
|
||||
清单和挂起记录使用 `suspend_compat_id` 保存挂起兼容标识,其值为发布编号中 `-pN` 前的主编号。打包提交记录在清单的 `packaging_commit` 中。
|
||||
|
||||
不兼容的挂起文件应在启动 QEMU 加载前被拦截。客户端保留原挂起状态,并提示用户选择原运行时重新恢复,或在用户明确放弃挂起后冷启动。
|
||||
|
||||
现有 Reims-Go 校验会比较 `vendor_qemu_commit` 和完整的运行时编号。即使 QEMU 提交相同,`a1b2c3d` 与 `a1b2c3d-p1` 的完整编号也会触发拒绝。客户端支持明确的兼容标识后,Alpha 才可向使用该客户端的用户承诺跨 `-pN` 恢复。缺少兼容标识的旧记录继续使用原有校验。若要承诺旧记录可以升级恢复,必须另行验证并明确列出可接受的旧运行时和 QEMU 提交组合。 [现有运行时校验](https://github.com/Nwflower/Reims-Go/blob/08b3089569b2f3a705e06fbe6d37846c7faf7d47/internal/macos/reims/suspend.go#L159-L189) · [挂起文件及介质校验](https://github.com/Nwflower/Reims-Go/blob/08b3089569b2f3a705e06fbe6d37846c7faf7d47/internal/macos/reims/suspend_transaction.go#L139-L184)
|
||||
@@ -38,3 +40,15 @@
|
||||
2. **沿用主编号。** 在虚拟机副本上,用旧包正常运行并挂起,再切到新版恢复。核对桌面和原应用状态、磁盘可写性及受影响的设备。验证上一修订和本系列最早承诺可升级的版本,并覆盖这次受影响的宿主或后端。
|
||||
3. **更换主编号。** 用上一主编号的挂起记录确认新版在加载前拦截,并验证新版能冷启动及完成自己的挂起与恢复。保留测试证据和可用于恢复旧状态的原运行时。
|
||||
4. **确认发布。** 核对编号与运行时清单、校验和、源码附件和 Release 说明。Alpha 经 CI 构建和检查后以预发布交付,正式版由人工确认和发布。 [Alpha 构建流程](../../.github/workflows/runtime-preview.yml)
|
||||
|
||||
## 自动编号的验证记录
|
||||
|
||||
沿用主编号前,在触发构建的提交末尾记录已验证的上一修订、另一侧的完整提交和验收记录链接。运行时分支提交记录打包提交,打包变更和手动重建由打包提交记录运行时提交。
|
||||
|
||||
```text
|
||||
Suspend-Compatible-With: runtime-a1b2c3d-p2
|
||||
Suspend-Verified-Inputs: 0123456789abcdef0123456789abcdef01234567
|
||||
Suspend-Verification: https://example.com/runtime-resume-check
|
||||
```
|
||||
|
||||
CI 使用最新已发布且声明兼容标识的运行时作为验证基线,该版本还必须是所属主编号下的最高修订。运行时和打包输入必须与该次验证对应。QEMU 指针、挂起相关源码或依赖补丁变化会要求新主编号。没有满足这些条件的验证记录时,CI 按新主编号处理。若运行时提交已发布且本次只是更换打包输入,先提交新的运行时基线,再发布。
|
||||
Reference in new issue
Block a user