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
46 changes: 0 additions & 46 deletions .github/workflows/test-msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,49 +67,3 @@ jobs:
--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'
48 changes: 10 additions & 38 deletions .github/workflows/test-winget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,16 @@ 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
nu tests/winget-install.nu

user-scope:
Expand All @@ -85,47 +90,14 @@ 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
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'
37 changes: 0 additions & 37 deletions manifests/n/Nushell/Nushell/0.104.1/Nushell.Nushell.installer.yaml

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions manifests/n/Nushell/Nushell/0.104.1/Nushell.Nushell.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions tests/common.nu
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,11 @@ export def check-version-match [version_expected: string, install_dir = $USER_IN
assert equal ($version_expected | str contains $version) true
print $'(ansi g)Installed Nu of the specified version: ($version)(ansi reset)'
}

export def get-latest-tag [] {
http get https://api.github.com/repos/nushell/nightly/releases
| sort-by -r created_at
| where tag_name =~ nightly
| get tag_name?.0?
| default ''
}
12 changes: 7 additions & 5 deletions tests/test-msi.nu
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@

use std/assert
use std/testing *
use common.nu [check-user-install, check-version-match]
use common.nu [check-user-install, check-version-match, get-latest-tag]

const RELEASE_TAG = 'v0.104.1'

@before-all
def setup [] {
mkdir msi-pkgs
cd msi-pkgs
let arch = $nu.os-info.arch
gh release download $RELEASE_TAG --repo nushell/nightly --pattern $"*-($arch)-*.msi"
let release_tag = get-latest-tag
gh release download $release_tag --repo nushell/nightly --pattern $"*-($arch)-*.msi"
let msi = ls | where name =~ msi | get name.0
print $'MSI File: ($msi)'
let install_dir = $'($nu.home-path)\AppData\Local\Programs\nu'
{ msi: $msi, install_dir: $install_dir }
{ msi: $msi, install_dir: $install_dir, release_tag: $release_tag }
}

@test
Expand All @@ -30,6 +30,7 @@ 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 release_tag = $in.release_tag

cd msi-pkgs

Expand All @@ -38,5 +39,6 @@ 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
check-version-match $RELEASE_TAG $install_dir
check-version-match $release_tag $install_dir
}

32 changes: 26 additions & 6 deletions tests/winget-install.nu
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@

use std/assert
use common.nu [check-user-install, check-version-match]
use common.nu [check-user-install, check-version-match, get-latest-tag]

const VERSION = '0.104.1'
const KOMAC = 'C:\Users\runneradmin\AppData\Local\Programs\Komac\bin\komac.exe'

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 = [--accept-source-agreements --accept-package-agreements --ignore-security-hash --silent]
let args = [
--silent
--ignore-security-hash
--disable-interactivity
--accept-source-agreements
--accept-package-agreements
]
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)\' ...$args ...$scope_arg
check-user-install $install_dir
check-version-match $VERSION $install_dir
check-version-match $version $install_dir
}

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)
}

def get-download-url [] {
http get https://api.github.com/repos/nushell/nightly/releases
| sort-by -r created_at
| where tag_name =~ nightly | get assets.0.browser_download_url
| where $it =~ 'msi'
}
Loading