winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

azure-pipelines.yml (24948B)


      1 # Commit triggers
      2 trigger:
      3 - master
      4 
      5 # PR triggers
      6 pr:
      7   branches:
      8     include:
      9     - master
     10   paths:
     11     include:
     12     - azure-pipelines.yml
     13     - templates/*
     14     - src/*
     15     - schemas/JSON/manifests/*
     16 
     17 pool:
     18   vmImage: 'windows-2025'
     19 
     20 variables:
     21   solution: 'src\AppInstallerCLI.sln'
     22   EnableDetectorVcpkg: true
     23 
     24 # Do not set the build version for a PR build.
     25 
     26 jobs:
     27 - job: 'GetReleaseTag'
     28   condition: not(eq(variables['Build.Reason'], 'PullRequest'))
     29   variables:
     30     runCodesignValidationInjection: ${{ false }}
     31     skipComponentGovernanceDetection: ${{ true }}
     32   steps:
     33   - task: PowerShell@2
     34     name: 'GetTag'
     35     displayName: Get Release Tag
     36     inputs:
     37       filePath: 'src\binver\Update-BinVer.ps1'
     38       arguments: '-OutVar'
     39       workingDirectory: 'src'
     40 
     41 # Build job creates artifacts for use in test jobs
     42 
     43 - job: 'Build'
     44   timeoutInMinutes: 120
     45   dependsOn: 'GetReleaseTag'
     46   condition: always()
     47 
     48   strategy:
     49     matrix:
     50       x86_release:
     51         buildConfiguration: 'Release'
     52         buildPlatform: 'x86'
     53         artifactIdentifier: 'x86release'
     54       x64_release:
     55         buildConfiguration: 'Release'
     56         buildPlatform: 'x64'
     57         artifactIdentifier: 'x64release'
     58 
     59   variables:
     60     BuildVer: $[counter(dependencies.GetReleaseTag.outputs['GetTag.tag'], 1)]
     61     buildOutDir: $(Build.SourcesDirectory)\src\$(buildPlatform)\$(buildConfiguration)
     62     buildOutDirAnyCpu: $(Build.SourcesDirectory)\src\AnyCPU\$(buildConfiguration)
     63     artifactsDir: $(Build.ArtifactStagingDirectory)\$(buildPlatform)
     64     appxPackageDir: $(Build.ArtifactStagingDirectory)\$(buildPlatform)\AppxPackages
     65 
     66   steps:
     67   - task: NuGetToolInstaller@1
     68     displayName: Install Nuget
     69 
     70   # Restores all projects, including native (vcxproj) projects
     71   - task: NuGetCommand@2
     72     displayName: Restore Solution
     73     inputs:
     74       restoreSolution: '$(solution)'
     75 
     76   # Restore these UAP packages as https://github.com/NuGet/Home/issues/7796 leads to all UAP packages being skipped for restore.
     77   # Even though they don't need any actual restore action, they need the project.assets.json file to be created and a direct restore does that.
     78   - task: NuGetCommand@2
     79     displayName: Restore AppInstallerCLIPackage
     80     inputs:
     81       restoreSolution: 'src\AppInstallerCLIPackage\AppInstallerCLIPackage.wapproj'
     82 
     83   - task: NuGetCommand@2
     84     displayName: Restore AppInstallerTestMsixInstaller
     85     inputs:
     86       restoreSolution: 'src\AppInstallerTestMsixInstaller\AppInstallerTestMsixInstaller.wapproj'
     87 
     88   # Restores only .NET core projects, but is still necessary, as without this the IndexCreationTool and LocalhostWebServer projects fail to build
     89   - task: DotNetCoreCLI@2
     90     displayName: DotNet Restore
     91     inputs:
     92       command: 'restore'
     93       projects: '**/*.csproj'
     94 
     95   - task: CmdLine@2
     96     displayName: Enable Vcpkg Install
     97     inputs:
     98       script: |
     99         $(VCPKG_INSTALLATION_ROOT)\vcpkg.exe integrate install
    100       workingDirectory: '$(VCPKG_INSTALLATION_ROOT)'
    101 
    102   - task: PowerShell@2
    103     displayName: Update Binary Version
    104     condition: not(eq(variables['Build.Reason'], 'PullRequest'))
    105     inputs:
    106       filePath: 'src\binver\Update-BinVer.ps1'
    107       arguments: '-TargetFile binver\binver\version.h -BuildVersion $(BuildVer)'
    108       workingDirectory: 'src'
    109 
    110   # Build all solutions in the root directory.
    111   - task: VSBuild@1
    112     displayName: Build Solution
    113     inputs:
    114       platform: '$(buildPlatform)'
    115       solution: '$(solution)'
    116       configuration: '$(buildConfiguration)'
    117       msbuildArgs: '/bl:$(artifactsDir)\msbuild.binlog
    118                     /p:AppxBundlePlatforms="$(buildPlatform)"
    119                     /p:AppxPackageDir="$(appxPackageDir)"
    120                     /p:AppxBundle=Always
    121                     /p:UapAppxPackageBuildMode=SideloadOnly'
    122       maximumCpuCount: true
    123 
    124   - task: MSBuild@1
    125     displayName: Build MSIX Test Installer File
    126     inputs:
    127       platform: '$(buildPlatform)'
    128       solution: 'src\AppInstallerTestMsixInstaller\AppInstallerTestMsixInstaller.wapproj'
    129       configuration: '$(buildConfiguration)'
    130       msbuildArguments: '/p:AppxPackageOutput="$(Build.ArtifactStagingDirectory)\AppInstallerTestMsixInstaller.msix"
    131                          /p:AppxBundle=Never
    132                          /p:UapAppxPackageBuildMode=SideLoadOnly
    133                          /p:AppxPackageSigningEnabled=false'
    134       maximumCpuCount: true
    135 
    136   - task: CopyFiles@2
    137     displayName: Copy vcpkg logs
    138     inputs:
    139       SourceFolder: $(VCPKG_INSTALLATION_ROOT)\buildtrees
    140       Contents: '**\*.log'
    141       TargetFolder: '$(artifactsDir)\vcpkgLogs'
    142     condition: succeededOrFailed()
    143 
    144   - task: CopyFiles@2
    145     displayName: 'Copy specific build artifacts'
    146     inputs:
    147       Contents: |
    148           $(buildOutDir)\WinGetUtil\WinGetUtil.dll
    149           $(buildOutDir)\WinGetUtil\WinGetUtil.pdb
    150       TargetFolder: '$(artifactsDir)'
    151 
    152   - task: PowerShell@2
    153     displayName: Create Package Layout
    154     inputs:
    155       filePath: 'src\AppInstallerCLIPackage\Execute-AppxRecipe.ps1'
    156       arguments: '-AppxRecipePath AppInstallerCLIPackage\bin\$(buildPlatform)\$(buildConfiguration)\AppInstallerCLIPackage.build.appxrecipe -LayoutPath $(artifactsDir)\DevPackage -Force -Verbose'
    157       workingDirectory: 'src'
    158 
    159   - task: CopyFiles@2
    160     displayName: 'Copy native binaries for Microsoft.WinGet.Client (net8)'
    161     inputs:
    162       SourceFolder: $(buildOutDir)
    163       Contents: |
    164           Microsoft.Management.Deployment.InProc\Microsoft.Management.Deployment.dll
    165           Microsoft.Management.Deployment\Microsoft.Management.Deployment.winmd
    166           WindowsPackageManager\WindowsPackageManager.dll
    167           UndockedRegFreeWinRT\winrtact.dll
    168       TargetFolder: $(buildOutDirAnyCpu)\PowerShell\Microsoft.WinGet.Client\net8.0-windows10.0.26100.0\SharedDependencies\$(BuildPlatform)
    169       flattenFolders: true
    170 
    171   - task: CopyFiles@2
    172     displayName: 'Copy native binaries for Microsoft.WinGet.Client (net48)'
    173     inputs:
    174       SourceFolder: $(buildOutDir)
    175       Contents: |
    176           Microsoft.Management.Deployment.InProc\Microsoft.Management.Deployment.dll
    177           Microsoft.Management.Deployment\Microsoft.Management.Deployment.winmd
    178           WindowsPackageManager\WindowsPackageManager.dll
    179           UndockedRegFreeWinRT\winrtact.dll
    180       TargetFolder: $(buildOutDirAnyCpu)\PowerShell\Microsoft.WinGet.Client\net48\SharedDependencies\$(BuildPlatform)
    181       flattenFolders: true
    182 
    183   - task: CopyFiles@2
    184     displayName: 'Copy native binaries for Microsoft.WinGet.Configuration'
    185     inputs:
    186       SourceFolder: $(buildOutDir)
    187       Contents: |
    188           Microsoft.Management.Configuration\Microsoft.Management.Configuration.dll
    189       TargetFolder: $(buildOutDirAnyCpu)\PowerShell\Microsoft.WinGet.Configuration\SharedDependencies\$(BuildPlatform)
    190       flattenFolders: true
    191 
    192   - task: CopyFiles@2
    193     displayName: 'Copy managed binaries for Microsoft.WinGet.Configuration in arch specific'
    194     inputs:
    195       SourceFolder: $(buildOutDirAnyCpu)
    196       Contents: |
    197           Microsoft.Management.Configuration.Projection\net8.0-windows10.0.26100.0\Microsoft.Management.Configuration.Projection.dll
    198       TargetFolder: $(buildOutDirAnyCpu)\PowerShell\Microsoft.WinGet.Configuration\SharedDependencies\$(BuildPlatform)
    199       flattenFolders: true
    200 
    201   - task: CopyFiles@2
    202     displayName: 'Copy PowerShell AnyCPU Module Files'
    203     inputs:
    204       SourceFolder: '$(buildOutDirAnyCpu)\PowerShell'
    205       TargetFolder: '$(artifactsDir)\PowerShell'
    206 
    207   - task: CopyFiles@2
    208     displayName: 'Copy binaries'
    209     inputs:
    210       SourceFolder: '$(buildOutDir)'
    211       TargetFolder: '$(artifactsDir)'
    212       Contents: |
    213         AppInstallerCLIE2ETests\**
    214         AppInstallerCLITests\**
    215         Microsoft.Management.Configuration\**
    216         Microsoft.Management.Configuration.UnitTests\**
    217         Microsoft.Management.Configuration.OutOfProc\**
    218 
    219   - task: CopyFiles@2
    220     displayName: 'Copy Files: WinGetUtilInterop.UnitTests'
    221     inputs:
    222       SourceFolder: '$(Build.SourcesDirectory)\src\WinGetUtilInterop.UnitTests\bin\$(buildPlatform)\$(BuildConfiguration)\net8.0'
    223       TargetFolder:  '$(artifactsDir)\WinGetUtilInterop.UnitTests\'
    224       CleanTargetFolder: true
    225       OverWrite: true
    226 
    227   - task: CopyFiles@2
    228     displayName: 'Copy WinGetUtil to WinGetUtilInterop.UnitTests folder'
    229     inputs:
    230       Contents: |
    231           $(buildOutDir)\WinGetUtil\WinGetUtil.dll
    232       TargetFolder: '$(artifactsDir)\WinGetUtilInterop.UnitTests\'
    233       flattenFolders: true
    234 
    235   - task: CopyFiles@2
    236     displayName: 'Copy LocalhostWebServer to E2ETests'
    237     inputs:
    238       SourceFolder: '$(buildOutDir)\LocalhostWebServer'
    239       TargetFolder: '$(artifactsDir)\E2ETests\LocalhostWebServer'
    240 
    241     # Invoke E2E setup to generate the TestLocalIndex; could optimize out some of its steps if needed
    242   - template: templates/e2e-setup.yml
    243     parameters:
    244       sourceDir: $(Build.SourcesDirectory)
    245       localhostWebServerArgs: '-BuildRoot $(artifactsDir)\E2ETests\LocalhostWebServer -StaticFileRoot $(Agent.TempDirectory)\TestLocalIndex -LocalSourceJson $(Build.SourcesDirectory)\src\AppInstallerCLIE2ETests\TestData\localsource.json -TestDataPath $(Build.SourcesDirectory)\src\AppInstallerCLIE2ETests\TestData -ExitBeforeRun'
    246       signingCertOutDir: $(artifactsDir)\E2ETests
    247 
    248   - task: CopyFiles@2
    249     displayName: 'Copy TestLocalIndex'
    250     inputs:
    251       SourceFolder: '$(Agent.TempDirectory)\TestLocalIndex'
    252       TargetFolder: '$(artifactsDir)\E2ETests\TestLocalIndex'
    253 
    254   - task: CopyFiles@2
    255     displayName: 'Copy TestData'
    256     inputs:
    257       SourceFolder: '$(Build.SourcesDirectory)\src\AppInstallerCLIE2ETests\TestData\'
    258       TargetFolder: '$(artifactsDir)\E2ETests\TestData'
    259 
    260   - task: CopyFiles@2
    261     displayName: 'Copy Dev Package Dependencies'
    262     inputs:
    263       SourceFolder: '$(appxPackageDir)\AppInstallerCLIPackage_0.0.2.0_Test\Dependencies\$(buildPlatform)\'
    264       TargetFolder: '$(artifactsDir)\E2ETests\DevPackageDependencies'
    265 
    266   - task: CopyFiles@2
    267     displayName: 'Copy test scripts to artifacts'
    268     inputs:
    269       Contents: |
    270           $(Build.SourcesDirectory)\src\PowerShell\scripts\Execute-WinGetTests.ps1
    271           $(Build.SourcesDirectory)\src\PowerShell\tests\**
    272           $(Build.SourcesDirectory)\src\LocalhostWebServer\Run-LocalhostWebServer.ps1
    273       TargetFolder: '$(artifactsDir)\E2ETests\Scripts'
    274       flattenFolders: true
    275 
    276   - task: PublishPipelineArtifact@1
    277     displayName: Publish Pipeline Artifacts
    278     inputs:
    279       targetPath: '$(artifactsDir)'
    280       artifact: 'Build.$(artifactIdentifier)'
    281     condition: succeededOrFailed()
    282 
    283   - task: ComponentGovernanceComponentDetection@0
    284     displayName: Component Governance
    285     inputs:
    286       scanType: 'Register'
    287       verbosity: 'Verbose'
    288       alertWarningLevel: 'High'
    289 
    290 # Test job runs tests using build artifacts
    291 
    292 - job: 'Test'
    293   timeoutInMinutes: 120
    294   dependsOn: 'Build'
    295   condition: succeeded('Build')
    296 
    297   strategy:
    298     matrix:
    299       x86_release:
    300         buildConfiguration: 'Release'
    301         buildPlatform: 'x86'
    302         artifactIdentifier: 'x86release'
    303       x64_release:
    304         buildConfiguration: 'Release'
    305         buildPlatform: 'x64'
    306         artifactIdentifier: 'x64release'
    307 
    308   variables:
    309     buildOutDir: $(Pipeline.Workspace)\Build.$(artifactIdentifier)
    310     artifactsDir: $(Build.ArtifactStagingDirectory)
    311     packageLayoutDir: $(Pipeline.Workspace)\Build.$(artifactIdentifier)\DevPackage
    312 
    313   steps:
    314   - task: DownloadPipelineArtifact@2
    315     displayName: 'Download Build Artifacts'
    316     inputs:
    317       artifact: 'Build.$(artifactIdentifier)'
    318       path: '$(buildOutDir)'
    319 
    320   - task: PowerShell@2
    321     displayName: Install Tests Dependencies
    322     inputs:
    323       targetType: 'inline'
    324       script: |
    325         Get-ChildItem $(buildOutDir)\E2ETests\DevPackageDependencies -Filter *.appx | %{ Add-AppxPackage $_.FullName }
    326 
    327   - task: VisualStudioTestPlatformInstaller@1
    328     displayName: Prepare VSTest for E2E Tests
    329     inputs:
    330       packageFeedSelector: 'nugetOrg'
    331 
    332   - powershell: |
    333       Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
    334       Install-Module Microsoft.WinGet.Client -Repository PSGallery -Force
    335       Repair-WingetPackageManager -AllUsers -Latest
    336       Install-WinGetPackage -Id Microsoft.Sysinternals.PsTools -Source winget
    337     displayName: Install Sysinternals PsTools Using Winget
    338     condition: succeededOrFailed()
    339 
    340   - pwsh: |
    341       $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
    342       PsExec -accepteula -s -i $(buildOutDir)\AppInstallerCLITests\AppInstallerCLITests.exe -logto $(artifactsDir)\AICLI-Unpackaged-System.log -s -r junit -o $(artifactsDir)\TEST-AppInstallerCLI-Unpackaged-System.xml
    343     displayName: Run Unit Tests Unpackaged Under System Context
    344     workingDirectory: '$(buildOutDir)\AppInstallerCLITests'
    345     condition: succeededOrFailed()
    346 
    347   - powershell: |
    348       Uninstall-WinGetPackage -Id Microsoft.Sysinternals.PsTools -Source winget
    349     displayName: Clean up Sysinternals PsTools
    350     condition: succeededOrFailed()
    351 
    352   - task: PowerShell@2
    353     displayName: Run Unit Tests Packaged
    354     inputs:
    355       filePath: 'src\AppInstallerCLITests\Run-TestsInPackage.ps1'
    356       arguments: '-Args "~[pips]" -BuildRoot $(buildOutDir) -PackageRoot $(packageLayoutDir) -LogTarget $(artifactsDir)\AICLI-Packaged.log -TestResultsTarget $(artifactsDir)\TEST-AppInstallerCLI-Packaged.xml -ScriptWait'
    357       workingDirectory: 'src'
    358     condition: succeededOrFailed()
    359 
    360   - task: PublishTestResults@2
    361     displayName: Publish Unit Test Results
    362     inputs:
    363       testResultsFormat: 'JUnit'
    364       testResultsFiles: '$(artifactsDir)\TEST-*.xml'
    365       failTaskOnFailedTests: true
    366     condition: succeededOrFailed()
    367 
    368   - task: PowerShell@2
    369     displayName: 'Set program files directory'
    370     inputs:
    371       targetType: 'inline'
    372       script: |
    373         if ("$(buildPlatform)" -eq "x86") {
    374           Write-Host "##vso[task.setvariable variable=platformProgramFiles;]${env:ProgramFiles(x86)}"
    375         } else {
    376           Write-Host "##vso[task.setvariable variable=platformProgramFiles;]${env:ProgramFiles}"
    377         }
    378     condition: succeededOrFailed()
    379 
    380   # Resolves resource strings utilized by InProc E2E tests.
    381   - task: CopyFiles@2
    382     displayName: 'Copy resources.pri to dotnet directory'
    383     inputs:
    384       SourceFolder: '$(buildOutDir)\DevPackage'
    385       TargetFolder:  '$(platformProgramFiles)\dotnet'
    386       Contents: resources.pri
    387     condition: succeededOrFailed()
    388 
    389   # Winmd accessed by test runner process (dotnet.exe)
    390   - task: CopyFiles@2
    391     displayName: 'Copy winmd to dotnet directory'
    392     inputs:
    393       SourceFolder: '$(buildOutDir)\DevPackage'
    394       TargetFolder: '$(platformProgramFiles)\dotnet'
    395       Contents: Microsoft.Management.Deployment.winmd
    396     condition: succeededOrFailed()
    397 
    398   - template: templates/e2e-setup.yml
    399     parameters:
    400       sourceDir: $(Build.SourcesDirectory)
    401       localhostWebServerArgs: '-BuildRoot $(buildOutDir)\E2ETests\LocalhostWebServer -StaticFileRoot $(buildOutDir)\E2ETests\TestLocalIndex -SourceCert $(buildOutDir)\E2ETests\TestSigningCert.cer'
    402 
    403   - template: templates/e2e-test.template.yml
    404     parameters:
    405       title: "E2E Tests Packaged"
    406       isPackaged: true
    407       filter: "TestCategory!=InProcess&TestCategory!=OutOfProcess"
    408 
    409   - template: templates/e2e-test.template.yml
    410     parameters:
    411       title: "Microsoft.Management.Deployment E2E Tests (In-process)"
    412       isPackaged: false
    413       filter: "TestCategory=InProcess"
    414 
    415   - template: templates/e2e-test.template.yml
    416     parameters:
    417       title: "Microsoft.Management.Deployment E2E Tests (Out-of-process)"
    418       isPackaged: true
    419       filter: "TestCategory=OutOfProcess"
    420 
    421   - task: CopyFiles@2
    422     displayName: 'Copy E2E Tests Package Log to artifacts folder'
    423     inputs:
    424       SourceFolder: '$(temp)\E2ETestLogs'
    425       TargetFolder: '$(artifactsDir)\PackagedLog'
    426     condition: succeededOrFailed()
    427 
    428   - task: VSTest@2
    429     displayName: 'Run tests: WinGetUtilInterop.UnitTests'
    430     inputs:
    431       testSelector: 'testAssemblies'
    432       testAssemblyVer2: 'WinGetUtilInterop.UnitTests.dll'
    433       searchFolder: '$(buildOutDir)\WinGetUtilInterop.UnitTests'
    434       codeCoverageEnabled: true
    435       platform: '$(buildPlatform)'
    436       configuration: '$(BuildConfiguration)'
    437       diagnosticsEnabled: true
    438     condition: succeededOrFailed()
    439 
    440   - task: VSTest@2
    441     displayName: 'Run tests: Microsoft.Management.Configuration.UnitTests (InProc)'
    442     inputs:
    443       testRunTitle: Microsoft.Management.Configuration.UnitTests (InProc)
    444       testSelector: 'testAssemblies'
    445       testAssemblyVer2: '**\Microsoft.Management.Configuration.UnitTests.dll'
    446       searchFolder: '$(buildOutDir)\Microsoft.Management.Configuration.UnitTests'
    447       testFiltercriteria: 'Category=InProc'
    448       codeCoverageEnabled: false
    449       platform: '$(buildPlatform)'
    450       configuration: '$(BuildConfiguration)'
    451       diagnosticsEnabled: true
    452     condition: succeededOrFailed()
    453 
    454   - task: PowerShell@2
    455     displayName: Prepare for Microsoft.Management.Configuration.UnitTests (OutOfProc)
    456     inputs:
    457       filePath: 'src\Microsoft.Management.Configuration.OutOfProc\Prepare-ConfigurationOOPTests.ps1'
    458       arguments: '-BuildOutputPath $(buildOutDir) -PackageLayoutPath $(packageLayoutDir)'
    459     condition: succeededOrFailed()
    460 
    461   - task: VSTest@2
    462     displayName: 'Run tests: Microsoft.Management.Configuration.UnitTests (OutOfProc)'
    463     inputs:
    464       testRunTitle: Microsoft.Management.Configuration.UnitTests (OutOfProc)
    465       testSelector: 'testAssemblies'
    466       testAssemblyVer2: '**\Microsoft.Management.Configuration.UnitTests.dll'
    467       searchFolder: '$(buildOutDir)\Microsoft.Management.Configuration.UnitTests'
    468       testFiltercriteria: 'Category=OutOfProc'
    469       codeCoverageEnabled: true
    470       platform: '$(buildPlatform)'
    471       configuration: '$(BuildConfiguration)'
    472     condition: succeededOrFailed()
    473 
    474   - task: PowerShell@2
    475     displayName: Collect logs for Microsoft.Management.Configuration.UnitTests (OutOfProc)
    476     inputs:
    477       filePath: 'src\Microsoft.Management.Configuration.OutOfProc\Collect-ConfigurationOOPTests.ps1'
    478       arguments: '-TargetLocation $(artifactsDir)\ConfigOOPTestsLog'
    479     condition: succeededOrFailed()
    480 
    481   - powershell: Get-Process LocalhostWebServer | Stop-Process
    482     displayName: Stop LocalhostWebServer
    483     condition: succeededOrFailed()
    484 
    485   - task: PublishPipelineArtifact@1
    486     displayName: Publish Pipeline Artifacts
    487     inputs:
    488       targetPath: '$(artifactsDir)'
    489       artifact: 'Test.$(artifactIdentifier).$(System.JobAttempt)'
    490     condition: succeededOrFailed()
    491 
    492 # Build and test PowerShell module
    493 
    494 - job: 'BuildPowerShellModule'
    495   timeoutInMinutes: 120
    496   dependsOn: 'Build'
    497   condition: succeeded('Build')
    498   variables:
    499     buildOutDir: $(Pipeline.Workspace)\Build.x64Release
    500 
    501   steps:
    502   - task: DownloadPipelineArtifact@2
    503     displayName: 'Download Build Artifacts'
    504 
    505   - task: CopyFiles@2
    506     displayName: 'Copy x64 PowerShell Binaries to Output'
    507     inputs:
    508       SourceFolder: '$(buildOutDir)\PowerShell'
    509       Contents: '**\*'
    510       TargetFolder: '$(Build.ArtifactStagingDirectory)'
    511 
    512   - task: CopyFiles@2
    513     displayName: 'Copy x86 PowerShell Binaries to Output'
    514     inputs:
    515       SourceFolder: '$(Pipeline.Workspace)\Build.x86release\PowerShell'
    516       Contents: '**\*'
    517       TargetFolder: '$(Build.ArtifactStagingDirectory)'
    518 
    519   - task: PowerShell@2
    520     displayName: Generate Microsoft.WinGet.Client Help Documentation
    521     inputs:
    522       pwsh: true
    523       targetType: inline
    524       script: |
    525         Install-Module -Name platyPS -Force
    526         Import-Module platyPS
    527         New-ExternalHelp -Path '$(Build.SourcesDirectory)\src\PowerShell\Help\Microsoft.WinGet.Client' -OutputPath '$(Build.ArtifactStagingDirectory)\Microsoft.WinGet.Client'
    528 
    529   - task: CopyFiles@2
    530     displayName: 'Copy Microsoft.WinGet.DSC module to staging directory'
    531     inputs:
    532       SourceFolder: '$(Build.SourcesDirectory)\src\PowerShell\Microsoft.WinGet.DSC'
    533       Contents: '**\*'
    534       TargetFolder: '$(Build.ArtifactStagingDirectory)\Microsoft.WinGet.DSC'
    535 
    536   - task: PowerShell@2
    537     displayName: Install Tests Dependencies
    538     inputs:
    539       targetType: 'inline'
    540       script: |
    541         Get-ChildItem AppxPackages\AppInstallerCLIPackage_0.0.2.0_Test\Dependencies\x64 -Filter *.appx | %{ Add-AppxPackage $_.FullName }
    542       workingDirectory: $(buildOutDir)
    543 
    544   - template: templates/e2e-setup.yml
    545     parameters:
    546       sourceDir: $(Build.SourcesDirectory)
    547       localhostWebServerArgs: '-BuildRoot $(buildOutDir)\E2ETests\LocalhostWebServer -StaticFileRoot $(buildOutDir)\E2ETests\TestLocalIndex -SourceCert $(buildOutDir)\E2ETests\TestSigningCert.cer'
    548 
    549   - pwsh: .\RunTests.ps1 -testModulesPath $(Build.ArtifactStagingDirectory) -outputPath $(Pipeline.Workspace)\PesterTest -packageLayoutPath $(buildOutDir)\DevPackage
    550     workingDirectory: $(Build.SourcesDirectory)\src\PowerShell\tests\
    551     displayName: Run PowerShell 7 Tests
    552 
    553   - powershell: .\RunTests.ps1 -testModulesPath $(Build.ArtifactStagingDirectory) -outputPath $(Pipeline.Workspace)\WPPesterTest
    554     workingDirectory: $(Build.SourcesDirectory)\src\PowerShell\tests\
    555     displayName: Run Windows PowerShell Tests
    556     condition: succeededOrFailed()
    557 
    558   - powershell: Get-Process LocalhostWebServer | Stop-Process
    559     displayName: Stop LocalhostWebServer
    560     condition: succeededOrFailed()
    561 
    562   - task: PublishTestResults@2
    563     displayName: Publish Pester Test Results PowerShell 7
    564     inputs:
    565       testResultsFormat: 'NUnit'
    566       testResultsFiles: '$(Pipeline.Workspace)\PesterTest\Test*.xml'
    567       failTaskOnFailedTests: true
    568     condition: succeededOrFailed()
    569 
    570   - task: PublishTestResults@2
    571     displayName: Publish Pester Test Results Windows PowerShell
    572     inputs:
    573       testResultsFormat: 'NUnit'
    574       testResultsFiles: '$(Pipeline.Workspace)\WPPesterTest\Test*.xml'
    575       failTaskOnFailedTests: true
    576     condition: succeededOrFailed()
    577 
    578   - task: PowerShell@2
    579     displayName: Copy WinGet Logs
    580     inputs:
    581       pwsh: true
    582       targetType: inline
    583       script: |
    584         $sourceDir = Join-Path $env:LocalAppData Packages\WinGetDevCLI_8wekyb3d8bbwe\LocalState\DiagOutputDir
    585         $destinationDir = Join-Path $(Build.ArtifactStagingDirectory) WinGetLogs
    586         Copy-Item -Path $sourceDir -Destination $destinationDir -Recurse -Force
    587     condition: succeededOrFailed()
    588 
    589   - task: PublishPipelineArtifact@1
    590     displayName: Publish PowerShell Module Artifacts
    591     inputs:
    592       targetPath: '$(Build.ArtifactStagingDirectory)'
    593     condition: succeededOrFailed()
    594 
    595 - job: 'Fuzzing'
    596   timeoutInMinutes: 60
    597   condition: not(eq(variables['Build.Reason'], 'PullRequest'))
    598 
    599   strategy:
    600     matrix:
    601       x64:
    602         buildConfiguration: 'Fuzzing'
    603         buildPlatform: 'x64'
    604 
    605   variables:
    606     buildOutDir: $(Build.SourcesDirectory)\src\$(buildPlatform)\$(buildConfiguration)
    607     artifactsDir: $(Build.ArtifactStagingDirectory)\$(buildPlatform)
    608 
    609   steps:
    610   - task: NuGetToolInstaller@1
    611     displayName: Install Nuget
    612 
    613   - task: NuGetCommand@2
    614     displayName: Restore Solution
    615     inputs:
    616       restoreSolution: '$(solution)'
    617 
    618   - task: CmdLine@2
    619     displayName: Enable Vcpkg Install
    620     inputs:
    621       script: |
    622         $(VCPKG_INSTALLATION_ROOT)\vcpkg.exe integrate install
    623       workingDirectory: '$(VCPKG_INSTALLATION_ROOT)'
    624 
    625   - task: VSBuild@1
    626     displayName: Build Fuzzing Artifacts
    627     inputs:
    628       platform: '$(buildPlatform)'
    629       solution: '$(solution)'
    630       configuration: '$(buildConfiguration)'
    631       msbuildArgs: '/bl:$(artifactsDir)\msbuild.binlog'
    632       maximumCpuCount: true
    633 
    634   - task: CopyFiles@2
    635     displayName: Copy vcpkg logs
    636     inputs:
    637       SourceFolder: $(VCPKG_INSTALLATION_ROOT)\buildtrees
    638       Contents: '**\*.log'
    639       TargetFolder: '$(artifactsDir)\vcpkgLogs'
    640     condition: succeededOrFailed()
    641 
    642   - task: CopyFiles@2
    643     displayName: Copy Fuzzing Artifacts for Publishing
    644     inputs:
    645       SourceFolder: '$(buildOutDir)\WinGetYamlFuzzing'
    646       Contents: '**'
    647       TargetFolder: '$(artifactsDir)'
    648 
    649   - task: PublishPipelineArtifact@1
    650     displayName: Publish Fuzzing Artifacts
    651     inputs:
    652       targetPath: '$(artifactsDir)'
    653     condition: succeededOrFailed()
    654 
    655   - task: onefuzz-task@0
    656     inputs:
    657       onefuzzOSes: 'Windows'
    658     env:
    659       onefuzzDropDirectory: '$(buildOutDir)\WinGetYamlFuzzing'
    660       SYSTEM_ACCESSTOKEN: $(System.AccessToken)