From 437cce50efbe25e10a869635718d78d5031a0f64 Mon Sep 17 00:00:00 2001 From: Elliot Chernofsky <35854880+emtuls@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:53:59 -0500 Subject: [PATCH] Add microsoft-windows-terminal.vm --- .github/workflows/ci.yml | 11 +++++++++-- .../microsoft-windows-terminal.vm.nuspec | 13 +++++++++++++ .../tools/chocolateyinstall.ps1 | 15 +++++++++++++++ .../tools/chocolateyuninstall.ps1 | 8 ++++++++ scripts/test/lint.py | 1 + 5 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 packages/microsoft-windows-terminal.vm/microsoft-windows-terminal.vm.nuspec create mode 100644 packages/microsoft-windows-terminal.vm/tools/chocolateyinstall.ps1 create mode 100644 packages/microsoft-windows-terminal.vm/tools/chocolateyuninstall.ps1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca23b7dd8..2a38fc551 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,17 +38,24 @@ jobs: - name: Build and test all modified packages id: test # It runs only if there are modified files + # We specifically test for "microsoft-windows-terminal.vm" in 'windows-2019' because it requires at least Windows 10 version 1903/OS build 18362 if: steps.files.outputs.added_modified_renamed != '' run: | + $os = "${{ matrix.os }}" $packages = "${{ steps.files.outputs.added_modified_renamed }}".Split(" ") | Foreach-Object { (Get-Item $_).Directory.Name } - scripts/test/test_install.ps1 "common.vm $packages" + if ($os -eq 'windows-2019') { + $excludedPackages = @("microsoft-windows-terminal.vm") + $packages = $packages | Where-Object { $_ -notin $excludedPackages } + } + $packages = ("common.vm " + $packages -join " ").Trim() + scripts/test/test_install.ps1 "$packages" - name: Upload logs to artifacts uses: ./.github/actions/upload-logs if: always() - name: Push all built packages to MyGet # Only push packages on master if they were built (not if testing was skipped) and # only with one version of Windows (otherwise it would be pushed 3 times) - if: steps.test.outcome == 'success' && github.event_name == 'push' && matrix.os == 'windows-2019' + if: steps.test.outcome == 'success' && github.event_name == 'push' && matrix.os == 'windows-2022' run: | $built_pkgs = Get-ChildItem built_pkgs Set-Location built_pkgs diff --git a/packages/microsoft-windows-terminal.vm/microsoft-windows-terminal.vm.nuspec b/packages/microsoft-windows-terminal.vm/microsoft-windows-terminal.vm.nuspec new file mode 100644 index 000000000..5a5ccb0da --- /dev/null +++ b/packages/microsoft-windows-terminal.vm/microsoft-windows-terminal.vm.nuspec @@ -0,0 +1,13 @@ + + + + microsoft-windows-terminal.vm + 1.18.3181 + Microsoft + Windows Terminal is a new, modern, feature-rich, productive terminal application for command-line users. + + + + + + diff --git a/packages/microsoft-windows-terminal.vm/tools/chocolateyinstall.ps1 b/packages/microsoft-windows-terminal.vm/tools/chocolateyinstall.ps1 new file mode 100644 index 000000000..0755b02f1 --- /dev/null +++ b/packages/microsoft-windows-terminal.vm/tools/chocolateyinstall.ps1 @@ -0,0 +1,15 @@ +$ErrorActionPreference = 'Stop' +Import-Module vm.common -Force -DisableNameChecking + +try { + $toolName = 'Microsoft Windows Terminal' + $executablePath = '%LocalAppData%\Microsoft\WindowsApps\wt.exe' + + $shortcutDir = ${Env:RAW_TOOLS_DIR} + $shortcut = Join-Path $shortcutDir "$toolName.lnk" + # Create an admin shortcut that we can pin to the taskbar (analogous to the Admin Command Prompt for cmd.exe). + Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $executablePath -RunAsAdmin + VM-Assert-Path $shortcut +} catch { + VM-Write-Log-Exception $_ +} \ No newline at end of file diff --git a/packages/microsoft-windows-terminal.vm/tools/chocolateyuninstall.ps1 b/packages/microsoft-windows-terminal.vm/tools/chocolateyuninstall.ps1 new file mode 100644 index 000000000..5889e0e4e --- /dev/null +++ b/packages/microsoft-windows-terminal.vm/tools/chocolateyuninstall.ps1 @@ -0,0 +1,8 @@ +$ErrorActionPreference = 'Continue' +Import-Module vm.common -Force -DisableNameChecking + +$toolName = 'Microsoft Windows Terminal' +$shortcutDir = ${Env:RAW_TOOLS_DIR} +$shortcut = Join-Path $shortcutDir "$toolName.lnk" + +Remove-Item $shortcut -Force -ea 0 | Out-Null \ No newline at end of file diff --git a/scripts/test/lint.py b/scripts/test/lint.py index 23cfacc4b..789cd48cd 100644 --- a/scripts/test/lint.py +++ b/scripts/test/lint.py @@ -319,6 +319,7 @@ class UsesInvalidCategory(Lint): "installer.vm", "libraries.python2.vm", "libraries.python3.vm", + "microsoft-windows-terminal.vm", "notepadplusplus.vm", "notepadpp.plugin.", "npcap.vm",