Files
Reims-Go/.github/workflows/build-runtime.yml
T

123 lines
5.2 KiB
YAML

name: Build Portable Runtime (Candidate)
on:
workflow_dispatch:
inputs:
upstream_commit:
description: "Pinned steelbrain/reims-vgpu commit SHA"
required: true
default: "3731afd"
publish_candidate:
description: "Publish as GitHub prerelease (candidate channel only; never stable)"
type: boolean
default: false
permissions:
contents: write
jobs:
build-runtime:
runs-on: windows-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
- name: Setup MSYS2 CLANG64
id: msys2
uses: msys2/setup-msys2@v2
with:
msystem: CLANG64
update: true
install: >-
git zstd tar mingw-w64-clang-x86_64-toolchain
mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-meson
mingw-w64-clang-x86_64-ninja mingw-w64-clang-x86_64-pkgconf
mingw-w64-clang-x86_64-glib2 mingw-w64-clang-x86_64-pixman
mingw-w64-clang-x86_64-gtk3 mingw-w64-clang-x86_64-libslirp
mingw-w64-clang-x86_64-libusb mingw-w64-clang-x86_64-libva
mingw-w64-clang-x86_64-mesa mingw-w64-clang-x86_64-vulkan-loader
mingw-w64-clang-x86_64-python mingw-w64-clang-x86_64-python-pip
- name: Checkout upstream reims-vgpu & verify patch queue
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$work = Join-Path $env:RUNNER_TEMP 'reims-vgpu'
$cargoHome = Join-Path $env:RUNNER_TEMP 'cargo'
$xdgData = Join-Path $env:RUNNER_TEMP 'xdg-data'
$xdgCache = Join-Path $env:RUNNER_TEMP 'xdg-cache'
New-Item -ItemType Directory -Force -Path $cargoHome, $xdgData, $xdgCache | Out-Null
git clone https://github.com/steelbrain/reims-vgpu.git $work
git -C $work checkout ${{ inputs.upstream_commit }}
# Verify local patches apply cleanly; fail hard on mismatch (AGENTS.md rule 4).
if (Test-Path 'patches/reims-vgpu-cargo-lock.patch') {
git -C $work apply --check (Resolve-Path 'patches/reims-vgpu-cargo-lock.patch')
git -C $work apply (Resolve-Path 'patches/reims-vgpu-cargo-lock.patch')
}
$short = (git -C $work rev-parse --short HEAD).Trim()
"UPSTREAM_DIR=$work" | Out-File -FilePath $env:GITHUB_ENV -Append
"SHORT_COMMIT=$short" | Out-File -FilePath $env:GITHUB_ENV -Append
"CARGO_HOME=$cargoHome" | Out-File -FilePath $env:GITHUB_ENV -Append
"XDG_DATA_HOME=$xdgData" | Out-File -FilePath $env:GITHUB_ENV -Append
"XDG_CACHE_HOME=$xdgCache" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Build upstream runtime in MSYS2 CLANG64
shell: msys2 {0}
env:
REIMS_INSTALL_SKIP_HOST_CHECKS: "1"
run: |
set -euo pipefail
UPSTREAM_UNIX="$(cygpath -u "$UPSTREAM_DIR")"
WS_UNIX="$(cygpath -u "$GITHUB_WORKSPACE")"
cd "$UPSTREAM_UNIX"
# Fetch vendor/qemu at the pinned commit before applying patches.
git submodule update --init --depth 1 vendor/qemu || git submodule update --init vendor/qemu
for p in \
"$WS_UNIX/patches/qemu-whpx-win10-compat.patch" \
"$WS_UNIX/patches/qemu-whpx-win10-startup-ipis.patch" \
"$WS_UNIX/patches/qemu-whpx-nested-virt-nonfatal.patch" \
"$WS_UNIX/patches/qemu-win32-coroutine-fiber-commit.patch"; do
[ -f "$p" ] || continue
git -C vendor/qemu apply --check "$p"
git -C vendor/qemu apply "$p"
done
# Run upstream's own non-interactive CLANG64 build script.
bash scripts/install-ctl.sh --yes
- name: Package candidate runtime & source archives
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$outDir = Join-Path $env:RUNNER_TEMP 'releases'
$qemuDir = Join-Path $env:XDG_DATA_HOME 'reims-ctl\qemu\current'
$msys2Root = '${{ steps.msys2.outputs.msys2-location }}'
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
pwsh -File scripts/pack-runtime.ps1 `
-ReimsRepo $env:UPSTREAM_DIR `
-CargoHome $env:CARGO_HOME `
-QemuDir $qemuDir `
-Msys2 $msys2Root `
-OutDir $outDir `
-TempRoot $env:RUNNER_TEMP `
-Channel candidate `
-IncludeNestedVirtPatch `
-IncludeWin32FiberPatch
- name: Upload candidate artifacts
uses: actions/upload-artifact@v4
with:
name: reims-runtime-win-x64-${{ env.SHORT_COMMIT }}-candidate
path: ${{ runner.temp }}/releases/*
- name: Publish candidate prerelease (never stable)
if: ${{ inputs.publish_candidate }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: pwsh
run: |
$tag = "runtime-$($env:SHORT_COMMIT)"
gh release create $tag "$($env:RUNNER_TEMP)/releases/*" `
--prerelease `
--title "Portable Runtime $tag (candidate)" `
--notes "Automated candidate build from upstream $($env:SHORT_COMMIT). Must pass scripts/smoke-runtime.ps1 on a real Windows host and human review before promotion to stable."