diff --git a/.github/workflows/cr.yml b/.github/workflows/cr.yml index 135c814d1..bd1b10a74 100644 --- a/.github/workflows/cr.yml +++ b/.github/workflows/cr.yml @@ -37,7 +37,7 @@ jobs: As a senior Nushell engineer, perform comprehensive script review with focus on: ### 1. Core Requirements: - - Validate Nu 0.90+ compatibility + - Validate Nu 0.100+ compatibility - Check structured data handling - Verify pipeline efficiency - Assess module organization @@ -55,7 +55,7 @@ jobs: - Parallel execution opportunities **Rules:** - - Target Nu 0.90+ features + - Target Nu 0.100+ features - Highlight data flow vulnerabilities - Suggest structured data optimizations - Keep feedback Nu-specific diff --git a/.github/workflows/loong.yml b/.github/workflows/loong.yml index 3875e4247..61b0a4b00 100644 --- a/.github/workflows/loong.yml +++ b/.github/workflows/loong.yml @@ -20,7 +20,7 @@ on: jobs: install-rpm-loong: - if: false + # if: false name: Install Nu RPM on Loong64 strategy: fail-fast: false @@ -29,7 +29,8 @@ jobs: - ghcr.io/loong64/anolis:latest - loongarch64/openeuler:24.03-LTS - ghcr.io/loong64/opencloudos:latest - - cr.loongnix.cn/openanolis/anolisos:8.10 + # - cr.loongnix.cn/loongson/loongnix:20 + # - cr.loongnix.cn/openanolis/anolisos:8.10 runs-on: ubuntu-24.04-arm steps: - name: Set up QEMU @@ -38,7 +39,7 @@ jobs: platforms: all - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Test Install Nushell on Loong64 run: | docker pull --platform=linux/loong64 ${{ matrix.image }} @@ -80,7 +81,7 @@ jobs: platforms: all - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Test Install Nushell on Loong64 run: | docker pull --platform=linux/loong64 ${{ matrix.image }} @@ -94,7 +95,7 @@ jobs: echo 'Acquire::https::Verify-Host "false";' | tee -a /etc/apt/apt.conf.d/99insecure # curl & gpg are not available in debian images, so we install without verifying the gpg key # Add the repository with trusted=yes so that apt does not verify package signatures - echo "deb [trusted=yes] https://apt.fury.io/nushell/ /" | tee /etc/apt/sources.list.d/fury.list + echo "deb [trusted=yes] https://apt.fury.io/nushell/ /" | tee /etc/apt/sources.list.d/fury-nu.list apt update # apt install -y nushell:loongarch64 # Use --force-architecture to override the architecture check diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 36c55d28e..3d107455e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,7 +25,7 @@ jobs: name: Build Nu Pkgs@${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Setup Nushell uses: hustcer/setup-nu@v3 @@ -50,6 +50,7 @@ jobs: run: | use ${{ github.workspace }}/nu/release.nu * version | print + let version = open meta.json | get version echo $env.SIGNING_KEY o> key.gpg # $env | print let arch = match $env.RUNNER_ARCH { @@ -57,7 +58,7 @@ jobs: 'ARM64' => 'arm64', _ => 'amd64' } - fetch release $arch + fetch release $arch $version publish pkg $arch --create-release rm key.gpg @@ -68,7 +69,7 @@ jobs: name: Build Nu Pkgs for Other ARCHs steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Setup Nushell uses: hustcer/setup-nu@v3 @@ -93,10 +94,11 @@ jobs: run: | use ${{ github.workspace }}/nu/release.nu * version | print + let version = open meta.json | get version echo $env.SIGNING_KEY o> key.gpg - fetch release riscv64 + fetch release riscv64 $version publish pkg riscv64 --create-release - fetch release loongarch64 + fetch release loongarch64 $version publish pkg loongarch64 --create-release rm key.gpg @@ -106,7 +108,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Setup Nushell uses: hustcer/setup-nu@v3 - name: Calc Tag and Upload Source Archive diff --git a/.github/workflows/test-msi.yml b/.github/workflows/test-msi.yml index 78a04fa32..a50109ce7 100644 --- a/.github/workflows/test-msi.yml +++ b/.github/workflows/test-msi.yml @@ -21,7 +21,7 @@ on: - '**.md' - 'docs/**' schedule: - - cron: '0 0 * * *' # Run every morning at 0am UTC + - cron: '0 2 * * *' # Run every morning at 2am UTC permissions: contents: read @@ -33,17 +33,19 @@ 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 }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Checkout Nutest Repo - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: - ref: v1.1.0 + # Includes the updated `returns.results` type annotation needed by + # recent Nushell nightlies. + ref: 097ca6839c861f3f9b7d8b702e92d712b621b8dd path: nutest repository: vyadh/nutest sparse-checkout: nutest/ @@ -51,7 +53,9 @@ jobs: - name: Setup Nu uses: hustcer/setup-nu@v3 with: - version: 'nightly' + # This Nu runs nutest. The test itself still downloads and installs + # the latest MSI from nushell/nightly. + version: '0.113.1' - name: Test MSI Install shell: nu {0} @@ -67,49 +71,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' diff --git a/.github/workflows/test-upgrade.yml b/.github/workflows/test-upgrade.yml new file mode 100644 index 000000000..e954ab2a0 --- /dev/null +++ b/.github/workflows/test-upgrade.yml @@ -0,0 +1,72 @@ +# Description: This workflow runs tests for hustcer/deepseek-review. +# REF: +# - https://github.com/vyadh/nutest/blob/main/.github/workflows/tests.yaml +# - https://github.com/fdncred/winget-pkgs/blob/master/doc/manifest/schema/1.10.0/installer.md +# - https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables + +name: Run Nushell Upgrade Tests + +on: + pull_request: + paths-ignore: + - '**.md' + - 'docs/**' + workflow_dispatch: + push: + branches: + - main + - develop + - feature/msi-test + paths-ignore: + - '**.md' + - 'docs/**' + schedule: + - cron: '0 2 * * *' # Run every morning at 2am UTC + +permissions: + contents: read + +jobs: + default: + name: Install and Upgrade Nushell + + strategy: + fail-fast: false + matrix: + os: [windows-latest, windows-2025] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v7 + + - name: Setup Winget + run: | + winget --version + winget settings --enable LocalManifestFiles + winget settings --enable InstallerHashOverride + + - name: Setup Nu + uses: hustcer/setup-nu@v3 + with: + version: '*' + + - name: Install Komac Tool + shell: cmd + run: | + winget install komac --accept-source-agreements --accept-package-agreements --disable-interactivity + + - name: Test Nushell Upgrade + shell: nu {0} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + use ${{ github.workspace }}/tests/test-all.nu * + use ${{ github.workspace }}/tests/winget-install.nu [prepare-manifest] + prepare-manifest + test-winget-per-user-install + test-winget-per-user-upgrade + test-winget-per-machine-install + test-winget-per-machine-upgrade + + diff --git a/.github/workflows/test-winget.yml b/.github/workflows/test-winget.yml index b050c7565..4612741d1 100644 --- a/.github/workflows/test-winget.yml +++ b/.github/workflows/test-winget.yml @@ -21,7 +21,7 @@ on: - '**.md' - 'docs/**' schedule: - - cron: '0 0 * * *' # Run every morning at 0am UTC + - cron: '0 2 * * *' # Run every morning at 2am UTC permissions: contents: read @@ -38,11 +38,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - - - name: Install winget - if: ${{ matrix.os == 'windows-latest' }} - uses: Cyberboss/install-winget@v1 + - uses: actions/checkout@v7 - name: Upgrade Winget run: | @@ -54,7 +50,12 @@ jobs: - name: Setup Nu uses: hustcer/setup-nu@v3 with: - version: 'nightly' + version: '*' + + - name: Install Komac Tool + shell: cmd + run: | + winget install komac --accept-source-agreements --accept-package-agreements --disable-interactivity - name: Test Winget Install with Default Scope shell: nu {0} @@ -74,16 +75,17 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - - - name: Install winget - if: ${{ matrix.os == 'windows-latest' }} - uses: Cyberboss/install-winget@v1 + - uses: actions/checkout@v7 - name: Setup Nu uses: hustcer/setup-nu@v3 with: - version: 'nightly' + version: '*' + + - name: Install Komac Tool + shell: cmd + run: | + winget install komac --accept-source-agreements --accept-package-agreements --disable-interactivity - name: Test Winget Install with User Scope shell: nu {0} @@ -92,40 +94,32 @@ jobs: 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' + 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@v7 + + - name: Setup Nu + uses: hustcer/setup-nu@v3 + with: + version: '*' + + - name: Install Komac Tool + shell: cmd + run: | + winget install komac --accept-source-agreements --accept-package-agreements --disable-interactivity + + - name: Test Winget Install with Machine Scope + shell: nu {0} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + nu tests/winget-install.nu --scope machine diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cbd76f1d3..9343c4dad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,10 +50,13 @@ jobs: - fedora:39 - rockylinux:9 - rockylinux:8 + - redhat/ubi10:latest - redhat/ubi9:latest - redhat/ubi8:latest - - almalinux:latest + - almalinux:10 + - almalinux:9 - almalinux:8 + - openeuler/openeuler:25.03 - openeuler/openeuler:latest - openeuler/openeuler:22.03-lts runs-on: ${{ matrix.os }} @@ -71,7 +74,7 @@ jobs: dnf install -y nushell nu -c 'version' - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Run Tests run: nu nu/tests.nu @@ -85,13 +88,13 @@ jobs: steps: - name: Test Install Nushell DEB Package run: | - curl -fsSL https://apt.fury.io/nushell/gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/fury-nushell.gpg - echo "deb https://apt.fury.io/nushell/ /" | sudo tee /etc/apt/sources.list.d/fury.list + wget -qO- https://apt.fury.io/nushell/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/fury-nushell.gpg + echo "deb [signed-by=/etc/apt/keyrings/fury-nushell.gpg] https://apt.fury.io/nushell/ /" | sudo tee /etc/apt/sources.list.d/fury-nu.list sudo apt update sudo apt install nushell nu -c 'version' - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Run Tests run: nu nu/tests.nu @@ -110,7 +113,7 @@ jobs: pacman -U --noconfirm nushell.pkg.tar.zst nu -c 'version' - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Run Tests run: nu nu/tests.nu @@ -135,12 +138,12 @@ jobs: echo 'Acquire::https::Verify-Host "false";' | tee -a /etc/apt/apt.conf.d/99insecure # curl & gpg are not available in debian images, so we install without verifying the gpg key # Add the repository with trusted=yes so that apt does not verify package signatures - echo "deb [trusted=yes] https://apt.fury.io/nushell/ /" | tee /etc/apt/sources.list.d/fury.list + echo "deb [trusted=yes] https://apt.fury.io/nushell/ /" | tee /etc/apt/sources.list.d/fury-nu.list apt update apt install nushell nu -c 'version' - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Run Tests run: nu nu/tests.nu @@ -161,7 +164,7 @@ jobs: platforms: riscv64 - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Test Install Nu on RISC-V run: | docker pull --platform=linux/riscv64 ${{ matrix.image }} @@ -173,7 +176,7 @@ jobs: echo 'Acquire::https::Verify-Host "false";' | tee -a /etc/apt/apt.conf.d/99insecure # curl & gpg are not available in debian images, so we install without verifying the gpg key # Add the repository with trusted=yes so that apt does not verify package signatures - echo "deb [trusted=yes] https://apt.fury.io/nushell/ /" | tee /etc/apt/sources.list.d/fury.list + echo "deb [trusted=yes] https://apt.fury.io/nushell/ /" | tee /etc/apt/sources.list.d/fury-nu.list apt update apt install nushell nu -c 'version' diff --git a/Justfile b/Justfile index e6e0eb690..fdf41d57d 100644 --- a/Justfile +++ b/Justfile @@ -24,7 +24,7 @@ set positional-arguments := true # Used to handle the path separator issue NU_DISTRO_PATH := parent_directory(justfile()) -NU_DIR := parent_directory(`(which nu).path.0`) +NU_DIR := parent_directory(`$nu.current-exe`) _query_plugin := if os_family() == 'windows' { 'nu_plugin_query.exe' } else { 'nu_plugin_query' } # To pass arguments to a dependency, put the dependency @@ -35,6 +35,11 @@ _query_plugin := if os_family() == 'windows' { 'nu_plugin_query.exe' } else { 'n default: @just --list --list-prefix "··· " +# Bump Nushell version for supported Linux distributions +bump *OPTIONS: + @overlay use {{ join(NU_DISTRO_PATH, 'nu', 'bump-ver.nu') }}; \ + bump-version {{OPTIONS}} + # Release a new version for Nushell release *OPTIONS: @overlay use {{ join(NU_DISTRO_PATH, 'nu', 'release.nu') }}; \ diff --git a/README.md b/README.md index 661920f1f..e25b57df9 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Package and release the official Nushell binaries in `deb`, `rpm`, and `apk` etc ## Install Nushell for Ubuntu/Debian ```nu -curl -fsSL https://apt.fury.io/nushell/gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/fury-nushell.gpg -echo "deb https://apt.fury.io/nushell/ /" | sudo tee /etc/apt/sources.list.d/fury.list +wget -qO- https://apt.fury.io/nushell/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/fury-nushell.gpg +echo "deb [signed-by=/etc/apt/keyrings/fury-nushell.gpg] https://apt.fury.io/nushell/ /" | sudo tee /etc/apt/sources.list.d/fury-nu.list sudo apt update sudo apt install nushell which nu diff --git a/cspell.yml b/cspell.yml index c80e8db00..d40383410 100644 --- a/cspell.yml +++ b/cspell.yml @@ -11,13 +11,16 @@ words: - dpkg - hkcu - hklm +- nvim - maint - rsort - cnqoj - ECODE +- KOMAC - riscv - gstat - loong +- keymap - DISTRO - endfor - trixie @@ -30,6 +33,7 @@ words: - nutest - winget - gpgkey +- autocmd - debsign - msiexec - dearmor @@ -38,13 +42,16 @@ words: - Gemfury - hustcer - rsbuild +- APPNAME - ALLUSERS - modeline - gpgcheck - justfile - lefthook - linewise +- keyrings - deepseek +- lspconfig - Cyberboss - softprops - noconfirm @@ -58,5 +65,9 @@ words: - goreleaser - rockylinux - Infinigence +- autoloaded +- Autocommands +- LOCALAPPDATA - MSIINSTALLPERUSER ignorePaths: +- nvim/init.lua 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 deleted file mode 100644 index cedffead2..000000000 --- a/manifests/n/Nushell/Nushell/0.104.1/Nushell.Nushell.installer.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# Created with WinGet Releaser using komac v2.11.2 -# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.9.0.schema.json - -PackageIdentifier: Nushell.Nushell -PackageVersion: 0.104.1 -InstallerLocale: en-US -InstallerType: wix -Scope: user -InstallModes: -- interactive -- silent -- silentWithProgress -UpgradeBehavior: install -Commands: -- nu -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: EF8FDC307EF9BFDC1D6AC50E2C5EF5CF4D232B0D55CC59F27CD73B753091149A - ProductCode: '{E2BC2C5B-BA10-478F-8554-FAE782BA3CBA}' - AppsAndFeaturesEntries: - - DisplayName: Nushell - ProductCode: '{E2BC2C5B-BA10-478F-8554-FAE782BA3CBA}' - 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: 95A9C9BCAB8FEC7E763F3C42380150598C9DB1511746DEF81187D17EDBD4C71B - ProductCode: '{22E058B2-6A33-43F2-8D25-203711F9BF50}' - AppsAndFeaturesEntries: - - DisplayName: Nushell - ProductCode: '{22E058B2-6A33-43F2-8D25-203711F9BF50}' - UpgradeCode: '{82D756D2-19FA-4F09-B10F-64942E89F364}' -ManifestType: installer -ManifestVersion: 1.9.0 diff --git a/manifests/n/Nushell/Nushell/0.105.0/Nushell.Nushell.installer.yaml b/manifests/n/Nushell/Nushell/0.105.0/Nushell.Nushell.installer.yaml new file mode 100644 index 000000000..005e4276c --- /dev/null +++ b/manifests/n/Nushell/Nushell/0.105.0/Nushell.Nushell.installer.yaml @@ -0,0 +1,60 @@ +# Created with WinGet Releaser using komac v2.11.2 +# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.10.0.schema.json + +PackageIdentifier: Nushell.Nushell +PackageVersion: 0.105.0 +InstallerLocale: en-US +InstallerType: wix +InstallModes: +- interactive +- silent +- silentWithProgress +UpgradeBehavior: install +Commands: +- nu +ReleaseDate: 2025-06-10 +InstallationMetadata: + DefaultInstallLocation: nu +Installers: +- Architecture: x64 + Scope: user + InstallerSwitches: + Custom: ALLUSERS=2 MSIINSTALLPERUSER=1 + InstallerUrl: https://github.com/nushell/integrations/releases/download/v0.105.0/nu-0.105.0-x86_64-pc-windows-msvc.msi + InstallerSha256: 3e911c7ef31c3e1c8594911f3462ddd221475a24af30fb814233978331e8f648 + ProductCode: '{E5A818C7-FD84-4011-B147-2ADE34D0F940}' + AppsAndFeaturesEntries: + - DisplayName: Nushell + UpgradeCode: '{82D756D2-19FA-4F09-B10F-64942E89F364}' +- Architecture: x64 + Scope: machine + InstallerSwitches: + Custom: ALLUSERS=1 + InstallerUrl: https://github.com/nushell/integrations/releases/download/v0.105.0/nu-0.105.0-x86_64-pc-windows-msvc.msi + InstallerSha256: 3e911c7ef31c3e1c8594911f3462ddd221475a24af30fb814233978331e8f648 + ProductCode: '{E5A818C7-FD84-4011-B147-2ADE34D0F940}' + AppsAndFeaturesEntries: + - DisplayName: Nushell + UpgradeCode: '{82D756D2-19FA-4F09-B10F-64942E89F364}' +- Architecture: arm64 + Scope: user + InstallerSwitches: + Custom: ALLUSERS=2 MSIINSTALLPERUSER=1 + InstallerUrl: https://github.com/nushell/integrations/releases/download/v0.105.0/nu-0.105.0-aarch64-pc-windows-msvc.msi + InstallerSha256: fccb3ce296a181df205c5d5a0081b976f822228b5ac2a2b51f3cc1314fc2b665 + ProductCode: '{F7F161F2-F0BD-46EF-90D7-602FF59C5A8D}' + AppsAndFeaturesEntries: + - DisplayName: Nushell + UpgradeCode: '{82D756D2-19FA-4F09-B10F-64942E89F364}' +- Architecture: arm64 + Scope: machine + InstallerSwitches: + Custom: ALLUSERS=1 + InstallerUrl: https://github.com/nushell/integrations/releases/download/v0.105.0/nu-0.105.0-aarch64-pc-windows-msvc.msi + InstallerSha256: fccb3ce296a181df205c5d5a0081b976f822228b5ac2a2b51f3cc1314fc2b665 + ProductCode: '{F7F161F2-F0BD-46EF-90D7-602FF59C5A8D}' + AppsAndFeaturesEntries: + - DisplayName: Nushell + UpgradeCode: '{82D756D2-19FA-4F09-B10F-64942E89F364}' +ManifestType: installer +ManifestVersion: 1.10.0 diff --git a/manifests/n/Nushell/Nushell/0.105.0/Nushell.Nushell.locale.en-US.yaml b/manifests/n/Nushell/Nushell/0.105.0/Nushell.Nushell.locale.en-US.yaml new file mode 100644 index 000000000..f3593dbf8 --- /dev/null +++ b/manifests/n/Nushell/Nushell/0.105.0/Nushell.Nushell.locale.en-US.yaml @@ -0,0 +1,32 @@ +# Created with WinGet Releaser using komac v2.11.2 +# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.10.0.schema.json + +PackageIdentifier: Nushell.Nushell +PackageVersion: 0.105.0 +PackageLocale: en-US +Publisher: The Nushell Project Developers +PublisherUrl: https://www.nushell.sh/ +PublisherSupportUrl: https://github.com/nushell/nushell/issues +Author: The Nushell Project Developers +PackageName: nu +PackageUrl: https://github.com/nushell/nushell +License: MIT +LicenseUrl: https://github.com/nushell/nushell/blob/HEAD/LICENSE +Copyright: Copyright (c) 2019 - 2025 The Nushell Project Developers +CopyrightUrl: https://raw.githubusercontent.com/nushell/nushell/main/LICENSE +ShortDescription: A new type of shell +Description: |- + Hello, and welcome to the Nushell project. + The goal of this project is to take the Unix philosophy of shells, where pipes connect simple commands together, and bring it to the modern style of development. + Nu takes cues from a lot of familiar territory, traditional shells like bash, object based shells like PowerShell, functional programming, systems programming, and more. +Moniker: nushell +Tags: +- rust +- shell +ReleaseNotes: |- + This is the 0.105.0 release of Nushell. You can learn more about this release here: https://www.nushell.sh/blog/2025-06-10-nushell_0_105_0.html + For convenience, we are providing full builds for Windows, Linux, and macOS. Be sure you have the requirements to enable all capabilities: https://www.nushell.sh/book/installation.html#dependencies + This release was made possible by PR contributions from @132ikl, @app/dependabot, @atahabaki, @ayax79, @Bahex, @blindFS, @cablehead, @Cattle0Horse, @colececil, @cptpiepmatz, @CSharperMantle, @Dorumin, @fdncred, @FlippinBerger, @flovilmart, @gmr458, @hackeryarn, @hustcer, @jjflash95, @kamek-pf, @Kissaki, @kumarUjjawal, @lazenga, @LazyPluto, @liquid-dragons, @LoicRiegel, @luismeyer95, @luong-komorebi, @Mrfiregem, @musicinmybrain, @new-years-eve, @noahfraiture, @ofek, @pyz4, @raoulkent, @rritik772, @sholderbach, @snickerdoodle2, @tindzk, @Tyarel8, @Villa01, @vivainio, @weirdan, @WindSoilder, @ysthakur, @zhiburt +ReleaseNotesUrl: https://github.com/nushell/nushell/releases/tag/0.105.0 +ManifestType: defaultLocale +ManifestVersion: 1.10.0 diff --git a/manifests/n/Nushell/Nushell/0.104.1/Nushell.Nushell.yaml b/manifests/n/Nushell/Nushell/0.105.0/Nushell.Nushell.yaml similarity index 70% rename from manifests/n/Nushell/Nushell/0.104.1/Nushell.Nushell.yaml rename to manifests/n/Nushell/Nushell/0.105.0/Nushell.Nushell.yaml index 411858959..0a9d89508 100644 --- a/manifests/n/Nushell/Nushell/0.104.1/Nushell.Nushell.yaml +++ b/manifests/n/Nushell/Nushell/0.105.0/Nushell.Nushell.yaml @@ -1,8 +1,8 @@ # Created with WinGet Releaser using komac v2.11.2 -# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.9.0.schema.json +# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.10.0.schema.json PackageIdentifier: Nushell.Nushell -PackageVersion: 0.104.1 +PackageVersion: 0.105.0 DefaultLocale: en-US ManifestType: version -ManifestVersion: 1.9.0 +ManifestVersion: 1.10.0 diff --git a/manifests/n/Nushell/Nushell/0.105.1/Nushell.Nushell.installer.yaml b/manifests/n/Nushell/Nushell/0.105.1/Nushell.Nushell.installer.yaml new file mode 100644 index 000000000..f72baffe2 --- /dev/null +++ b/manifests/n/Nushell/Nushell/0.105.1/Nushell.Nushell.installer.yaml @@ -0,0 +1,60 @@ +# Created with WinGet Releaser using komac v2.11.2 +# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.10.0.schema.json + +PackageIdentifier: Nushell.Nushell +PackageVersion: 0.105.1 +InstallerLocale: en-US +InstallerType: wix +InstallModes: +- interactive +- silent +- silentWithProgress +UpgradeBehavior: install +Commands: +- nu +ReleaseDate: 2025-06-10 +InstallationMetadata: + DefaultInstallLocation: nu +Installers: +- Architecture: x64 + Scope: user + InstallerSwitches: + Custom: ALLUSERS=2 MSIINSTALLPERUSER=1 + InstallerUrl: https://github.com/nushell/integrations/releases/download/v0.105.1/nu-0.105.1-x86_64-pc-windows-msvc.msi + InstallerSha256: f60bcba3674d737bc8f2ce8a47b6bd9599a846806125795024059f68b3f70565 + ProductCode: '{DEE37CEE-80F7-42E4-95ED-92A6E12E19B1}' + AppsAndFeaturesEntries: + - DisplayName: Nushell + UpgradeCode: '{82D756D2-19FA-4F09-B10F-64942E89F364}' +- Architecture: x64 + Scope: machine + InstallerSwitches: + Custom: ALLUSERS=1 + InstallerUrl: https://github.com/nushell/integrations/releases/download/v0.105.1/nu-0.105.1-x86_64-pc-windows-msvc.msi + InstallerSha256: f60bcba3674d737bc8f2ce8a47b6bd9599a846806125795024059f68b3f70565 + ProductCode: '{DEE37CEE-80F7-42E4-95ED-92A6E12E19B1}' + AppsAndFeaturesEntries: + - DisplayName: Nushell + UpgradeCode: '{82D756D2-19FA-4F09-B10F-64942E89F364}' +- Architecture: arm64 + Scope: user + InstallerSwitches: + Custom: ALLUSERS=2 MSIINSTALLPERUSER=1 + InstallerUrl: https://github.com/nushell/integrations/releases/download/v0.105.1/nu-0.105.1-aarch64-pc-windows-msvc.msi + InstallerSha256: 419e293bb80bbce828ce4c8a323cba6125b8d18e1cc549aa847b480659fe300c + ProductCode: '{61785607-1DF2-4C66-BC98-B01E757FCBB4}' + AppsAndFeaturesEntries: + - DisplayName: Nushell + UpgradeCode: '{82D756D2-19FA-4F09-B10F-64942E89F364}' +- Architecture: arm64 + Scope: machine + InstallerSwitches: + Custom: ALLUSERS=1 + InstallerUrl: https://github.com/nushell/integrations/releases/download/v0.105.1/nu-0.105.1-aarch64-pc-windows-msvc.msi + InstallerSha256: 419e293bb80bbce828ce4c8a323cba6125b8d18e1cc549aa847b480659fe300c + ProductCode: '{61785607-1DF2-4C66-BC98-B01E757FCBB4}' + AppsAndFeaturesEntries: + - DisplayName: Nushell + UpgradeCode: '{82D756D2-19FA-4F09-B10F-64942E89F364}' +ManifestType: installer +ManifestVersion: 1.10.0 diff --git a/manifests/n/Nushell/Nushell/0.104.1/Nushell.Nushell.locale.en-US.yaml b/manifests/n/Nushell/Nushell/0.105.1/Nushell.Nushell.locale.en-US.yaml similarity index 57% rename from manifests/n/Nushell/Nushell/0.104.1/Nushell.Nushell.locale.en-US.yaml rename to manifests/n/Nushell/Nushell/0.105.1/Nushell.Nushell.locale.en-US.yaml index 331279c75..d4a7acf15 100644 --- a/manifests/n/Nushell/Nushell/0.104.1/Nushell.Nushell.locale.en-US.yaml +++ b/manifests/n/Nushell/Nushell/0.105.1/Nushell.Nushell.locale.en-US.yaml @@ -1,18 +1,18 @@ # Created with WinGet Releaser using komac v2.11.2 -# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.9.0.schema.json +# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.10.0.schema.json PackageIdentifier: Nushell.Nushell -PackageVersion: 0.104.1 +PackageVersion: 0.105.1 PackageLocale: en-US Publisher: The Nushell Project Developers PublisherUrl: https://www.nushell.sh/ PublisherSupportUrl: https://github.com/nushell/nushell/issues -Author: The Nu Project Contributors +Author: The Nushell Project Developers PackageName: nu PackageUrl: https://github.com/nushell/nushell License: MIT LicenseUrl: https://github.com/nushell/nushell/blob/HEAD/LICENSE -Copyright: Copyright (c) 2019 - 2021 Yehuda Katz, Jonathan Turner +Copyright: Copyright (c) 2019 - 2025 The Nushell Project Developers CopyrightUrl: https://raw.githubusercontent.com/nushell/nushell/main/LICENSE ShortDescription: A new type of shell Description: |- @@ -24,9 +24,9 @@ Tags: - rust - shell ReleaseNotes: |- - This is the 0.104.0 release of Nushell. You can learn more about this release here: https://www.nushell.sh/blog/2025-04-29-nushell_0_104_0.html + This is the 0.105.1 release of Nushell. You can learn more about this release here: https://www.nushell.sh/blog/2025-06-10-nushell_0_105_1.html For convenience, we are providing full builds for Windows, Linux, and macOS. Be sure you have the requirements to enable all capabilities: https://www.nushell.sh/book/installation.html#dependencies - This release was made possible by PR contributions from @0x4D5352, @132ikl, @app/dependabot, @AucaCoyan, @ayax79, @Bahex, @blindFS, @cosineblast, @cptpiepmatz, @fdncred, @fennewald, @g2p, @hfrentzel, @hustcer, @IanManske, @jjflash95, @kidrigger, @lazenga, @LoicRiegel, @migraine-user, @MMesch, @mokurin000, @Mrfiregem, @mztikk, @NotTheDr01ds, @pyz4, @scarlet-storm, @sebasnallar, @sgvictorino, @sholderbach, @SkillFlame, @suimong, @Tyarel8, @vansh284, @whiter001, @WindSoilder, @ysthakur, @zhiburt -ReleaseNotesUrl: https://github.com/nushell/nightly/releases/tag/v0.104.1 + This release was made possible by PR contributions from @cptpiepmatz +ReleaseNotesUrl: https://github.com/nushell/nushell/releases/tag/0.105.1 ManifestType: defaultLocale -ManifestVersion: 1.9.0 +ManifestVersion: 1.10.0 diff --git a/manifests/n/Nushell/Nushell/0.105.1/Nushell.Nushell.yaml b/manifests/n/Nushell/Nushell/0.105.1/Nushell.Nushell.yaml new file mode 100644 index 000000000..988343d3e --- /dev/null +++ b/manifests/n/Nushell/Nushell/0.105.1/Nushell.Nushell.yaml @@ -0,0 +1,8 @@ +# Created with WinGet Releaser using komac v2.11.2 +# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.10.0.schema.json + +PackageIdentifier: Nushell.Nushell +PackageVersion: 0.105.1 +DefaultLocale: en-US +ManifestType: version +ManifestVersion: 1.10.0 diff --git a/meta.json b/meta.json index bff379f65..968fb321f 100644 --- a/meta.json +++ b/meta.json @@ -1,7 +1,7 @@ { "name": "nushell", - "version": "0.104.0", - "revision": "0", + "version": "0.114.1", + "revision": 0, "pkgs": { "deb": true, "rpm": true, @@ -13,4 +13,4 @@ "github": "https://github.com/nushell/nushell", "home": "https://www.nushell.sh", "description": "A new type of shell." -} +} \ No newline at end of file diff --git a/nu/bump-ver.nu b/nu/bump-ver.nu new file mode 100644 index 000000000..c9f19a79f --- /dev/null +++ b/nu/bump-ver.nu @@ -0,0 +1,37 @@ +#!/usr/bin/env nu + +# TODO: +# - [√] Check if the tag of the specified version already exists in local git repository + +export def bump-version [ + version: string, + --revision: int = 0, # Revision number for the version, default is 0 +] { + if not ($version | str replace -ar '^(\d+\.)?(\d+\.)?(\*|\d+)$' '' | is-empty) { + print $'(ansi r)Invalid version number: ($version)(ansi reset)' + exit 7 + } + + if (has-ref $'($version)-($revision)') { + print $'(ansi r)The tag of the specified version already exists: ($version)(ansi reset)' + exit 5 + } + + open meta.json + | update version $version + | update revision $revision + | save -f meta.json + git commit -am $'chore: bump version to ($version) of revision ($revision)' + git tag -am $'chore: bump version to ($version)' $'($version)-($revision)' + git push --follow-tags +} + +# Check if a git repo has the specified ref: could be a branch or tag, etc. +export def has-ref [ + ref: string # The git ref to check +] { + let checkRepo = git rev-parse --is-inside-work-tree | complete + if not ($checkRepo.stdout =~ 'true') { return false } + let parse = do { ^git rev-parse --verify -q $ref | complete } + ($parse.stdout | is-not-empty) +} diff --git a/nu/release.nu b/nu/release.nu index 8d630643c..974cb02a5 100644 --- a/nu/release.nu +++ b/nu/release.nu @@ -24,7 +24,8 @@ const RELEASE_QUERY_URL = 'https://api.github.com/repos/nushell/nushell/releases # Fetch the latest Nushell release package from GitHub export def 'fetch release' [ - arch: string, # The target architecture, e.g. amd64 & arm64 + arch: string, # The target architecture, e.g. amd64 & arm64 + version: string, # The Nushell version to fetch, e.g. 0.105.0 ] { const ARCH_MAP = { amd64: 'x86_64-unknown-linux-musl', @@ -41,7 +42,8 @@ export def 'fetch release' [ ] let assets = http get -H $BASE_HEADER $RELEASE_QUERY_URL | sort-by -r created_at - | select name created_at assets + | select name tag_name created_at assets + | where tag_name =~ $version | get 0 | get assets.browser_download_url let download_url = $assets | where $it =~ ($ARCH_MAP | get $arch) | get 0 @@ -92,7 +94,9 @@ def create-github-release [ let repo = 'nushell/integrations' let releases = gh release list -R $repo --json name | from json | get name if $version not-in $releases { - gh release create $version -R $repo --title $version + # Use try/catch to handle the race condition when multiple parallel jobs + # try to create the same release simultaneously + try { gh release create $version -R $repo --title $version } } # --clobber Overwrite existing assets of the same name if $arch in $ALPINE_IGNORE { @@ -108,7 +112,7 @@ export def 'push pkg' [ ] { # Normalize architecture based on alias map if needed let normalized_arch = if $type in [apk, rpm] { - $ARCH_ALIAS_MAP | get -i $arch | default $arch + $ARCH_ALIAS_MAP | get -o $arch | default $arch } else { $arch } # Get package file based on architecture and type @@ -135,7 +139,7 @@ export def 'pkg exists' [ } let versions = fury versions $'($type):nushell' -a nushell --api-token $env.GEMFURY_TOKEN | complete | get stdout | lines - | skip 3 | str join "\n" | detect columns + | skip 3 | str join "\n" | detect columns --guess let revision = $env.NU_VERSION_REVISION? | default 0 | into int let rev = if $type == 'alpine' { $'r($revision)' } else { $revision } let ver = if $revision > 0 { $'($env.NU_VERSION)-($rev)' } else { $env.NU_VERSION } diff --git a/nu/rewinged.nu b/nu/rewinged.nu new file mode 100644 index 000000000..e007e8394 --- /dev/null +++ b/nu/rewinged.nu @@ -0,0 +1,7 @@ +( + docker run + -p 8080:8080 + -e REWINGED_LISTEN='0.0.0.0:8080' + -v $'(pwd)/manifests:/packages:ro' + ghcr.io/jantari/rewinged:latest +) diff --git a/nu/tests.nu b/nu/tests.nu index 1d160f57a..9e1d6bb30 100644 --- a/nu/tests.nu +++ b/nu/tests.nu @@ -1,13 +1,8 @@ #!/usr/bin/env nu -# Description: -# This script is used to test the Docker image of termix-nu. -# Usage: -# Change to the directory where the Dockerfile is located and run: -# docker run -it --rm -v $"(pwd):/work" hustcer/termix:latest-alpine /work/tests/test-docker.nu -use std assert +use std/assert -const NU_VERSION = '0.104.0' +const NU_VERSION = '0.105.0' def main [] { let test_plan = ( @@ -72,16 +67,20 @@ def run_test [test: record]: nothing -> record $y { return 1 } if $x < $y { return (-1) } } diff --git a/scripts/post-install.nu b/scripts/post-install.nu index fb6805a58..3858f76c2 100755 --- a/scripts/post-install.nu +++ b/scripts/post-install.nu @@ -32,10 +32,18 @@ def 'setup-plugins' [] { # Add /usr/bin/nu to /etc/shells if it's not already there def 'add-shells' [] { - let shells = open /etc/shells - if not ($shells =~ $'/usr/bin/nu') { - echo $'/usr/bin/nu(char nl)' o>> /etc/shells + let content = open /etc/shells + const nu_bin = '/usr/bin/nu' + if ($content | str contains $nu_bin) { + return } + mut $new_line = $"($nu_bin)\n" + # Handle edge case when the content doesn't have ending newline, + # blindly appending the $new_line will end up writing to the same line. + if not ($content | str ends-with "\n") { + $new_line = "\n" ++ $new_line + } + echo $new_line o>> /etc/shells } def main [] { diff --git a/scripts/post-install.sh b/scripts/post-install.sh index 25cbb2717..4e096e597 100644 --- a/scripts/post-install.sh +++ b/scripts/post-install.sh @@ -2,4 +2,17 @@ # Author: hustcer # Created: 2025/02/25 18:55:20 +set -e + +# Running nu in the rpm-ostree script environment fails if the config directory +# doesn't exist, preventing the post-install.nu script from being run. +if [ -n "${XDG_CONFIG_HOME+x}" ]; then + mkdir -p "$XDG_CONFIG_HOME" +elif [ -n "${HOME+x}" ]; then + mkdir -p "$HOME/.config" +else + export XDG_CONFIG_HOME="$PWD/.config" + mkdir -p "$XDG_CONFIG_HOME" +fi + nu /usr/libexec/nushell/post-install.nu diff --git a/scripts/pre-remove.nu b/scripts/pre-remove.nu index 862469d56..24c32a7d5 100755 --- a/scripts/pre-remove.nu +++ b/scripts/pre-remove.nu @@ -5,11 +5,13 @@ # Remove /usr/bin/nu from /etc/shells def 'remove-nu-from-shells' [] { - open /etc/shells + let new_content = open /etc/shells | lines | where $it !~ '/usr/bin/nu' | str join "\n" - | save -rf /etc/shells + # Keep a new line at the end of file to prevent other packages from making mistake + # when modifying this file. + $new_content ++ "\n" | save -rf /etc/shells } def main [] { diff --git a/scripts/pre-remove.sh b/scripts/pre-remove.sh index 1fe186a7a..a4ac6261c 100644 --- a/scripts/pre-remove.sh +++ b/scripts/pre-remove.sh @@ -2,4 +2,17 @@ # Author: hustcer # Created: 2025/03/10 08:35:20 +set -e + +# Running nu in the rpm-ostree script environment fails if the config directory +# doesn't exist, preventing the pre-remove.nu script from being run. +if [ -n "${XDG_CONFIG_HOME+x}" ]; then + mkdir -p "$XDG_CONFIG_HOME" +elif [ -n "${HOME+x}" ]; then + mkdir -p "$HOME/.config" +else + export XDG_CONFIG_HOME="$PWD/.config" + mkdir -p "$XDG_CONFIG_HOME" +fi + nu /usr/libexec/nushell/pre-remove.nu diff --git a/tests/common.nu b/tests/common.nu index c1a73a3fc..8937860c1 100644 --- a/tests/common.nu +++ b/tests/common.nu @@ -11,12 +11,12 @@ const BINS = [ nu_plugin_formats.exe, ] -const MACHINE_INSTALL_DIR = 'C:\Program Files\nu' -const USER_INSTALL_DIR = $'($nu.home-path)\AppData\Local\Programs\nu' +export const MACHINE_INSTALL_DIR = 'C:\Program Files\nu' +export const USER_INSTALL_DIR = $'($nu.home-dir)\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' +const PROFILE = $'($nu.home-dir)\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] { @@ -74,7 +74,7 @@ export def check-common-install [install_dir = $USER_INSTALL_DIR: string] { assert greater ($contents | length) 3 assert equal ($PROFILE | path exists) true assert equal ($profile | get profiles.0.icon | path exists) true - assert equal ($profile | get profiles.0.commandline | path exists) true + assert equal ($profile | get profiles.0.commandline | str trim --char '"' | 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 successfully...(ansi reset)' @@ -88,3 +88,16 @@ 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 [] { + let headers = if ($env.GITHUB_TOKEN? | is-not-empty) { + { Authorization: $'Bearer ($env.GITHUB_TOKEN)' } + } else { + {} + } + http get -H $headers https://api.github.com/repos/nushell/nightly/releases + | sort-by -r created_at + | where tag_name =~ nightly + | get tag_name?.0? + | default '' +} diff --git a/tests/test-all.nu b/tests/test-all.nu new file mode 100644 index 000000000..1af95b68f --- /dev/null +++ b/tests/test-all.nu @@ -0,0 +1,112 @@ +# Usage: +# Run the following commands to enable local manifest files and installer hash override with admin privileges: +# winget settings --enable LocalManifestFiles +# winget settings --enable InstallerHashOverride + +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' +const LAST_VERSION = '0.105.1' +const MSI_PKG = 'wix\bin\x64\Release\nu-x64.msi' +const PER_MACHINE_INSTALL_DIR = 'C:\Program Files\nu' +const PER_USER_INSTALL_DIR = $'($nu.home-dir)\AppData\Local\Programs\nu' +const WINGET_ARGS = [ + --silent + --ignore-security-hash + --disable-interactivity + --accept-source-agreements + --accept-package-agreements + ] + +def main [--msi(-m), --local] { + if $msi and $local { + test-msi-per-user-install + test-msi-per-machine-install + } + 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 [] { + try { winget uninstall nushell } catch { } + print $'Using msiexec to test MSI (ansi g)per-user(ansi reset) installation' + print '-------------------------------------------------------------------' + msiexec /i $MSI_PKG MSIINSTALLPERUSER=1 /quiet /qn /L*V install.txt + check-user-install $PER_USER_INSTALL_DIR + check-version-match $VERSION $PER_USER_INSTALL_DIR + winget list nushell --accept-source-agreements +} + +export def test-msi-per-machine-install [] { + try { winget uninstall nushell } catch { } + print $'(char nl)Using msiexec to test MSI (ansi g)machine scope(ansi reset) installation' + print '-------------------------------------------------------------------' + msiexec /i $MSI_PKG ALLUSERS=1 /L*V install.txt + check-local-machine-install + check-version-match $VERSION $PER_MACHINE_INSTALL_DIR + winget list nushell --accept-source-agreements +} + +export def test-winget-per-user-install [--local] { + try { winget uninstall nushell } catch { } + print $'(char nl)Using winget to test MSI (ansi g)user scope(ansi reset) installation' + print '-------------------------------------------------------------------' + 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 + winget list nushell --accept-source-agreements +} + +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 + 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 + winget list nushell --accept-source-agreements +} + +export def test-winget-per-machine-install [--local] { + try { winget uninstall nushell } catch { } + print $'(char nl)Using winget to test MSI (ansi g)machine scope(ansi reset) installation' + print '-------------------------------------------------------------------' + 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 + winget list nushell --accept-source-agreements +} + +export def test-winget-per-machine-upgrade [--local] { + print $'(char nl)Using winget to test MSI (ansi g)machine scope(ansi reset) upgrade' + print '-------------------------------------------------------------------' + 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 + winget list nushell --accept-source-agreements +} diff --git a/tests/test-msi.nu b/tests/test-msi.nu index 64af20f49..bbff88612 100644 --- a/tests/test-msi.nu +++ b/tests/test-msi.nu @@ -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 } + let install_dir = $'($nu.home-dir)\AppData\Local\Programs\nu' + { msi: $msi, install_dir: $install_dir, release_tag: $release_tag } } @test @@ -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 @@ -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 } + diff --git a/tests/winget-install.nu b/tests/winget-install.nu index ec9791af8..494b453d3 100644 --- a/tests/winget-install.nu +++ b/tests/winget-install.nu @@ -1,19 +1,55 @@ use std/assert -use common.nu [check-user-install, check-version-match] +use std/util ['path add'] +use common.nu [MACHINE_INSTALL_DIR, USER_INSTALL_DIR] +use common.nu [check-user-install, check-local-machine-install, check-version-match, get-latest-tag] -const VERSION = '0.104.1' -def main [--scope: string] { +const KOMAC_PATH = $'($nu.home-dir)\AppData\Local\Programs\Komac\bin\' + +const WINGET_ARGS = [ + --silent + --ignore-security-hash + --disable-interactivity + --accept-source-agreements + --accept-package-agreements + ] - let install_dir = $'($nu.home-path)\AppData\Local\Programs\nu' +def main [--scope: string] { + prepare-manifest 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 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 - check-user-install $install_dir - check-version-match $VERSION $install_dir + winget install --manifest $'manifests\n\Nushell\Nushell\($version)\' ...$WINGET_ARGS ...$scope_arg + if $scope == 'machine' { + check-local-machine-install + check-version-match $version $MACHINE_INSTALL_DIR + return + } + check-user-install $USER_INSTALL_DIR + check-version-match $version $USER_INSTALL_DIR +} + +export 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) +} + +def get-download-url [] { + let headers = if ($env.GITHUB_TOKEN? | is-not-empty) { + { Authorization: $'Bearer ($env.GITHUB_TOKEN)' } + } else { + {} + } + http get -H $headers 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' }