Skip to content

Commit 1f8a530

Browse files
committed
CI: stop forcing Git for Windows on PATH; add plain-Windows smoke test
Three changes, intended as a research signal rather than a finished re-engineering of the Windows test matrix. windows-wsl2 and windows-qemu: drop the _LIMA_WINDOWS_EXTRA_PATH setting (and the corresponding entry in MSYS2_ENV_CONV_EXCL). After the prior commits in this branch, limactl no longer needs anything from C:\Program Files\Git\usr\bin for its core flow on Windows. The test scripts (hack/test-templates.sh) still run under MSYS2 bash and still rely on cygpath / awk / netcat from C:\msys64\usr\bin, so that PATH entry stays. Expected: existing tests pass unchanged, since the removed entry was strictly additive for limactl. windows-plain: new job that builds with `go build` and runs a minimal PowerShell smoke test (create / start / shell / copy / stop / delete) with PATH scrubbed of MSYS2 and Git for Windows. The PATH scrub is deliberately aggressive: if any new step starts requiring something from those toolchains, this job will fail and we will know about it. Verified locally on a Windows 11 host with only native OpenSSH; running on the GitHub Windows runner is the actual signal. Behaviour changes intended to break loudly, not silently. If the new job fails, the failure mode itself is the data we want. Signed-off-by: Jan Dubois <jan.dubois@suse.com>
1 parent 8e56f7e commit 1f8a530

1 file changed

Lines changed: 85 additions & 4 deletions

File tree

