From 91ce89ed57f9a6e2f6ee18adf0650722cc105f05 Mon Sep 17 00:00:00 2001 From: hustcer Date: Mon, 2 Jun 2025 12:50:12 +0800 Subject: [PATCH 1/4] Improve MIS packages installation tests --- .github/workflows/test-msi.yml | 2 +- .github/workflows/test-winget.yml | 10 ---------- tests/winget-install.nu | 19 +++++++++++-------- 3 files changed, 12 insertions(+), 19 deletions(-) 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..97918c618 100644 --- a/.github/workflows/test-winget.yml +++ b/.github/workflows/test-winget.yml @@ -56,16 +56,11 @@ 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: @@ -90,14 +85,9 @@ 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 diff --git a/tests/winget-install.nu b/tests/winget-install.nu index 668df6626..68161d228 100644 --- a/tests/winget-install.nu +++ b/tests/winget-install.nu @@ -2,25 +2,26 @@ use std/assert 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 = $'($nu.home-path)\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 = [ +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,6 +29,8 @@ def main [--scope: string] { def prepare-manifest [] { let version = get-latest-tag | split row + | first let urls = get-download-url + winget install komac ...$WINGET_ARGS + ls $'($nu.home-path)\AppData\Local\Programs\Komac\bin\' | print ^$KOMAC update Nushell.Nushell --dry-run -v $version -u ...$urls -o (pwd) } From 9fa11ff0b1387762b55367c92d8dc8df6df914fb Mon Sep 17 00:00:00 2001 From: hustcer Date: Mon, 2 Jun 2025 12:53:35 +0800 Subject: [PATCH 2/4] Improve MIS packages installation tests --- .github/workflows/test-winget.yml | 2 ++ tests/winget-install.nu | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-winget.yml b/.github/workflows/test-winget.yml index 97918c618..f3c5b71c4 100644 --- a/.github/workflows/test-winget.yml +++ b/.github/workflows/test-winget.yml @@ -61,6 +61,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + winget install komac --accept-source-agreements --accept-package-agreements --disable-interactivity nu tests/winget-install.nu user-scope: @@ -90,4 +91,5 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + 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 68161d228..05b4a24d3 100644 --- a/tests/winget-install.nu +++ b/tests/winget-install.nu @@ -29,7 +29,6 @@ def main [--scope: string] { def prepare-manifest [] { let version = get-latest-tag | split row + | first let urls = get-download-url - winget install komac ...$WINGET_ARGS ls $'($nu.home-path)\AppData\Local\Programs\Komac\bin\' | print ^$KOMAC update Nushell.Nushell --dry-run -v $version -u ...$urls -o (pwd) } From ce17165b03173558280f708d0e302a4a1a6ffd51 Mon Sep 17 00:00:00 2001 From: hustcer Date: Mon, 2 Jun 2025 13:03:04 +0800 Subject: [PATCH 3/4] Improve MIS packages installation tests --- tests/winget-install.nu | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/winget-install.nu b/tests/winget-install.nu index 05b4a24d3..61038f55b 100644 --- a/tests/winget-install.nu +++ b/tests/winget-install.nu @@ -1,8 +1,9 @@ use std/assert +use std/util ['path add'] use common.nu [check-user-install, check-version-match, get-latest-tag] -const KOMAC = $'($nu.home-path)\AppData\Local\Programs\Komac\bin\komac.exe' +const KOMAC_PATH = $'($nu.home-path)\AppData\Local\Programs\Komac\bin\' const WINGET_ARGS = [ --silent @@ -29,8 +30,9 @@ def main [--scope: string] { def prepare-manifest [] { let version = get-latest-tag | split row + | first let urls = get-download-url - ls $'($nu.home-path)\AppData\Local\Programs\Komac\bin\' | print - ^$KOMAC update Nushell.Nushell --dry-run -v $version -u ...$urls -o (pwd) + ls $KOMAC_PATH | print + komac --version | print + komac update Nushell.Nushell --dry-run -v $version -u ...$urls -o (pwd) } def get-download-url [] { From 705a0ac20d94799dcea9f9554c3e3938aac87e2d Mon Sep 17 00:00:00 2001 From: hustcer Date: Mon, 2 Jun 2025 13:06:10 +0800 Subject: [PATCH 4/4] Improve MIS packages installation tests --- tests/winget-install.nu | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/winget-install.nu b/tests/winget-install.nu index 61038f55b..1b95ac4dc 100644 --- a/tests/winget-install.nu +++ b/tests/winget-install.nu @@ -30,6 +30,7 @@ def main [--scope: string] { def prepare-manifest [] { let version = get-latest-tag | split row + | first let urls = get-download-url + path add $KOMAC_PATH ls $KOMAC_PATH | print komac --version | print komac update Nushell.Nushell --dry-run -v $version -u ...$urls -o (pwd)