vm gitea runner

Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-10-29 21:28:40 +03:00
1 parent 6908d4a695
commit 620ae1577d
10 files changed
+102 -39

No files matched your search

@@ -37,8 +37,8 @@ brew update
brew install gcc cmake ninja rustup-init vulkan-headers vulkan-loader vulkan-tools molten-vk node git git-lfs
rustup-init -y --default-toolchain stable --no-modify-path
export PATH="$HOME/.cargo/bin:$(brew --prefix)/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
"$HOME/.cargo/bin/rustup" toolchain install stable
"$HOME/.cargo/bin/rustup" default stable
"$HOME/.cargo/bin/rustup" toolchain install nightly
"$HOME/.cargo/bin/rustup" default nightly
GXX="$(brew --prefix gcc)/bin/g++-16"
if [[ ! -x "$GXX" ]]; then
@@ -11,13 +11,29 @@ function Invoke-Installer([string]$File, [string]$Arguments, [int[]]$SuccessCode
}
function Download([string]$Url, [string]$Path) {
Invoke-WebRequest -UseBasicParsing -Uri $Url -OutFile $Path
# Always log the exact request: a thrown Invoke-WebRequest otherwise hides
# which vendor URL returned the HTTP error in the OEM transcript.
Write-Host "Downloading [$Url] to [$Path]"
try {
Invoke-WebRequest -UseBasicParsing -Uri $Url -OutFile $Path -TimeoutSec 600 -MaximumRedirection 10
if (-not (Test-Path $Path) -or (Get-Item -LiteralPath $Path).Length -le 0) {
throw 'The server returned no file data.'
}
} catch {
$status = 'unknown'
if ($_.Exception.Response) {
try { $status = [string]$_.Exception.Response.StatusCode } catch { }
}
Remove-Item -LiteralPath $Path -Force -ErrorAction SilentlyContinue
throw "Download failed from [$Url] (HTTP $status): $($_.Exception.Message)"
}
}
try {
New-Item -ItemType Directory -Force -Path 'C:\ci-tools', 'C:\ci-tools\downloads', 'C:\ci-tools\cargo', 'C:\ci-tools\rustup', 'C:\ci\gitea-runner' | Out-Null
# Node is needed by JavaScript-based Gitea Actions. Pin to the current Node 24 LTS line.
Write-Host 'Resolving the latest Node.js 24 LTS release from https://nodejs.org/dist/index.json.'
$nodeRelease = Invoke-RestMethod -Uri 'https://nodejs.org/dist/index.json' |
Where-Object { $_.version -match '^v24\.' -and $_.lts } |
Select-Object -First 1
@@ -26,9 +42,18 @@ try {
Download "https://nodejs.org/dist/$($nodeRelease.version)/node-$($nodeRelease.version)-x64.msi" $nodeMsi
Invoke-Installer "$env:SystemRoot\System32\msiexec.exe" "/i `"$nodeMsi`" /qn /norestart" @(0, 3010)
# Git's official installer; jobs execute as SYSTEM in this isolated guest.
$gitInstaller = 'C:\ci-tools\downloads\Git-64-bit.exe'
Download 'https://github.com/git-for-windows/git/releases/latest/download/Git-64-bit.exe' $gitInstaller
# The release asset's filename includes its version; GitHub does not
# provide a generic Git-64-bit.exe alias. Resolve the asset from the API.
Write-Host 'Resolving the latest Git for Windows x64 installer from GitHub Releases.'
$gitRelease = Invoke-RestMethod -UseBasicParsing `
-Uri 'https://api.github.com/repos/git-for-windows/git/releases/latest' `
-Headers @{ 'User-Agent' = 'gitea-vm-runner-provisioner'; 'Accept' = 'application/vnd.github+json' }
$gitAsset = $gitRelease.assets |
Where-Object { $_.name -match '^Git-[0-9.]+-64-bit\.exe$' } |
Select-Object -First 1
if (-not $gitAsset) { throw 'GitHub latest release did not contain a versioned x64 Git installer.' }
$gitInstaller = "C:\ci-tools\downloads\$($gitAsset.name)"
Download $gitAsset.browser_download_url $gitInstaller
Invoke-Installer $gitInstaller '/VERYSILENT /NORESTART /SP- /DIR="C:\Program Files\Git"' @(0, 3010)
# MSVC compatibility lane plus the MSYS2 UCRT64 GCC lane for C++26 reflection/contracts.
@@ -61,7 +86,7 @@ try {
$env:RUSTUP_HOME = 'C:\ci-tools\rustup'
$rustup = 'C:\ci-tools\downloads\rustup-init.exe'
Download 'https://win.rustup.rs/x86_64' $rustup
Invoke-Installer $rustup '-y --default-toolchain stable --no-modify-path' @(0)
Invoke-Installer $rustup '-y --default-toolchain nightly --no-modify-path' @(0)
# Ensure the native toolchain paths are available to jobs launched by Task Scheduler.
$machinePath = [Environment]::GetEnvironmentVariable('Path', 'Machine')