.github/workflows/test.yml

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,10 @@ jobs:
218218
run: |
219219
$env:PATH = "$pwd\_output\bin;" + 'C:\msys64\usr\bin;' + $env:PATH
220220
pacman -Sy --noconfirm openbsd-netcat diffutils socat w3m
221-
$env:MSYS2_ENV_CONV_EXCL = 'HOME_HOST;HOME_GUEST;_LIMA_WINDOWS_EXTRA_PATH'
221+
$env:MSYS2_ENV_CONV_EXCL = 'HOME_HOST;HOME_GUEST'
222222
$env:HOME_HOST = $(cygpath.exe "$env:USERPROFILE")
223223
$env:HOME_GUEST = "/mnt$env:HOME_HOST"
224224
$env:LIMACTL_CREATE_ARGS = '--vm-type=wsl2 --mount-type=wsl2 --containerd=system'
225-
$env:_LIMA_WINDOWS_EXTRA_PATH = 'C:\Program Files\Git\usr\bin'
226225
bash.exe -c "./hack/test-templates.sh templates/experimental/wsl2.yaml"
227226
228227
windows-qemu:
@@ -253,13 +252,95 @@ jobs:
253252
run: |
254253
$env:PATH = "$pwd\_output\bin;" + 'C:\msys64\usr\bin;' + 'C:\Program Files\QEMU;' + $env:PATH
255254
pacman -Sy --noconfirm openbsd-netcat diffutils socat w3m
256-
$env:MSYS2_ENV_CONV_EXCL = 'HOME_HOST;HOME_GUEST;_LIMA_WINDOWS_EXTRA_PATH'
255+
$env:MSYS2_ENV_CONV_EXCL = 'HOME_HOST;HOME_GUEST'
257256
$env:HOME_HOST = $(cygpath.exe "$env:USERPROFILE")
258257
$env:HOME_GUEST = "$env:HOME_HOST"
259258
$env:LIMACTL_CREATE_ARGS = '--vm-type=qemu'
260-
$env:_LIMA_WINDOWS_EXTRA_PATH = 'C:\Program Files\Git\usr\bin'
261259
bash.exe -c "./hack/test-templates.sh templates/default.yaml"
262260
261+
windows-plain:
262+
# Smoke test that Lima works on a Windows host with only the bits that
263+
# ship in a default Windows 10/11 install (native OpenSSH, wsl.exe, tar).
264+
# Notably: no Git for Windows, no MSYS2, no cygpath, no Cygwin/MSYS2 ssh.
265+
# Builds with `go build` (instead of `make`) and exercises the main
266+
# commands in PowerShell. If this job ever needs to add MSYS2 / Git for
267+
# Windows back to make a step pass, that means a new external-binary
268+
# dependency was introduced and should be evaluated.
269+
name: "Windows tests (plain, no MSYS2 / Git for Windows)"
270+
runs-on: windows-2025
271+
timeout-minutes: 30
272+
steps:
273+
- name: Enable WSL2
274+
run: |
275+
wsl --set-default-version 2
276+
wsl --shutdown
277+
wsl --update
278+
wsl --status
279+
- name: Install WSL2 distro
280+
timeout-minutes: 1
281+
run: |
282+
# See the windows-wsl2 job for why this dummy distro exists.
283+
mkdir dummy
284+
mkdir dummy\bin
285+
mkdir dummy\etc
286+
echo "" >dummy\bin\sh
287+
tar -cf dummy.tar --format ustar -C dummy .
288+
wsl --import dummy $env:TEMP dummy.tar
289+
wsl --list --verbose
290+
- name: Set gitconfig
291+
run: |
292+
git config --global core.autocrlf false
293+
git config --global core.eol lf
294+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
295+
with:
296+
persist-credentials: false
297+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
298+
with:
299+
go-version: stable
300+
cache: false
301+
- name: Build limactl
302+
# Avoid `make` so the build does not require MSYS2 make / bash.
303+
run: go build -o _output\bin\limactl.exe .\cmd\limactl
304+
- name: Smoke test (create / start / shell / copy / stop / delete)
305+
run: |
306+
$ErrorActionPreference = 'Stop'
307+
# Scrub PATH of Cygwin/MSYS2/Git-for-Windows toolchains so that
308+
# limactl is forced to use native Windows binaries only. The
309+
# GitHub runner image has these pre-installed and on PATH by
310+
# default; we want to simulate a vanilla Windows host where
311+
# users have not installed Git for Windows or MSYS2.
312+
$env:PATH = ($env:PATH -split ';' | Where-Object {
313+
$_ -notmatch '\\msys(64|2)\\' -and
314+
$_ -notmatch '\\Git\\(usr|mingw\d+)\\bin' -and
315+
$_ -notmatch '\\Git\\cmd' -and
316+
$_ -notmatch '\\Git\\bin'
317+
}) -join ';'
318+
$sshSrc = (Get-Command ssh).Source
319+
Write-Host "ssh resolves to: $sshSrc"
320+
if ($sshSrc -notlike 'C:\Windows\System32\OpenSSH\ssh.exe') {
321+
Write-Error "Expected native Windows OpenSSH; got $sshSrc"
322+
exit 1
323+
}
324+
if (Get-Command cygpath -ErrorAction SilentlyContinue) {
325+
$cyg = (Get-Command cygpath).Source
326+
Write-Error "cygpath is still on PATH at $cyg; PATH scrub did not catch it"
327+
exit 1
328+
}
329+
$env:LIMA_HOME = "$env:TEMP\lima-plain"
330+
if (Test-Path $env:LIMA_HOME) { Remove-Item $env:LIMA_HOME -Recurse -Force }
331+
New-Item -ItemType Directory -Path $env:LIMA_HOME | Out-Null
332+
# Use the same WSL2 rootfs template that windows-wsl2 uses, so this
333+
# job exercises a real boot rather than the smallest synthetic config.
334+
& .\_output\bin\limactl.exe create --tty=false --name=plain `
335+
.\templates\experimental\wsl2.yaml
336+
& .\_output\bin\limactl.exe start plain
337+
& .\_output\bin\limactl.exe shell --tty=false plain -- uname -srm
338+
'roundtrip' | Out-File -Encoding ascii "$env:LIMA_HOME\rt.txt"
339+
& .\_output\bin\limactl.exe copy "$env:LIMA_HOME\rt.txt" plain:/tmp/rt.txt
340+
& .\_output\bin\limactl.exe shell --tty=false plain -- cat /tmp/rt.txt
341+
& .\_output\bin\limactl.exe stop plain
342+
& .\_output\bin\limactl.exe delete --force plain
343+
263344
qemu:
264345
name: "Integration tests (QEMU, macOS host)"
265346
runs-on: macos-15-large # Intel

0 commit comments

Comments
 (0)