From 9e65fcb7e02ca7165c6a372528eec1b33babe4e9 Mon Sep 17 00:00:00 2001 From: hustcer Date: Thu, 15 May 2025 08:15:34 +0800 Subject: [PATCH 1/3] chore: Add Nu version check for MSI installation --- tests/test-msi.nu | 8 ++++++++ tests/winget-install.nu | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/test-msi.nu b/tests/test-msi.nu index f9ca526b2..f5c98592c 100644 --- a/tests/test-msi.nu +++ b/tests/test-msi.nu @@ -38,4 +38,12 @@ def 'msi-install:MSI should install successfully for per-user' [] { msiexec /i $pkg MSIINSTALLPERUSER=1 /quiet /qn /L*V install.txt # print (open -r install.txt) check-user-install $install_dir + (msi-install:Should install the expected version) +} + +def 'msi-install:Should install the expected version' [] { + let install_dir = $'($nu.home-path)\AppData\Local\Programs\nu' + let version = ^$'($install_dir)\bin\nu.exe' --version | str trim + assert equal ($RELEASE_TAG | str contains $version) true + print $'(ansi g)Installed Nu of the specified version: ($version)(ansi reset)' } diff --git a/tests/winget-install.nu b/tests/winget-install.nu index 367763838..864b5fa3f 100644 --- a/tests/winget-install.nu +++ b/tests/winget-install.nu @@ -1,6 +1,9 @@ +use std/assert use common.nu [check-user-install] +const VERSION = '0.104.1' + def main [--scope: string] { let install_dir = $'($nu.home-path)\AppData\Local\Programs\nu' @@ -8,8 +11,16 @@ def main [--scope: string] { print $'Using winget to test MSI (ansi g)($scope_tip)(ansi reset) installation' let args = [--accept-source-agreements --accept-package-agreements --ignore-security-hash --silent] let scope_arg = if $scope in [user, machine] { [--scope $scope] } else { [] } - winget settings --enable LocalManifestFiles + winget settings --enable LocalManifestFiles winget settings --enable InstallerHashOverride - winget install --manifest manifests\n\Nushell\Nushell\0.104.1 ...$args ...$scope_arg + winget install --manifest manifests\n\Nushell\Nushell\($VERSION) ...$args ...$scope_arg check-user-install $install_dir + (msi-install:Should install the expected version) +} + +def 'msi-install:Should install the expected version' [] { + let install_dir = $'($nu.home-path)\AppData\Local\Programs\nu' + let version = ^$'($install_dir)\bin\nu.exe' --version | str trim + assert equal ($VERSION | str contains $version) true + print $'(ansi g)Installed Nu of the specified version: ($version)(ansi reset)' } From 51bf5197041b597a76d7219a6572b4a8cb754432 Mon Sep 17 00:00:00 2001 From: hustcer Date: Thu, 15 May 2025 11:52:03 +0800 Subject: [PATCH 2/3] chore: Add terminal profile tests --- cspell.yml | 1 + tests/common.nu | 24 +++++++++++++++++------- tests/test-msi.nu | 11 ++--------- tests/winget-install.nu | 11 ++--------- 4 files changed, 22 insertions(+), 25 deletions(-) diff --git a/cspell.yml b/cspell.yml index a1085d1b2..c80e8db00 100644 --- a/cspell.yml +++ b/cspell.yml @@ -10,6 +10,7 @@ words: - esep - dpkg - hkcu +- hklm - maint - rsort - cnqoj diff --git a/tests/common.nu b/tests/common.nu index 03694b533..c1a73a3fc 100644 --- a/tests/common.nu +++ b/tests/common.nu @@ -26,7 +26,7 @@ export def check-user-install [install_dir = $USER_INSTALL_DIR: string] { print $"(char nl)Path Environment after install: \n" print ($environment | split row ';') assert equal ($environment | str contains $install_dir) true - print $'(char nl)(ansi g)Path environment setup sucessfully...(ansi reset)' + print $'(char nl)(ansi g)Path environment setup successfully...(ansi reset)' assert equal (registry query --hkcu Software\nu | where name == installed | get 0.value) 1 assert equal (registry query --hkcu Software\nu | where name == WindowsTerminalProfile | get 0.value) 1 check-common-install $install_dir @@ -41,12 +41,12 @@ export def check-uninstall [install_dir = $MACHINE_INSTALL_DIR: string] { print ($environment | split row ';') assert equal ($environment | str contains $install_dir) false assert equal ($environment | str contains $USER_INSTALL_DIR) false - print $'(char nl)(ansi g)Path environment uninstall sucessfully...(ansi reset)' + print $'(char nl)(ansi g)Path environment uninstall successfully...(ansi reset)' assert equal ($PROFILE | path exists) false - print $'(ansi g)Windows Terminal Profile uninstall sucessfully...(ansi reset)' + print $'(ansi g)Windows Terminal Profile uninstall successfully...(ansi reset)' assert equal ($install_dir | path exists) false assert equal ($USER_INSTALL_DIR | path exists) false - print $'(ansi g)Nu binaries uninstalled sucessfully...(ansi reset)' + print $'(ansi g)Nu binaries uninstalled successfully...(ansi reset)' assert equal (try { registry query --hkcu Software\nu } catch {false}) false } @@ -58,7 +58,7 @@ export def check-local-machine-install [install_dir = $MACHINE_INSTALL_DIR: stri print $"(char nl)Path Environment after install: \n" print ($environment | split row ';') assert equal ($environment | str contains $install_dir) true - print $'(char nl)(ansi g)Path environment setup sucessfully...(ansi reset)' + print $'(char nl)(ansi g)Path environment setup successfully...(ansi reset)' assert equal (registry query --hklm Software\nu | where name == installed | get 0.value) 1 assert equal (registry query --hkcu Software\nu | where name == WindowsTerminalProfile | get 0.value) 1 check-common-install $install_dir @@ -67,14 +67,24 @@ export def check-local-machine-install [install_dir = $MACHINE_INSTALL_DIR: stri # Run this command locally or in GitHub runners after installing nu export def check-common-install [install_dir = $USER_INSTALL_DIR: string] { + let profile = open $PROFILE let contents = ls -s $install_dir let bins = ls -s $'($install_dir)\bin' assert greater ($bins | length) 7 assert greater ($contents | length) 3 assert equal ($PROFILE | path exists) true - print $'(ansi g)Windows Terminal Profile setup sucessfully...(ansi reset)' + assert equal ($profile | get profiles.0.icon | path exists) true + assert equal ($profile | get profiles.0.commandline | path exists) true + print $'(ansi g)Windows Terminal Profile setup successfully...(ansi reset)' assert equal ($BINS | all {|it| $it in ($bins | get name) }) true - print $'(ansi g)Nu binaries installed sucessfully...(ansi reset)' + print $'(ansi g)Nu binaries installed successfully...(ansi reset)' assert equal ($ASSETS | all {|it| $it in ($contents | get name) }) true print (^$'($install_dir)\bin\nu.exe' -c 'version') } + +export def check-version-match [version_expected: string, install_dir = $USER_INSTALL_DIR: string] { + + let version = ^$'($install_dir)\bin\nu.exe' --version | str trim + assert equal ($version_expected | str contains $version) true + print $'(ansi g)Installed Nu of the specified version: ($version)(ansi reset)' +} diff --git a/tests/test-msi.nu b/tests/test-msi.nu index f5c98592c..64af20f49 100644 --- a/tests/test-msi.nu +++ b/tests/test-msi.nu @@ -1,7 +1,7 @@ use std/assert use std/testing * -use common.nu [check-user-install] +use common.nu [check-user-install, check-version-match] const RELEASE_TAG = 'v0.104.1' @@ -38,12 +38,5 @@ def 'msi-install:MSI should install successfully for per-user' [] { msiexec /i $pkg MSIINSTALLPERUSER=1 /quiet /qn /L*V install.txt # print (open -r install.txt) check-user-install $install_dir - (msi-install:Should install the expected version) -} - -def 'msi-install:Should install the expected version' [] { - let install_dir = $'($nu.home-path)\AppData\Local\Programs\nu' - let version = ^$'($install_dir)\bin\nu.exe' --version | str trim - assert equal ($RELEASE_TAG | str contains $version) true - print $'(ansi g)Installed Nu of the specified version: ($version)(ansi reset)' + check-version-match $RELEASE_TAG $install_dir } diff --git a/tests/winget-install.nu b/tests/winget-install.nu index 864b5fa3f..ec9791af8 100644 --- a/tests/winget-install.nu +++ b/tests/winget-install.nu @@ -1,6 +1,6 @@ use std/assert -use common.nu [check-user-install] +use common.nu [check-user-install, check-version-match] const VERSION = '0.104.1' @@ -15,12 +15,5 @@ def main [--scope: string] { winget settings --enable InstallerHashOverride winget install --manifest manifests\n\Nushell\Nushell\($VERSION) ...$args ...$scope_arg check-user-install $install_dir - (msi-install:Should install the expected version) -} - -def 'msi-install:Should install the expected version' [] { - let install_dir = $'($nu.home-path)\AppData\Local\Programs\nu' - let version = ^$'($install_dir)\bin\nu.exe' --version | str trim - assert equal ($VERSION | str contains $version) true - print $'(ansi g)Installed Nu of the specified version: ($version)(ansi reset)' + check-version-match $VERSION $install_dir } From 956d1662dd358c5d270392ce9e78d701c6b6e913 Mon Sep 17 00:00:00 2001 From: hustcer Date: Thu, 15 May 2025 18:57:41 +0800 Subject: [PATCH 3/3] chore: Update manifest --- .../Nushell/0.104.1/Nushell.Nushell.installer.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/manifests/n/Nushell/Nushell/0.104.1/Nushell.Nushell.installer.yaml b/manifests/n/Nushell/Nushell/0.104.1/Nushell.Nushell.installer.yaml index a3786caa3..9540baf25 100644 --- a/manifests/n/Nushell/Nushell/0.104.1/Nushell.Nushell.installer.yaml +++ b/manifests/n/Nushell/Nushell/0.104.1/Nushell.Nushell.installer.yaml @@ -13,25 +13,25 @@ InstallModes: UpgradeBehavior: install Commands: - nu -ReleaseDate: 2025-05-13 +ReleaseDate: 2025-05-15 InstallationMetadata: DefaultInstallLocation: nu Installers: - Architecture: x64 InstallerUrl: https://github.com/nushell/nightly/releases/download/v0.104.1/nu-0.104.1-x86_64-pc-windows-msvc.msi - InstallerSha256: 588FB3156059D1363060B77C4D87E9B85DAAF93991AF53985CA611C1B6F1115E - ProductCode: '{33467914-5777-4000-97AF-DB65F926EE4F}' + InstallerSha256: 0A88012C109688116F9DC4E2FA172778EF590C8F05698758E9B88C4D9606618B + ProductCode: '{E296D932-22B5-4B9F-918D-EB7D54EEB255}' AppsAndFeaturesEntries: - DisplayName: Nushell - ProductCode: '{33467914-5777-4000-97AF-DB65F926EE4F}' + ProductCode: '{E296D932-22B5-4B9F-918D-EB7D54EEB255}' UpgradeCode: '{82D756D2-19FA-4F09-B10F-64942E89F364}' - Architecture: arm64 InstallerUrl: https://github.com/nushell/nightly/releases/download/v0.104.1/nu-0.104.1-aarch64-pc-windows-msvc.msi - InstallerSha256: A76AE4A9CC11DD0CEF86CF011BBD195E7850444471A50F7F44209869C359A901 - ProductCode: '{33534361-CE47-4056-8A1F-061819E65461}' + InstallerSha256: 9CDDDF2D5C50BDF38F04878F77B3397B3F7171A6F69A0C9B3FA0DF69DC8BB276 + ProductCode: '{D3B3EC28-2761-48A8-A2A3-0B0669BE6612}' AppsAndFeaturesEntries: - DisplayName: Nushell - ProductCode: '{33534361-CE47-4056-8A1F-061819E65461}' + ProductCode: '{D3B3EC28-2761-48A8-A2A3-0B0669BE6612}' UpgradeCode: '{82D756D2-19FA-4F09-B10F-64942E89F364}' ManifestType: installer ManifestVersion: 1.9.0