Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Unpackaged Unit Tests with winget-installed PsExec #4760

Merged
merged 12 commits into from
Aug 29, 2024
32 changes: 22 additions & 10 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -347,18 +347,30 @@
inputs:
packageFeedSelector: 'nugetOrg'

- task: DownloadSecureFile@1
name: PsExec
displayName: 'Download PsExec.exe'
inputs:
secureFile: 'PsExec.exe'
# TODO: Repair-WinGetPackageManager will fail because it tries to install x64 for an x86 build machine.
# Remove manual installation of VCLibs (x64) once this is fixed.
- powershell: |
if ("$(buildPlatform)" -eq "x86") {
iwr https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.appx

Check failure on line 354 in azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Check Spelling

`iwr` is not a recognized word. (unrecognized-spelling)
Add-AppxPackage Microsoft.VCLibs.x64.appx
}
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module Microsoft.WinGet.Client -Repository PSGallery -Force
Repair-WingetPackageManager -AllUsers -Latest
Install-WinGetPackage -Id Microsoft.Sysinternals.PsTools -Source winget
displayName: Install Sysinternals PsTools Using Winget
condition: succeededOrFailed()

- task: CmdLine@2
- powershell: |
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
PsExec -accepteula -s -i $(buildOutDir)\AppInstallerCLITests\AppInstallerCLITests.exe -logto $(artifactsDir)\AICLI-Unpackaged-System.log -s -r junit -o $(artifactsDir)\TEST-AppInstallerCLI-Unpackaged-System.xml
displayName: Run Unit Tests Unpackaged Under System Context
inputs:
script: |
$(PsExec.secureFilePath) -accepteula -s -i $(buildOutDir)\AppInstallerCLITests\AppInstallerCLITests.exe -logto $(artifactsDir)\AICLI-Unpackaged-System.log -s -r junit -o $(artifactsDir)\TEST-AppInstallerCLI-Unpackaged-System.xml
workingDirectory: '$(buildOutDir)\AppInstallerCLITests'
workingDirectory: '$(buildOutDir)\AppInstallerCLITests'
condition: succeededOrFailed()

- powershell: |
Uninstall-WinGetPackage -Id Microsoft.Sysinternals.PsTools -Source winget
displayName: Clean up Sysinternals PsTools
condition: succeededOrFailed()

- task: PowerShell@2
Expand Down
Loading