diff --git a/.github/workflows/test-msi.yml b/.github/workflows/test-msi.yml index d077b61ae..b15ec7876 100644 --- a/.github/workflows/test-msi.yml +++ b/.github/workflows/test-msi.yml @@ -33,7 +33,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2019, windows-latest, windows-2025, windows-11-arm] + os: [windows-latest, windows-2025, windows-11-arm] runs-on: ${{ matrix.os }} diff --git a/.github/workflows/test-winget.yml b/.github/workflows/test-winget.yml index 7300c1dfe..f3c5b71c4 100644 --- a/.github/workflows/test-winget.yml +++ b/.github/workflows/test-winget.yml @@ -56,16 +56,12 @@ jobs: with: version: 'nightly' - - name: Install komac - run: | - winget install komac --accept-source-agreements --accept-package-agreements --disable-interactivity - - name: Test Winget Install with Default Scope shell: nu {0} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - ls C:\Users\runneradmin\AppData\Local\Programs\Komac\bin\ | print + winget install komac --accept-source-agreements --accept-package-agreements --disable-interactivity nu tests/winget-install.nu user-scope: @@ -90,14 +86,10 @@ jobs: with: version: 'nightly' - - name: Install komac - run: | - winget install komac --accept-source-agreements --accept-package-agreements --disable-interactivity - - name: Test Winget Install with User Scope shell: nu {0} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - ls C:\Users\runneradmin\AppData\Local\Programs\Komac\bin\ | print + winget install komac --accept-source-agreements --accept-package-agreements --disable-interactivity nu tests/winget-install.nu --scope user diff --git a/tests/winget-install.nu b/tests/winget-install.nu index 668df6626..1b95ac4dc 100644 --- a/tests/winget-install.nu +++ b/tests/winget-install.nu @@ -1,26 +1,28 @@ use std/assert +use std/util ['path add'] use common.nu [check-user-install, check-version-match, get-latest-tag] -const KOMAC = 'C:\Users\runneradmin\AppData\Local\Programs\Komac\bin\komac.exe' +const KOMAC_PATH = $'($nu.home-path)\AppData\Local\Programs\Komac\bin\' -def main [--scope: string] { - prepare-manifest - let install_dir = $'($nu.home-path)\AppData\Local\Programs\nu' - let scope_tip = if $scope in [user, machine] { $'($scope) scope' } else { $'default scope' } - print $'Using winget to test MSI (ansi g)($scope_tip)(ansi reset) installation' - let args = [ +const WINGET_ARGS = [ --silent --ignore-security-hash --disable-interactivity --accept-source-agreements --accept-package-agreements ] + +def main [--scope: string] { + prepare-manifest + let install_dir = $'($nu.home-path)\AppData\Local\Programs\nu' + let scope_tip = if $scope in [user, machine] { $'($scope) scope' } else { $'default scope' } + print $'Using winget to test MSI (ansi g)($scope_tip)(ansi reset) installation' let version = get-latest-tag | split row + | first let scope_arg = if $scope in [user, machine] { [--scope $scope] } else { [] } winget settings --enable LocalManifestFiles winget settings --enable InstallerHashOverride - winget install --manifest $'manifests\n\Nushell\Nushell\($version)\' ...$args ...$scope_arg + winget install --manifest $'manifests\n\Nushell\Nushell\($version)\' ...$WINGET_ARGS ...$scope_arg check-user-install $install_dir check-version-match $version $install_dir } @@ -28,7 +30,10 @@ def main [--scope: string] { def prepare-manifest [] { let version = get-latest-tag | split row + | first let urls = get-download-url - ^$KOMAC update Nushell.Nushell --dry-run -v $version -u ...$urls -o (pwd) + path add $KOMAC_PATH + ls $KOMAC_PATH | print + komac --version | print + komac update Nushell.Nushell --dry-run -v $version -u ...$urls -o (pwd) } def get-download-url [] {