Install-Uv accepted any file at $HermesHome\bin\uv.exe, and copied whatever `Get-Command uv` returned into that location. Chocolatey's bin\uv.exe is a ShimGen launcher that locates ..\lib\uv\tools\uv.exe RELATIVE to itself, so the copy is dead on arrival; `& exe --version` does not throw on a nonzero exit, so the launcher passed the try/catch and the Python stage then failed with "Python 3.11 not available" (#110350). The re-run path trusted the same broken copy again. Building on KoNit-K's Test-ManagedUvBinary and its three call sites: - Test-ManagedUvBinary merges stderr, relaxes the error preference, and returns the `uv <version>` line only on exit 0 -- a launcher's error text can no longer surface as "Managed uv found (Cannot find file ...)". - Resolve-UvShimTarget maps a candidate to the standalone binary before the copy: `<name>.shim` sidecar (Scoop), the Chocolatey bin\ -> lib\<pkg>\tools\ layout, symlinks (winget Links\); other reparse points (WindowsApps app-execution aliases) have no copyable file and skip the salvage. - The salvage rung validates the candidate where it lives, copies, then validates the COPY at its new location and removes it on failure, so the stage fails honestly instead of reporting success over a dead launcher. - scripts/tests/test-install-ps1-uv-shim-validation.ps1 drives the real Install-Uv with compiled fake uv binaries (a working uv and a location-relative launcher) under stubbed installer rungs; wired into installer-tests.yml for pwsh 7 and Windows PowerShell 5.1. Co-authored-by: joaomarcos <joaomarcosdias444@gmail.com>
55 lines
2.2 KiB
YAML
55 lines
2.2 KiB
YAML
name: Installer tests
|
|
|
|
# scripts/install.ps1's PowerShell tests. They exercise the installer as a real
|
|
# subprocess, and every path contract they assert (8.3 short-name aliases,
|
|
# Git Bash layouts, provider-cmdlet behavior) is Windows-specific — so they need
|
|
# a Windows runner. Before this workflow existed the files were in the tree but
|
|
# nothing ever ran them.
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: installer-tests-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
powershell:
|
|
name: PowerShell installer tests
|
|
runs-on: windows-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
# Windows PowerShell 5.1 as well as pwsh 7: install.ps1 is delivered via
|
|
# `irm | iex` into whatever shell the user already has, and 5.1 is what
|
|
# ships with Windows. A construct that only parses under 7 is a broken
|
|
# installer for most of the people hitting it.
|
|
- name: 8.3 short-path normalization (pwsh 7)
|
|
shell: pwsh
|
|
run: pwsh -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-install-ps1-longpath.ps1
|
|
|
|
- name: 8.3 short-path normalization (Windows PowerShell 5.1)
|
|
shell: powershell
|
|
run: powershell -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-install-ps1-longpath.ps1
|
|
|
|
- name: System Node and npm compatibility (pwsh 7)
|
|
shell: pwsh
|
|
run: pwsh -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-install-ps1-node-compatibility.ps1
|
|
|
|
- name: System Node and npm compatibility (Windows PowerShell 5.1)
|
|
shell: powershell
|
|
run: powershell -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-install-ps1-node-compatibility.ps1
|
|
|
|
- name: Managed uv acceptance rejects relocated shims (pwsh 7)
|
|
shell: pwsh
|
|
run: pwsh -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-install-ps1-uv-shim-validation.ps1
|
|
|
|
- name: Managed uv acceptance rejects relocated shims (Windows PowerShell 5.1)
|
|
shell: powershell
|
|
run: powershell -NoProfile -ExecutionPolicy Bypass -File scripts/tests/test-install-ps1-uv-shim-validation.ps1
|