Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/test-msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,50 @@ jobs:
--report { type: junit, path: test-report.xml }
--returns summary | to json | save --force test-summary.json
)

# machine-scope:
# name: Install with Machine Scope

# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest]

# runs-on: ${{ matrix.os }}

# steps:
# - uses: actions/checkout@v4

# - name: Setup Nu
# uses: hustcer/setup-nu@v3
# with:
# version: 'nightly'

# - name: Download MSI
# shell: nu {0}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# const RELEASE_TAG = 'v0.104.1'
# mkdir msi-pkgs; cd msi-pkgs
# let arch = $nu.os-info.arch
# gh release download $RELEASE_TAG --repo nushell/nightly --pattern $"*-($arch)-*.msi"

# - name: Test MSI Install with Machine Scope
# shell: powershell
# run: |
# # Create a temporary script that will be run with elevation
# @"
# `$ErrorActionPreference = 'Stop'
# `$msi = Get-ChildItem -Path ./msi-pkgs -Filter *.msi | Select-Object -First 1
# Start-Process msiexec.exe -ArgumentList "/i `$(`$msi.FullName) ALLUSERS=1 /qn /norestart /L*V install.txt" -Wait -NoNewWindow -Verb RunAs
# "@ | Out-File -FilePath elevate-install.ps1

# # Run the script with elevation
# Start-Process powershell.exe -ArgumentList "-File elevate-install.ps1" -Verb RunAs -Wait

# - name: Try Running Nu
# shell: nu {0}
# run: |
# # ^'C:\Program Files\nu\bin\nu.exe' -c 'version'
# ^'C:\Users\runneradmin\AppData\Local\Programs\nu\bin\nu.exe' -c 'version'
38 changes: 38 additions & 0 deletions .github/workflows/test-winget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,41 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
nu tests/winget-install.nu --scope user

# machine-scope:
# name: Install with Machine Scope

# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, windows-2025]

# runs-on: ${{ matrix.os }}

# steps:
# - uses: actions/checkout@v4

# - name: Install winget
# if: ${{ matrix.os == 'windows-latest' }}
# uses: Cyberboss/install-winget@v1

# - name: Setup Nu
# uses: hustcer/setup-nu@v3
# with:
# version: 'nightly'

# - name: Test Winget Install with Machine Scope
# shell: powershell
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# winget settings --enable LocalManifestFiles
# Start-Process -FilePath "powershell.exe" -Verb RunAs -ArgumentList @(
# "-Command",
# "'winget install --manifest manifests/n/Nushell/Nushell/0.104.1 --scope machine --accept-source-agreements --accept-package-agreements'"
# )

# - name: Try Running Nu
# shell: nu {0}
# run: |
# ^'C:\Program Files\nu\bin\nu.exe' -c 'version'
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ InstallModes:
UpgradeBehavior: install
Commands:
- nu
ReleaseDate: 2025-05-11
ReleaseDate: 2025-05-13
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: 5FAC52A2590F118EF96447B256AD53229BDF4CC03E3B0094F51A2E53D38A260B
ProductCode: '{2DDEA6A2-DFD6-4DD7-8A4F-42F289D8EE78}'
InstallerSha256: 588FB3156059D1363060B77C4D87E9B85DAAF93991AF53985CA611C1B6F1115E
ProductCode: '{33467914-5777-4000-97AF-DB65F926EE4F}'
AppsAndFeaturesEntries:
- DisplayName: Nushell
ProductCode: '{2DDEA6A2-DFD6-4DD7-8A4F-42F289D8EE78}'
ProductCode: '{33467914-5777-4000-97AF-DB65F926EE4F}'
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: DE389519623B4A3A190579642CE1412F76079698E5F92F41AF534C8DBD6D3583
ProductCode: '{7B0C8A48-CE94-4A3C-B5AB-5A011764C588}'
InstallerSha256: A76AE4A9CC11DD0CEF86CF011BBD195E7850444471A50F7F44209869C359A901
ProductCode: '{33534361-CE47-4056-8A1F-061819E65461}'
AppsAndFeaturesEntries:
- DisplayName: Nushell
ProductCode: '{7B0C8A48-CE94-4A3C-B5AB-5A011764C588}'
ProductCode: '{33534361-CE47-4056-8A1F-061819E65461}'
UpgradeCode: '{82D756D2-19FA-4F09-B10F-64942E89F364}'
ManifestType: installer
ManifestVersion: 1.9.0
80 changes: 80 additions & 0 deletions tests/common.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

use std/assert

const BINS = [
nu.exe,
less.exe,
nu_plugin_inc.exe,
nu_plugin_gstat.exe,
nu_plugin_query.exe,
nu_plugin_polars.exe,
nu_plugin_formats.exe,
]

const MACHINE_INSTALL_DIR = 'C:\Program Files\nu'
const USER_INSTALL_DIR = $'($nu.home-path)\AppData\Local\Programs\nu'

const ASSETS = [License.rtf README.txt nu.ico bin]

