Create SandboxTest script (#827)

* Create SandboxTest script

* Add missing appx dependencies

* Clear temp folder

* Validate manifest before pushing to sandbox

* Fix invalid character in Sandbox.ps1

The dash character in -ExecutionPolicy was a special character which broke the command.

* Download dependencies on the fly

* remove vscode launch file

* Add newline in gitignore

* Fix when there is no temp folder

* Add Test in Sandbox to README

* Add some comments and enhance some messages

* Properly accept mandatory parameter

* Check if Windows Sandbox exist or not

* Fix Sandbox install snippet and typo

* Fix wrong conflict resolution in README

* Upgrade WinGet to v0.1.41821-preview

* Rewrite the whole script

Adding some cool features such as:
- Specify folder to mount (default to current)
- Make Manifest optional, so we can use the script to just start the
  Sandbox and install WinGet
- Add optional Script parameter, to specify which script block to run
  after all the steps inside the Sandbox
- Automatically refresh environment variables after installing the
  Manifest, and leave the function Update-Environment available for the
  users
- Use a temporary folder on system's temp directory, thus deleting the
  .gitignore
- Make Powershell open maximized and without splash messages
- Improve overall UX both in local machine and in the Sandbox
- Close Sandbox automatically if needed
- Upgrade WinGet to latest version

Most of the refactor came from my PR at
https://github.com/chocolatey-community/chocolatey-coreteampackages/pull/1512

* Add tip for Update-Environment

* Fix relative paths on map folder

* Copy the manifest instead of installing from the source

* Fix call without manifest param and enhance logs

* Use VCLibs UWPDesktop from official source and update winget

* Add some missing new lines

* Fetch latest WinGet release automatically

* Add -SkipManifestValidation switch and fix checksum

* Fix TLS issues, handle PowerShell 7, remove unneeded VCLibs dep and fix manifest as folder

* Restore file/folder check for manifest

* Change checksum output filename

* Update Update-EnvironmentVariables function

Co-authored-by: chausner <chausner@users.noreply.github.com>
This commit is contained in:
Felipe Santos
2021-05-03 15:36:36 -03:00
committed by GitHub
parent b694d2ea48
commit 9619e1aa83
2 changed files with 294 additions and 0 deletions

View File

@@ -35,10 +35,20 @@ Although the Windows Package Manager YAML Generator can create YAML files with m
## Test your manifest
Now that you have authored your manifest, you should make sure it works as expected.
### Locally
1) Verify the syntax. You can do that by typing the following command: `winget validate <manifest>`
2) Test the install. You can do that by installing the manifest: `winget install -m <manifest>`
For more details, see [packages](https://docs.microsoft.com/windows/package-manager/package).
### In Windows Sandbox
You can use the [`Tools\SandboxTest.ps1`](Tools/SandboxTest.ps1) script for testing a manifest installation in [Windows Sandbox](https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-sandbox/windows-sandbox-overview). The manifest will be also validated.
Just provide the path to manifest as parameter:
```powershell
.\Tools\SandboxTest.ps1 <path-to-manifest>
```
## Submit your PR
With the manifest verified, you will need to submit a PR. Your manifest should be located in the folder path matching `manifests\<first lower case letter of publisher>\<publisher>\<package>\<version>.yaml`