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
3 changes: 3 additions & 0 deletions .github/workflows/test-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
use ${{ github.workspace }}/tests/test-all.nu *
use ${{ github.workspace }}/tests/winget-install.nu [prepare-manifest]
winget install komac --accept-source-agreements --accept-package-agreements --disable-interactivity
prepare-manifest
test-winget-per-user-install
test-winget-per-user-upgrade
test-winget-per-machine-install
Expand Down
60 changes: 41 additions & 19 deletions tests/test-all.nu
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# winget settings --enable LocalManifestFiles
# winget settings --enable InstallerHashOverride

use common.nu [check-user-install, check-version-match, check-local-machine-install]
use winget-install.nu [prepare-manifest]
use common.nu [check-user-install, check-version-match, check-local-machine-install, get-latest-tag]

const VERSION = '0.105.1'
const PREV_VERSION = '0.105.0'
Expand All @@ -19,15 +20,16 @@ const WINGET_ARGS = [
--accept-package-agreements
]

def main [--msi(-m)] {
if $msi {
def main [--msi(-m), --local] {
if $msi and $local {
test-msi-per-user-install
test-msi-per-machine-install
}
test-winget-per-user-install
test-winget-per-user-upgrade
test-winget-per-machine-install
test-winget-per-machine-upgrade
if not $local { prepare-manifest }
test-winget-per-user-install --local=$local
test-winget-per-user-upgrade --local=$local
test-winget-per-machine-install --local=$local
test-winget-per-machine-upgrade --local=$local
}

export def test-msi-per-user-install [] {
Expand All @@ -50,41 +52,61 @@ export def test-msi-per-machine-install [] {
winget list nushell --accept-source-agreements
}

export def test-winget-per-user-install [] {
export def test-winget-per-user-install [--local] {
winget uninstall nushell | complete
print $'(char nl)Using winget to test MSI (ansi g)user scope(ansi reset) installation'
print '-------------------------------------------------------------------'
winget install --manifest $'manifests\n\Nushell\Nushell\($PREV_VERSION)\' ...$WINGET_ARGS --scope user
if $local {
winget install --manifest $'manifests\n\Nushell\Nushell\($PREV_VERSION)\' ...$WINGET_ARGS --scope user
check-version-match $PREV_VERSION $PER_USER_INSTALL_DIR
} else {
winget install --id Nushell.Nushell ...$WINGET_ARGS --scope user
}
check-user-install $PER_USER_INSTALL_DIR
check-version-match $PREV_VERSION $PER_USER_INSTALL_DIR
winget list nushell --accept-source-agreements
}

export def test-winget-per-user-upgrade [] {
export def test-winget-per-user-upgrade [--local] {
print $'(char nl)Using winget to test MSI (ansi g)user scope(ansi reset) upgrade'
print '-------------------------------------------------------------------'
# winget upgrade does not work for user scope due to https://github.com/microsoft/winget-cli/issues/3011
winget install --manifest $'manifests\n\Nushell\Nushell\($LAST_VERSION)\' ...$WINGET_ARGS --scope user
if $local {
winget install --manifest $'manifests\n\Nushell\Nushell\($LAST_VERSION)\' ...$WINGET_ARGS --scope user
check-version-match $LAST_VERSION $PER_USER_INSTALL_DIR
} else {
let version = get-latest-tag | split row + | first
winget install --manifest $'manifests\n\Nushell\Nushell\($version)\' ...$WINGET_ARGS --scope user
check-version-match $version $PER_USER_INSTALL_DIR
}
check-user-install $PER_USER_INSTALL_DIR
check-version-match $LAST_VERSION $PER_USER_INSTALL_DIR
winget list nushell --accept-source-agreements
}

export def test-winget-per-machine-install [] {
export def test-winget-per-machine-install [--local] {
winget uninstall nushell | complete
print $'(char nl)Using winget to test MSI (ansi g)machine scope(ansi reset) installation'
print '-------------------------------------------------------------------'
winget install --manifest $'manifests\n\Nushell\Nushell\($PREV_VERSION)\' ...$WINGET_ARGS --scope machine
if $local {
winget install --manifest $'manifests\n\Nushell\Nushell\($PREV_VERSION)\' ...$WINGET_ARGS --scope machine
check-version-match $PREV_VERSION $PER_MACHINE_INSTALL_DIR
} else {
winget install --id Nushell.Nushell ...$WINGET_ARGS --scope machine
}
check-local-machine-install
check-version-match $PREV_VERSION $PER_MACHINE_INSTALL_DIR
winget list nushell --accept-source-agreements
}

export def test-winget-per-machine-upgrade [] {
export def test-winget-per-machine-upgrade [--local] {
print $'(char nl)Using winget to test MSI (ansi g)machine scope(ansi reset) upgrade'
print '-------------------------------------------------------------------'
winget upgrade --manifest $'manifests\n\Nushell\Nushell\($LAST_VERSION)\' ...$WINGET_ARGS
if $local {
winget upgrade --manifest $'manifests\n\Nushell\Nushell\($LAST_VERSION)\' ...$WINGET_ARGS
check-version-match $LAST_VERSION $PER_MACHINE_INSTALL_DIR
} else {
let version = get-latest-tag | split row + | first
winget upgrade --manifest $'manifests\n\Nushell\Nushell\($version)\' ...$WINGET_ARGS
check-version-match $version $PER_MACHINE_INSTALL_DIR
}
check-local-machine-install
check-version-match $LAST_VERSION $PER_MACHINE_INSTALL_DIR
winget list nushell --accept-source-agreements
}
2 changes: 1 addition & 1 deletion tests/winget-install.nu
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def main [--scope: string] {
check-version-match $version $USER_INSTALL_DIR
}

def prepare-manifest [] {
export def prepare-manifest [] {
let version = get-latest-tag | split row + | first
let urls = get-download-url
path add $KOMAC_PATH
Expand Down