ci(windows): bootstrap rust toolchain for runner user; install rust machine-wide in future provisions
build-windows / build-windows-x64 (push) Failing after 1h9m50s

This commit is contained in:
2026-05-04 19:41:36 +02:00
parent 919966a9a7
commit 571798c953
2 changed files with 54 additions and 7 deletions
+14 -3
View File
@@ -54,6 +54,7 @@ choco install -y --no-progress `
git python311 nuget.commandline 7zip cmake ninja `
nodejs-lts powershell-core dotnet-sdk
Add-MachinePath 'C:\Program Files\Git\cmd'
Add-MachinePath 'C:\Program Files\Git\bin' # bash.exe + posix tools (sed, find, etc.)
Add-MachinePath 'C:\Python311'
Add-MachinePath 'C:\Python311\Scripts'
Add-MachinePath 'C:\Program Files\nodejs'
@@ -81,11 +82,21 @@ if (-not $vsPresent) {
}
# --- 3. Rust (stable 1.75 + nightly-2023-10-13 with i686 target) ---
if (-not (Get-Command rustup -ErrorAction SilentlyContinue)) {
Write-Host '==> Installing rustup'
# Install machine-wide so the act_runner service (LocalSystem) and any admin user
# share the same toolchain registry. Without this, rustup state lives in the
# installing user's profile and LocalSystem ends up with no default toolchain.
$rustupHome = 'C:\rustup'
$cargoHome = 'C:\cargo'
[Environment]::SetEnvironmentVariable('RUSTUP_HOME', $rustupHome, 'Machine')
[Environment]::SetEnvironmentVariable('CARGO_HOME', $cargoHome, 'Machine')
$env:RUSTUP_HOME = $rustupHome
$env:CARGO_HOME = $cargoHome
Add-MachinePath "$cargoHome\bin"
if (-not (Test-Path "$cargoHome\bin\rustup.exe")) {
Write-Host '==> Installing rustup (machine-wide at C:\rustup, C:\cargo)'
Invoke-WebRequest -Uri 'https://win.rustup.rs/x86_64' -OutFile "$env:TEMP\rustup-init.exe"
& "$env:TEMP\rustup-init.exe" -y --default-toolchain none --profile minimal
Add-MachinePath "$env:USERPROFILE\.cargo\bin"
}
rustup toolchain install $RUST_VERSION --profile minimal --component rustfmt
rustup target add --toolchain $RUST_VERSION x86_64-pc-windows-msvc