feat(patches): add reims-vgpu/metal2vulkan snapshot replay and build pipeline support

This commit is contained in:
YXC0915 committed 2026-12-01 07:48:14 +08:00
1 parent 585669e0b3
commit 347840490e
8 files changed
+4972 -70

No files matched your search

+27 -2
View File
@@ -142,6 +142,21 @@ jobs:
if ($LASTEXITCODE) { throw 'reims-util fetch failed' }
git -C $utilRepo checkout -q --detach FETCH_HEAD
if ($LASTEXITCODE) { throw 'reims-util checkout failed' }
$m2vRepo = Join-Path $env:RUNNER_TEMP 'metal2vulkan'
$cargoToml = Get-Content -Raw -LiteralPath (Join-Path $work 'Cargo.toml')
if ($cargoToml -match 'metal2vulkan\s*=\s*\{[^}]*rev\s*=\s*"([0-9a-f]{40})"') {
$m2vRev = $Matches[1]
} else {
$lockTxt = Get-Content -Raw -LiteralPath (Join-Path $work 'Cargo.lock')
if ($lockTxt -notmatch 'metal2vulkan\?rev=([0-9a-f]{40})') { throw 'metal2vulkan rev not found in Cargo.toml or Cargo.lock' }
$m2vRev = $Matches[1]
}
git init -q $m2vRepo
if ($LASTEXITCODE) { throw 'metal2vulkan init failed' }
git -C $m2vRepo fetch -q --depth 1 https://github.com/steelbrain/metal2vulkan.git $m2vRev
if ($LASTEXITCODE) { throw 'metal2vulkan fetch failed' }
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${{ needs.resolve.outputs.suffix }}"
"short=$short" >> $env:GITHUB_OUTPUT
@@ -151,7 +166,7 @@ jobs:
# conflict without touching the patch (AGENTS.md rule 4).
$resultFile = Join-Path $env:RUNNER_TEMP 'patches.json'
try {
pwsh -NoProfile -File scripts/apply-patch-series.ps1 -ReimsRepo $work -UtilRepo $utilRepo -ResultFile $resultFile
pwsh -NoProfile -File scripts/apply-patch-series.ps1 -ReimsRepo $work -UtilRepo $utilRepo -Metal2VulkanRepo $m2vRepo -ResultFile $resultFile
$ok = $LASTEXITCODE -eq 0
} finally {
if (Test-Path $resultFile) {
@@ -163,11 +178,20 @@ jobs:
}
}
if (-not $ok) { throw 'patch queue does not apply' }
$cargoHome = Join-Path $env:RUNNER_TEMP 'cargo'
$m2vFwd = $m2vRepo.Replace('\', '/')
$cargoCfg = @"
[patch."https://github.com/steelbrain/metal2vulkan"]
metal2vulkan = { path = "$m2vFwd/crates/metal2vulkan" }
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=$(Join-Path $env:RUNNER_TEMP 'cargo')" >> $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
@@ -200,6 +224,7 @@ jobs:
& ./scripts/pack-runtime.ps1 `
-ReimsRepo $env:UPSTREAM_DIR `
-UtilRepo $env:REIMS_UTIL_DIR `
-Metal2VulkanRepo $env:METAL2VULKAN_DIR `
-CargoHome $env:CARGO_HOME `
-QemuDir (Join-Path $env:XDG_DATA_HOME 'reims-ctl\qemu\current') `
-Msys2 '${{ steps.msys2.outputs.msys2-location }}' `