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
+40 -4
View File
@@ -81,15 +81,51 @@ jobs:
echo "--- Cargo.toml [package] ---"
awk '/^\[package\]/{f=1} f; /^\[/&&!/^\[package\]/{f=0}' Cargo.toml | head -10
- name: Install flutter_rust_bridge codegen tools
shell: bash
- name: Ensure Rust toolchain configured for runner user
shell: pwsh
run: |
cargo install cargo-expand --version "${CARGO_EXPAND_VERSION}" --locked || true
cargo install flutter_rust_bridge_codegen --version "${FLUTTER_RUST_BRIDGE_VERSION}" --features uuid --locked || true
# provision.ps1 ran rustup as an admin user; act_runner runs as LocalSystem
# which has its own (empty) $RUSTUP_HOME. Bootstrap the default toolchain
# for LocalSystem on first run -- subsequent runs are no-ops.
rustup --version
rustup toolchain install $env:RUST_VERSION --profile minimal --component rustfmt
if ($LASTEXITCODE -ne 0) { throw "rustup toolchain install failed ($LASTEXITCODE)" }
rustup default $env:RUST_VERSION
if ($LASTEXITCODE -ne 0) { throw "rustup default failed ($LASTEXITCODE)" }
rustup target add x86_64-pc-windows-msvc
rustc --version
cargo --version
- name: Install flutter_rust_bridge codegen tools
shell: pwsh
run: |
# Pin the install destination with --root so we don't have to guess at
# the runner's $USERPROFILE (act_runner runs as LocalSystem on this host,
# which makes $USERPROFILE a non-obvious system path).
$tools = 'C:\cargo-tools'
New-Item -ItemType Directory -Force -Path "$tools\bin" | Out-Null
cargo install --root $tools cargo-expand --version "$env:CARGO_EXPAND_VERSION" --locked
if ($LASTEXITCODE -ne 0) { throw "cargo install cargo-expand failed ($LASTEXITCODE)" }
cargo install --root $tools flutter_rust_bridge_codegen --version "$env:FLUTTER_RUST_BRIDGE_VERSION" --features uuid --locked
if ($LASTEXITCODE -ne 0) { throw "cargo install flutter_rust_bridge_codegen failed ($LASTEXITCODE)" }
Write-Host "--- $tools\bin ---"
Get-ChildItem "$tools\bin" | Format-Table Name, Length, LastWriteTime
$expected = Join-Path $tools 'bin\flutter_rust_bridge_codegen.exe'
if (-not (Test-Path $expected)) { throw "missing: $expected" }
Add-Content -Path $env:GITHUB_PATH -Value "$tools\bin"
- name: Generate Rust <-> Dart bridge
shell: bash
run: |
# Belt-and-suspenders: also prepend cargo-tools to PATH here, in case
# GITHUB_PATH propagation from the previous step doesn't take effect.
export PATH="/c/cargo-tools/bin:$PATH"
command -v flutter_rust_bridge_codegen || { echo "tool not on PATH; PATH=$PATH"; exit 1; }
pushd flutter && flutter pub get && popd
flutter_rust_bridge_codegen \
--rust-input ./src/flutter_ffi.rs \