diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index caf3b0e..ec5979f 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -108,8 +108,40 @@ jobs: if (Test-Path $env:VENV_DIR) { Remove-Item $env:VENV_DIR -Recurse -Force } - $launcher = (Get-Command py.exe -ErrorAction Stop).Source - & $launcher -3.11 -m venv $env:VENV_DIR + + # Find a usable Python launcher. act_runner runs as SYSTEM and may + # not have py.exe / python.exe in PATH; try common locations. + # Override via $env:CI_PYTHON_LAUNCHER if installed elsewhere. + $candidates = @() + if ($env:CI_PYTHON_LAUNCHER) { $candidates += $env:CI_PYTHON_LAUNCHER } + $candidates += @( + 'py.exe', + 'python.exe', + 'C:\Python311\python.exe', + 'C:\Python312\python.exe', + 'C:\Python313\python.exe', + "$env:LOCALAPPDATA\Programs\Python\Python311\python.exe", + "$env:LOCALAPPDATA\Programs\Python\Python312\python.exe", + 'C:\Program Files\Python311\python.exe', + 'C:\Program Files\Python312\python.exe', + 'C:\Program Files\Python313\python.exe' + ) + $launcher = $null + foreach ($c in $candidates) { + $cmd = Get-Command $c -ErrorAction SilentlyContinue + if ($cmd) { $launcher = $cmd.Source; break } + } + if (-not $launcher) { + throw "No Python launcher found. Install Python 3.11+ system-wide or set CI_PYTHON_LAUNCHER. Tried: $($candidates -join ', ')" + } + Write-Host "Bootstrapping venv with: $launcher" + + if ($launcher -like '*py.exe') { + & $launcher -3.11 -m venv $env:VENV_DIR + } + else { + & $launcher -m venv $env:VENV_DIR + } if ($LASTEXITCODE -ne 0) { throw "venv creation failed" } }