658 строки
25 KiB
YAML
658 строки
25 KiB
YAML
# Commit triggers
|
|
trigger:
|
|
- master
|
|
|
|
# PR triggers
|
|
pr:
|
|
branches:
|
|
include:
|
|
- master
|
|
paths:
|
|
include:
|
|
- azure-pipelines.yml
|
|
- templates/*
|
|
- src/*
|
|
- schemas/JSON/manifests/*
|
|
|
|
pool:
|
|
vmImage: 'windows-latest'
|
|
|
|
variables:
|
|
solution: 'src\AppInstallerCLI.sln'
|
|
appxPackageDir: '$(Build.ArtifactStagingDirectory)/AppxPackages/'
|
|
EnableDetectorVcpkg: true
|
|
|
|
# Do not set the build version for a PR build.
|
|
|
|
jobs:
|
|
- job: 'GetReleaseTag'
|
|
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
|
|
variables:
|
|
runCodesignValidationInjection: ${{ false }}
|
|
skipComponentGovernanceDetection: ${{ true }}
|
|
steps:
|
|
- task: PowerShell@2
|
|
name: 'GetTag'
|
|
displayName: Get Release Tag
|
|
inputs:
|
|
filePath: 'src\binver\Update-BinVer.ps1'
|
|
arguments: '-OutVar'
|
|
workingDirectory: 'src'
|
|
|
|
# Build job creates artifacts for use in test jobs
|
|
|
|
- job: 'Build'
|
|
timeoutInMinutes: 120
|
|
dependsOn: 'GetReleaseTag'
|
|
condition: always()
|
|
|
|
strategy:
|
|
matrix:
|
|
x86_release:
|
|
buildConfiguration: 'Release'
|
|
buildPlatform: 'x86'
|
|
testBuildConfiguration: 'TestRelease'
|
|
artifactIdentifier: 'x86release'
|
|
x64_release:
|
|
buildConfiguration: 'Release'
|
|
buildPlatform: 'x64'
|
|
testBuildConfiguration: 'TestRelease'
|
|
artifactIdentifier: 'x64release'
|
|
|
|
variables:
|
|
BuildVer: $[counter(dependencies.GetReleaseTag.outputs['GetTag.tag'], 1)]
|
|
buildOutDir: $(Build.SourcesDirectory)\src\$(buildPlatform)\$(buildConfiguration)
|
|
buildOutDirAnyCpu: $(Build.SourcesDirectory)\src\AnyCPU\$(buildConfiguration)
|
|
artifactsDir: $(Build.ArtifactStagingDirectory)\$(buildPlatform)
|
|
packageLayoutDir: $(Build.BinariesDirectory)\WingetPackageLayout
|
|
|
|
steps:
|
|
- task: NuGetToolInstaller@1
|
|
displayName: Install Nuget
|
|
|
|
# Restores all projects, including native (vcxproj) projects
|
|
- task: NuGetCommand@2
|
|
displayName: Restore Solution
|
|
inputs:
|
|
restoreSolution: '$(solution)'
|
|
|
|
# Restore these UAP packages as https://github.com/NuGet/Home/issues/7796 leads to all UAP packages being skipped for restore.
|
|
# 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.
|
|
- task: NuGetCommand@2
|
|
displayName: Restore AppInstallerCLIPackage
|
|
inputs:
|
|
restoreSolution: 'src\AppInstallerCLIPackage\AppInstallerCLIPackage.wapproj'
|
|
|
|
- task: NuGetCommand@2
|
|
displayName: Restore AppInstallerTestMsixInstaller
|
|
inputs:
|
|
restoreSolution: 'src\AppInstallerTestMsixInstaller\AppInstallerTestMsixInstaller.wapproj'
|
|
|
|
# Restores only .NET core projects, but is still necessary, as without this the IndexCreationTool and LocalhostWebServer projects fail to build
|
|
- task: DotNetCoreCLI@2
|
|
displayName: DotNet Restore
|
|
inputs:
|
|
command: 'restore'
|
|
projects: '**/*.csproj'
|
|
|
|
- task: CmdLine@2
|
|
displayName: Enable Vcpkg Install
|
|
inputs:
|
|
script: |
|
|
$(VCPKG_INSTALLATION_ROOT)\vcpkg.exe integrate install
|
|
workingDirectory: '$(VCPKG_INSTALLATION_ROOT)'
|
|
|
|
- task: PowerShell@2
|
|
displayName: Update Binary Version
|
|
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
|
|
inputs:
|
|
filePath: 'src\binver\Update-BinVer.ps1'
|
|
arguments: '-TargetFile binver\binver\version.h -BuildVersion $(BuildVer)'
|
|
workingDirectory: 'src'
|
|
|
|
# Build all solutions in the root directory.
|
|
- task: VSBuild@1
|
|
displayName: Build Solution
|
|
inputs:
|
|
platform: '$(buildPlatform)'
|
|
solution: '$(solution)'
|
|
configuration: '$(buildConfiguration)'
|
|
msbuildArgs: '/bl:$(artifactsDir)\msbuild.binlog
|
|
/p:AppxBundlePlatforms="$(buildPlatform)"
|
|
/p:AppxPackageDir="$(appxPackageDir)"
|
|
/p:AppxBundle=Always
|
|
/p:UapAppxPackageBuildMode=SideloadOnly'
|
|
|
|
- task: VSBuild@1
|
|
displayName: Build Test Project
|
|
inputs:
|
|
platform: '$(buildPlatform)'
|
|
solution: '$(solution)'
|
|
configuration: '$(testBuildConfiguration)'
|
|
msbuildArgs: '/bl:$(artifactsDir)\msbuild-testProject.binlog
|
|
/p:AppxBundlePlatforms="$(buildPlatform)"
|
|
/p:AppxPackageDir="$(appxPackageDir)"
|
|
/p:AppxBundle=Always
|
|
/p:UapAppxPackageBuildMode=SideloadOnly'
|
|
|
|
- task: MSBuild@1
|
|
displayName: Build MSIX Test Installer File
|
|
inputs:
|
|
platform: '$(buildPlatform)'
|
|
solution: 'src\AppInstallerTestMsixInstaller\AppInstallerTestMsixInstaller.wapproj'
|
|
configuration: '$(buildConfiguration)'
|
|
msbuildArguments: '/p:AppxPackageOutput="$(Build.ArtifactStagingDirectory)\AppInstallerTestMsixInstaller.msix"
|
|
/p:AppxBundle=Never
|
|
/p:UapAppxPackageBuildMode=SideLoadOnly
|
|
/p:AppxPackageSigningEnabled=false'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy specific build artifacts'
|
|
inputs:
|
|
Contents: |
|
|
$(buildOutDir)\WindowsPackageManager\WindowsPackageManager.pdb
|
|
$(buildOutDir)\WinGetUtil\WinGetUtil.dll
|
|
$(buildOutDir)\WinGetUtil\WinGetUtil.pdb
|
|
TargetFolder: '$(artifactsDir)'
|
|
|
|
- task: PowerShell@2
|
|
displayName: Create Package Layout
|
|
inputs:
|
|
filePath: 'src\AppInstallerCLIPackage\Execute-AppxRecipe.ps1'
|
|
arguments: '-AppxRecipePath AppInstallerCLIPackage\bin\$(buildPlatform)\$(buildConfiguration)\AppInstallerCLIPackage.build.appxrecipe -LayoutPath $(packageLayoutDir) -Force -Verbose'
|
|
workingDirectory: 'src'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy Dev Package (Loose Files)'
|
|
inputs:
|
|
SourceFolder: '$(packageLayoutDir)'
|
|
TargetFolder: '$(artifactsDir)\DevPackage'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy Dev Packages'
|
|
inputs:
|
|
SourceFolder: '$(appxPackageDir)'
|
|
TargetFolder: '$(artifactsDir)\AppxPackages'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy native binaries for Microsoft.WinGet.Client (net6)'
|
|
inputs:
|
|
SourceFolder: $(buildOutDir)
|
|
Contents: |
|
|
Microsoft.Management.Deployment.InProc\Microsoft.Management.Deployment.dll
|
|
Microsoft.Management.Deployment\Microsoft.Management.Deployment.winmd
|
|
WindowsPackageManager\WindowsPackageManager.dll
|
|
UndockedRegFreeWinRT\winrtact.dll
|
|
TargetFolder: $(buildOutDirAnyCpu)\PowerShell\Microsoft.WinGet.Client\net6.0-windows10.0.22000.0\SharedDependencies\$(BuildPlatform)
|
|
flattenFolders: true
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy native binaries for Microsoft.WinGet.Client (net48)'
|
|
inputs:
|
|
SourceFolder: $(buildOutDir)
|
|
Contents: |
|
|
Microsoft.Management.Deployment.InProc\Microsoft.Management.Deployment.dll
|
|
Microsoft.Management.Deployment\Microsoft.Management.Deployment.winmd
|
|
WindowsPackageManager\WindowsPackageManager.dll
|
|
UndockedRegFreeWinRT\winrtact.dll
|
|
TargetFolder: $(buildOutDirAnyCpu)\PowerShell\Microsoft.WinGet.Client\net48\SharedDependencies\$(BuildPlatform)
|
|
flattenFolders: true
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy native binaries for Microsoft.WinGet.Configuration'
|
|
inputs:
|
|
SourceFolder: $(buildOutDir)
|
|
Contents: |
|
|
Microsoft.Management.Configuration\Microsoft.Management.Configuration.dll
|
|
TargetFolder: $(buildOutDirAnyCpu)\PowerShell\Microsoft.WinGet.Configuration\SharedDependencies\$(BuildPlatform)
|
|
flattenFolders: true
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy managed binaries for Microsoft.WinGet.Configuration in arch specific'
|
|
inputs:
|
|
SourceFolder: $(buildOutDirAnyCpu)
|
|
Contents: |
|
|
Microsoft.Management.Configuration.Projection\net6.0-windows10.0.22000.0\Microsoft.Management.Configuration.Projection.dll
|
|
TargetFolder: $(buildOutDirAnyCpu)\PowerShell\Microsoft.WinGet.Configuration\SharedDependencies\$(BuildPlatform)
|
|
flattenFolders: true
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy PowerShell AnyCPU Module Files'
|
|
inputs:
|
|
SourceFolder: '$(buildOutDirAnyCpu)\PowerShell'
|
|
TargetFolder: '$(artifactsDir)\PowerShell'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy binaries'
|
|
inputs:
|
|
SourceFolder: '$(buildOutDir)'
|
|
TargetFolder: '$(artifactsDir)'
|
|
Contents: |
|
|
AppInstallerCLIE2ETests\**
|
|
AppInstallerCLITests\**
|
|
Microsoft.Management.Configuration\**
|
|
Microsoft.Management.Configuration.UnitTests\**
|
|
Microsoft.Management.Configuration.OutOfProc\**
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy Files: WinGetUtilInterop.UnitTests'
|
|
inputs:
|
|
SourceFolder: '$(Build.SourcesDirectory)\src\WinGetUtilInterop.UnitTests\bin\$(buildPlatform)\$(BuildConfiguration)\net6.0'
|
|
TargetFolder: '$(artifactsDir)\WinGetUtilInterop.UnitTests\'
|
|
CleanTargetFolder: true
|
|
OverWrite: true
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy WinGetUtil to WinGetUtilInterop.UnitTests folder'
|
|
inputs:
|
|
Contents: |
|
|
$(buildOutDir)\WinGetUtil\WinGetUtil.dll
|
|
TargetFolder: '$(artifactsDir)\WinGetUtilInterop.UnitTests\'
|
|
flattenFolders: true
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy LocalhostWebServer to E2ETests'
|
|
inputs:
|
|
SourceFolder: '$(buildOutDir)\LocalhostWebServer'
|
|
TargetFolder: '$(artifactsDir)\E2ETests\LocalhostWebServer'
|
|
|
|
# Invoke E2E setup to generate the TestLocalIndex; could optimize out some of its steps if needed
|
|
- template: templates/e2e-setup.yml
|
|
parameters:
|
|
sourceDir: $(Build.SourcesDirectory)
|
|
localhostWebServerArgs: '-BuildRoot $(artifactsDir)\E2ETests\LocalhostWebServer -StaticFileRoot $(Agent.TempDirectory)\TestLocalIndex -LocalSourceJson $(Build.SourcesDirectory)\src\AppInstallerCLIE2ETests\TestData\localsource.json -TestDataPath $(Build.SourcesDirectory)\src\AppInstallerCLIE2ETests\TestData -ExitBeforeRun'
|
|
signingCertOutDir: $(artifactsDir)\E2ETests
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy TestLocalIndex'
|
|
inputs:
|
|
SourceFolder: '$(Agent.TempDirectory)\TestLocalIndex'
|
|
TargetFolder: '$(artifactsDir)\E2ETests\TestLocalIndex'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy TestData'
|
|
inputs:
|
|
SourceFolder: '$(Build.SourcesDirectory)\src\AppInstallerCLIE2ETests\TestData\'
|
|
TargetFolder: '$(artifactsDir)\E2ETests\TestData'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy Dev Package Dependencies'
|
|
inputs:
|
|
SourceFolder: '$(appxPackageDir)\AppInstallerCLIPackage_0.0.2.0_Test\Dependencies\$(buildPlatform)\'
|
|
TargetFolder: '$(artifactsDir)\E2ETests\DevPackageDependencies'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy test scripts to artifacts'
|
|
inputs:
|
|
Contents: |
|
|
$(Build.SourcesDirectory)\src\PowerShell\scripts\Execute-WinGetTests.ps1
|
|
$(Build.SourcesDirectory)\src\PowerShell\tests\**
|
|
$(Build.SourcesDirectory)\src\LocalhostWebServer\Run-LocalhostWebServer.ps1
|
|
TargetFolder: '$(artifactsDir)\E2ETests\Scripts'
|
|
flattenFolders: true
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
displayName: Publish Pipeline Artifacts
|
|
inputs:
|
|
targetPath: '$(artifactsDir)'
|
|
artifact: 'Build.$(artifactIdentifier)'
|
|
|
|
- task: ComponentGovernanceComponentDetection@0
|
|
displayName: Component Governance
|
|
inputs:
|
|
scanType: 'Register'
|
|
verbosity: 'Verbose'
|
|
alertWarningLevel: 'High'
|
|
|
|
# Test job runs tests using build artifacts
|
|
|
|
- job: 'Test'
|
|
timeoutInMinutes: 120
|
|
dependsOn: 'Build'
|
|
condition: succeeded('Build')
|
|
|
|
strategy:
|
|
matrix:
|
|
x86_release:
|
|
buildConfiguration: 'Release'
|
|
buildPlatform: 'x86'
|
|
testBuildConfiguration: 'TestRelease'
|
|
artifactIdentifier: 'x86release'
|
|
x64_release:
|
|
buildConfiguration: 'Release'
|
|
buildPlatform: 'x64'
|
|
testBuildConfiguration: 'TestRelease'
|
|
artifactIdentifier: 'x64release'
|
|
|
|
variables:
|
|
buildOutDir: $(Pipeline.Workspace)\Build.$(artifactIdentifier)
|
|
artifactsDir: $(Build.ArtifactStagingDirectory)
|
|
packageLayoutDir: $(Pipeline.Workspace)\Build.$(artifactIdentifier)\DevPackage
|
|
|
|
steps:
|
|
- task: DownloadPipelineArtifact@2
|
|
displayName: 'Download Build Artifacts'
|
|
inputs:
|
|
artifact: 'Build.$(artifactIdentifier)'
|
|
path: '$(buildOutDir)'
|
|
|
|
- task: PowerShell@2
|
|
displayName: Install Tests Dependencies
|
|
inputs:
|
|
targetType: 'inline'
|
|
script: |
|
|
Get-ChildItem $(buildOutDir)\E2ETests\DevPackageDependencies -Filter *.appx | %{ Add-AppxPackage $_.FullName }
|
|
|
|
- task: VisualStudioTestPlatformInstaller@1
|
|
displayName: Prepare VSTest for E2E Tests
|
|
inputs:
|
|
packageFeedSelector: 'nugetOrg'
|
|
|
|
# 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
|
|
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()
|
|
|
|
- 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
|
|
workingDirectory: '$(buildOutDir)\AppInstallerCLITests'
|
|
condition: succeededOrFailed()
|
|
|
|
- powershell: |
|
|
Uninstall-WinGetPackage -Id Microsoft.Sysinternals.PsTools -Source winget
|
|
displayName: Clean up Sysinternals PsTools
|
|
condition: succeededOrFailed()
|
|
|
|
- task: PowerShell@2
|
|
displayName: Run Unit Tests Packaged
|
|
inputs:
|
|
filePath: 'src\AppInstallerCLITests\Run-TestsInPackage.ps1'
|
|
arguments: '-Args "~[pips]" -BuildRoot $(buildOutDir) -PackageRoot $(packageLayoutDir) -LogTarget $(artifactsDir)\AICLI-Packaged.log -TestResultsTarget $(artifactsDir)\TEST-AppInstallerCLI-Packaged.xml -ScriptWait'
|
|
workingDirectory: 'src'
|
|
condition: succeededOrFailed()
|
|
|
|
- task: PublishTestResults@2
|
|
displayName: Publish Unit Test Results
|
|
inputs:
|
|
testResultsFormat: 'JUnit'
|
|
testResultsFiles: '$(artifactsDir)\TEST-*.xml'
|
|
failTaskOnFailedTests: true
|
|
condition: succeededOrFailed()
|
|
|
|
- task: PowerShell@2
|
|
displayName: 'Set program files directory'
|
|
inputs:
|
|
targetType: 'inline'
|
|
script: |
|
|
if ("$(buildPlatform)" -eq "x86") {
|
|
Write-Host "##vso[task.setvariable variable=platformProgramFiles;]${env:ProgramFiles(x86)}"
|
|
} else {
|
|
Write-Host "##vso[task.setvariable variable=platformProgramFiles;]${env:ProgramFiles}"
|
|
}
|
|
condition: succeededOrFailed()
|
|
|
|
# Resolves resource strings utilized by InProc E2E tests.
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy resources.pri to dotnet directory'
|
|
inputs:
|
|
SourceFolder: '$(buildOutDir)\DevPackage'
|
|
TargetFolder: '$(platformProgramFiles)\dotnet'
|
|
Contents: resources.pri
|
|
condition: succeededOrFailed()
|
|
|
|
# Winmd accessed by test runner process (dotnet.exe)
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy winmd to dotnet directory'
|
|
inputs:
|
|
SourceFolder: '$(buildOutDir)\DevPackage'
|
|
TargetFolder: '$(platformProgramFiles)\dotnet'
|
|
Contents: Microsoft.Management.Deployment.winmd
|
|
condition: succeededOrFailed()
|
|
|
|
- template: templates/e2e-setup.yml
|
|
parameters:
|
|
sourceDir: $(Build.SourcesDirectory)
|
|
localhostWebServerArgs: '-BuildRoot $(buildOutDir)\E2ETests\LocalhostWebServer -StaticFileRoot $(buildOutDir)\E2ETests\TestLocalIndex -SourceCert $(buildOutDir)\E2ETests\TestSigningCert.cer'
|
|
|
|
- template: templates/e2e-test.template.yml
|
|
parameters:
|
|
title: "E2E Tests Packaged"
|
|
isPackaged: true
|
|
filter: "TestCategory!=InProcess&TestCategory!=OutOfProcess"
|
|
|
|
- template: templates/e2e-test.template.yml
|
|
parameters:
|
|
title: "Microsoft.Management.Deployment E2E Tests (In-process)"
|
|
isPackaged: false
|
|
filter: "TestCategory=InProcess"
|
|
|
|
- template: templates/e2e-test.template.yml
|
|
parameters:
|
|
title: "Microsoft.Management.Deployment E2E Tests (Out-of-process)"
|
|
isPackaged: true
|
|
filter: "TestCategory=OutOfProcess"
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy E2E Tests Package Log to artifacts folder'
|
|
inputs:
|
|
SourceFolder: '$(temp)\E2ETestLogs'
|
|
TargetFolder: '$(artifactsDir)\PackagedLog'
|
|
condition: succeededOrFailed()
|
|
|
|
- task: VSTest@2
|
|
displayName: 'Run tests: WinGetUtilInterop.UnitTests'
|
|
inputs:
|
|
testSelector: 'testAssemblies'
|
|
testAssemblyVer2: 'WinGetUtilInterop.UnitTests.dll'
|
|
searchFolder: '$(buildOutDir)\WinGetUtilInterop.UnitTests'
|
|
codeCoverageEnabled: true
|
|
platform: '$(buildPlatform)'
|
|
configuration: '$(BuildConfiguration)'
|
|
diagnosticsEnabled: true
|
|
condition: succeededOrFailed()
|
|
|
|
- task: VSTest@2
|
|
displayName: 'Run tests: Microsoft.Management.Configuration.UnitTests (InProc)'
|
|
inputs:
|
|
testRunTitle: Microsoft.Management.Configuration.UnitTests (InProc)
|
|
testSelector: 'testAssemblies'
|
|
testAssemblyVer2: '**\Microsoft.Management.Configuration.UnitTests.dll'
|
|
searchFolder: '$(buildOutDir)\Microsoft.Management.Configuration.UnitTests'
|
|
testFiltercriteria: 'Category=InProc'
|
|
codeCoverageEnabled: false
|
|
platform: '$(buildPlatform)'
|
|
configuration: '$(BuildConfiguration)'
|
|
diagnosticsEnabled: true
|
|
condition: succeededOrFailed()
|
|
|
|
- task: PowerShell@2
|
|
displayName: Prepare for Microsoft.Management.Configuration.UnitTests (OutOfProc)
|
|
inputs:
|
|
filePath: 'src\Microsoft.Management.Configuration.OutOfProc\Prepare-ConfigurationOOPTests.ps1'
|
|
arguments: '-BuildOutputPath $(buildOutDir) -PackageLayoutPath $(packageLayoutDir)'
|
|
condition: succeededOrFailed()
|
|
|
|
- task: VSTest@2
|
|
displayName: 'Run tests: Microsoft.Management.Configuration.UnitTests (OutOfProc)'
|
|
inputs:
|
|
testRunTitle: Microsoft.Management.Configuration.UnitTests (OutOfProc)
|
|
testSelector: 'testAssemblies'
|
|
testAssemblyVer2: '**\Microsoft.Management.Configuration.UnitTests.dll'
|
|
searchFolder: '$(buildOutDir)\Microsoft.Management.Configuration.UnitTests'
|
|
testFiltercriteria: 'Category=OutOfProc'
|
|
codeCoverageEnabled: true
|
|
platform: '$(buildPlatform)'
|
|
configuration: '$(BuildConfiguration)'
|
|
condition: succeededOrFailed()
|
|
|
|
- task: PowerShell@2
|
|
displayName: Collect logs for Microsoft.Management.Configuration.UnitTests (OutOfProc)
|
|
inputs:
|
|
filePath: 'src\Microsoft.Management.Configuration.OutOfProc\Collect-ConfigurationOOPTests.ps1'
|
|
arguments: '-TargetLocation $(artifactsDir)\ConfigOOPTestsLog'
|
|
condition: succeededOrFailed()
|
|
|
|
- powershell: Get-Process LocalhostWebServer | Stop-Process
|
|
displayName: Stop LocalhostWebServer
|
|
condition: succeededOrFailed()
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
displayName: Publish Pipeline Artifacts
|
|
inputs:
|
|
targetPath: '$(artifactsDir)'
|
|
artifact: 'Test.$(artifactIdentifier).$(System.JobAttempt)'
|
|
condition: succeededOrFailed()
|
|
|
|
# Build and test PowerShell module
|
|
|
|
- job: 'BuildPowerShellModule'
|
|
timeoutInMinutes: 120
|
|
dependsOn: 'Build'
|
|
condition: succeeded('Build')
|
|
variables:
|
|
buildOutDir: $(Pipeline.Workspace)\Build.x64Release
|
|
|
|
steps:
|
|
- task: DownloadPipelineArtifact@2
|
|
displayName: 'Download Build Artifacts'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy x64 PowerShell Binaries to Output'
|
|
inputs:
|
|
SourceFolder: '$(buildOutDir)\PowerShell'
|
|
Contents: '**\*'
|
|
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy x86 PowerShell Binaries to Output'
|
|
inputs:
|
|
SourceFolder: '$(Pipeline.Workspace)\Build.x86release\PowerShell'
|
|
Contents: '**\*'
|
|
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
|
|
|
- task: PowerShell@2
|
|
displayName: Generate Microsoft.WinGet.Client Help Documentation
|
|
inputs:
|
|
pwsh: true
|
|
targetType: inline
|
|
script: |
|
|
Install-Module -Name platyPS -Force
|
|
Import-Module platyPS
|
|
New-ExternalHelp -Path '$(Build.SourcesDirectory)\src\PowerShell\Help\Microsoft.WinGet.Client' -OutputPath '$(Build.ArtifactStagingDirectory)\Microsoft.WinGet.Client'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: 'Copy Microsoft.WinGet.DSC module to staging directory'
|
|
inputs:
|
|
SourceFolder: '$(Build.SourcesDirectory)\src\PowerShell\Microsoft.WinGet.DSC'
|
|
Contents: '**\*'
|
|
TargetFolder: '$(Build.ArtifactStagingDirectory)\Microsoft.WinGet.DSC'
|
|
|
|
- task: PowerShell@2
|
|
displayName: Install Tests Dependencies
|
|
inputs:
|
|
targetType: 'inline'
|
|
script: |
|
|
Get-ChildItem AppxPackages\AppInstallerCLIPackage_0.0.2.0_Test\Dependencies\x64 -Filter *.appx | %{ Add-AppxPackage $_.FullName }
|
|
workingDirectory: $(buildOutDir)
|
|
|
|
- template: templates/e2e-setup.yml
|
|
parameters:
|
|
sourceDir: $(Build.SourcesDirectory)
|
|
localhostWebServerArgs: '-BuildRoot $(buildOutDir)\E2ETests\LocalhostWebServer -StaticFileRoot $(buildOutDir)\E2ETests\TestLocalIndex -SourceCert $(buildOutDir)\E2ETests\TestSigningCert.cer'
|
|
|
|
- pwsh: .\RunTests.ps1 -testModulesPath $(Build.ArtifactStagingDirectory) -outputPath $(Pipeline.Workspace)\PesterTest -packageLayoutPath $(buildOutDir)\DevPackage
|
|
workingDirectory: $(Build.SourcesDirectory)\src\PowerShell\tests\
|
|
displayName: Run PowerShell 7 Tests
|
|
|
|
- powershell: .\RunTests.ps1 -testModulesPath $(Build.ArtifactStagingDirectory) -outputPath $(Pipeline.Workspace)\WPPesterTest
|
|
workingDirectory: $(Build.SourcesDirectory)\src\PowerShell\tests\
|
|
displayName: Run Windows PowerShell Tests
|
|
condition: succeededOrFailed()
|
|
|
|
- powershell: Get-Process LocalhostWebServer | Stop-Process
|
|
displayName: Stop LocalhostWebServer
|
|
condition: succeededOrFailed()
|
|
|
|
- task: PublishTestResults@2
|
|
displayName: Publish Pester Test Results PowerShell 7
|
|
inputs:
|
|
testResultsFormat: 'NUnit'
|
|
testResultsFiles: '$(Pipeline.Workspace)\PesterTest\Test*.xml'
|
|
failTaskOnFailedTests: true
|
|
condition: succeededOrFailed()
|
|
|
|
- task: PublishTestResults@2
|
|
displayName: Publish Pester Test Results Windows PowerShell
|
|
inputs:
|
|
testResultsFormat: 'NUnit'
|
|
testResultsFiles: '$(Pipeline.Workspace)\WPPesterTest\Test*.xml'
|
|
failTaskOnFailedTests: true
|
|
condition: succeededOrFailed()
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
displayName: Publish PowerShell Module Artifacts
|
|
inputs:
|
|
targetPath: '$(Build.ArtifactStagingDirectory)'
|
|
condition: succeededOrFailed()
|
|
|
|
- job: 'Fuzzing'
|
|
timeoutInMinutes: 60
|
|
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
|
|
|
|
strategy:
|
|
matrix:
|
|
x64:
|
|
buildConfiguration: 'Fuzzing'
|
|
buildPlatform: 'x64'
|
|
|
|
variables:
|
|
buildOutDir: $(Build.SourcesDirectory)\src\$(buildPlatform)\$(buildConfiguration)
|
|
artifactsDir: $(Build.ArtifactStagingDirectory)\$(buildPlatform)
|
|
|
|
steps:
|
|
- task: NuGetToolInstaller@1
|
|
displayName: Install Nuget
|
|
|
|
- task: NuGetCommand@2
|
|
displayName: Restore Solution
|
|
inputs:
|
|
restoreSolution: '$(solution)'
|
|
|
|
- task: VSBuild@1
|
|
displayName: Build Fuzzing Artifacts
|
|
inputs:
|
|
platform: '$(buildPlatform)'
|
|
solution: '$(solution)'
|
|
configuration: '$(buildConfiguration)'
|
|
msbuildArgs: '/bl:$(artifactsDir)\msbuild.binlog'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: Copy Fuzzing Artifacts for Publishing
|
|
inputs:
|
|
SourceFolder: '$(buildOutDir)\WinGetYamlFuzzing'
|
|
Contents: '**'
|
|
TargetFolder: '$(artifactsDir)'
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
displayName: Publish Fuzzing Artifacts
|
|
inputs:
|
|
targetPath: '$(artifactsDir)'
|
|
|
|
- task: onefuzz-task@0
|
|
inputs:
|
|
onefuzzOSes: 'Windows'
|
|
env:
|
|
onefuzzDropDirectory: '$(buildOutDir)\WinGetYamlFuzzing'
|
|
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|