const PROFILE = $'($nu.home-path)\AppData\Local\Microsoft\Windows Terminal\Fragments\nu\nu.json'

# Run this command locally or in GitHub runners after installing nu
export def check-user-install [install_dir = $USER_INSTALL_DIR: string] {

let environment = registry query --hkcu environment
| where name == Path | get 0.value
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)'
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
}

# Run this command locally after uninstalling nu
export def check-uninstall [install_dir = $MACHINE_INSTALL_DIR: string] {

let environment = registry query --hkcu environment
| where name == Path | get 0.value
print $"(char nl)Path Environment after uninstall: \n"
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)'
assert equal ($PROFILE | path exists) false
print $'(ansi g)Windows Terminal Profile uninstall sucessfully...(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)'
assert equal (try { registry query --hkcu Software\nu } catch {false}) false
}

export def check-local-machine-install [install_dir = $MACHINE_INSTALL_DIR: string] {

const ENV_REG_KEY = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
let environment = registry query --hklm $ENV_REG_KEY
| where name == Path | get 0.value
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)'
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
}

# Run this command locally or in GitHub runners after installing nu
export def check-common-install [install_dir = $USER_INSTALL_DIR: string] {

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 ($BINS | all {|it| $it in ($bins | get name) }) true
print $'(ansi g)Nu binaries installed sucessfully...(ansi reset)'
assert equal ($ASSETS | all {|it| $it in ($contents | get name) }) true
print (^$'($install_dir)\bin\nu.exe' -c 'version')
}
23 changes: 3 additions & 20 deletions tests/test-msi.nu
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

use std/assert
use std/testing *
use common.nu [check-user-install]

const RELEASE_TAG = 'v0.104.1'

Expand Down Expand Up @@ -29,30 +30,12 @@ def 'msi-install:MSI should exists' [] {
def 'msi-install:MSI should install successfully for per-user' [] {
let pkg = $in.msi
let install_dir = $in.install_dir
let profile = $'($nu.home-path)\AppData\Local\Microsoft\Windows Terminal\Fragments\nu\nu.json'
const BINS = [
nu.exe,
nu_plugin_inc.exe,
nu_plugin_gstat.exe,
nu_plugin_query.exe,
nu_plugin_polars.exe,
nu_plugin_formats.exe,
]

cd msi-pkgs

print 'Using msiexec to test MSI installation'
# msiexec /i $pkg ALLUSERS=1 /a /quiet /qn /L*V install.txt
msiexec /i $pkg MSIINSTALLPERUSER=1 /quiet /qn /L*V install.txt
# print (open -r install.txt)
let environment = registry query --hkcu environment
| where name == Path | get 0.value
print $"Path Environment: \n($environment)"
let contents = ls -s $install_dir
let bins = ls -s $'($install_dir)\bin'
assert greater ($bins | length) 5
assert greater ($contents | length) 3
assert equal ($profile | path exists) true
assert equal ($environment | str contains $install_dir) true
assert equal ($BINS | all {|it| $it in ($bins | get name) }) true
assert equal ([License.rtf README.txt nu.ico bin] | all {|it| $it in ($contents | get name) }) true
check-user-install $install_dir
}
29 changes: 3 additions & 26 deletions tests/winget-install.nu
Original file line number Diff line number Diff line change
@@ -1,37 +1,14 @@

use std/assert
use common.nu [check-user-install]

def main [--scope: string] {
let install_dir = $'($nu.home-path)\AppData\Local\Programs\nu'
let profile = $'($nu.home-path)\AppData\Local\Microsoft\Windows Terminal\Fragments\nu\nu.json'
const BINS = [
nu.exe,
nu_plugin_inc.exe,
nu_plugin_gstat.exe,
nu_plugin_query.exe,
nu_plugin_polars.exe,
nu_plugin_formats.exe,
]

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 = [--accept-source-agreements --accept-package-agreements --silent]
let scope_arg = if $scope in [user, machine] { [--scope $scope] } else { [] }
winget settings --enable LocalManifestFiles
winget install --manifest manifests\n\Nushell\Nushell\0.104.1 ...$args ...$scope_arg
let environment = registry query --hkcu environment
| where name == Path | get 0.value
print $"Path Environment: \n($environment)"
let contents = ls -s $install_dir
let bins = ls -s $'($install_dir)\bin'
assert greater ($bins | length) 5
assert greater ($contents | length) 3
assert equal ($profile | path exists) true
print $'(ansi g)Windows Terminal Profile setup sucessfully...(ansi reset)'
assert equal ($environment | str contains $install_dir) true
print $'(ansi g)Path environment setup sucessfully...(ansi reset)'
assert equal ($BINS | all {|it| $it in ($bins | get name) }) true
assert equal ([License.rtf README.txt nu.ico bin] | all {|it| $it in ($contents | get name) }) true
print $'(ansi g)Nu binaries installed sucessfully...(ansi reset)'
^$'($install_dir)\bin\nu.exe' -c 'version'
check-user-install $install_dir
}