diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2cb8174392..0341e603ab 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -140,7 +140,7 @@ jobs: platform: '$(buildPlatform)' solution: 'src\AppInstallerTestMsixInstaller\AppInstallerTestMsixInstaller.wapproj' configuration: '$(buildConfiguration)' - msbuildArguments: '/p:AppxPackageOutput="$(artifactsDir)\E2ETests\TestData\AppInstallerTestMsixInstaller.msix" + msbuildArguments: '/p:AppxPackageOutput="$(Build.ArtifactStagingDirectory)\AppInstallerTestMsixInstaller.msix" /p:AppxBundle=Never /p:UapAppxPackageBuildMode=SideLoadOnly /p:AppxPackageSigningEnabled=false' @@ -255,17 +255,28 @@ jobs: 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' + - task: CopyFiles@2 - displayName: 'Copy TestData' + displayName: 'Copy Test signing cert' inputs: - SourceFolder: '$(Build.SourcesDirectory)\src\AppInstallerCLIE2ETests\TestData\' - TargetFolder: '$(artifactsDir)\E2ETests\TestData' + Contents: $(Agent.TempDirectory)\TestSigningCert.cer + TargetFolder: '$(artifactsDir)\E2ETests' + + - task: CopyFiles@2 + displayName: 'Copy TestLocalIndex' + inputs: + SourceFolder: '$(Agent.TempDirectory)\TestLocalIndex' + TargetFolder: '$(artifactsDir)\E2ETests\TestLocalIndex' - task: CopyFiles@2 - displayName: 'Copy AppInstallerTestExeInstaller.exe' + displayName: 'Copy TestData' inputs: - Contents: AppInstallerTestExeInstaller.exe - SourceFolder: '$(buildOutDir)\AppInstallerTestExeInstaller' + SourceFolder: '$(Build.SourcesDirectory)\src\AppInstallerCLIE2ETests\TestData\' TargetFolder: '$(artifactsDir)\E2ETests\TestData' - task: CopyFiles@2 @@ -404,7 +415,7 @@ jobs: - template: templates/e2e-setup.yml parameters: sourceDir: $(Build.SourcesDirectory) - localhostWebServerArgs: '-BuildRoot $(buildOutDir)\E2ETests\LocalhostWebServer -StaticFileRoot $(Agent.TempDirectory)\TestLocalIndex -LocalSourceJson $(buildOutDir)\E2ETests\TestData\localsource.json -TestDataPath $(buildOutDir)\E2ETests\TestData' + localhostWebServerArgs: '-BuildRoot $(buildOutDir)\E2ETests\LocalhostWebServer -StaticFileRoot $(buildOutDir)\E2ETests\TestLocalIndex -SourceCert $(buildOutDir)\E2ETests\TestSigningCert.cer' - template: templates/e2e-test.template.yml parameters: @@ -550,7 +561,7 @@ jobs: - template: templates/e2e-setup.yml parameters: sourceDir: $(Build.SourcesDirectory) - localhostWebServerArgs: '-BuildRoot $(buildOutDir)\E2ETests\LocalhostWebServer -StaticFileRoot $(Agent.TempDirectory)\TestLocalIndex -LocalSourceJson $(buildOutDir)\E2ETests\TestData\localsource.json -TestDataPath $(buildOutDir)\E2ETests\TestData' + 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\ diff --git a/src/AppInstallerCLIE2ETests/TestData/localsource.json b/src/AppInstallerCLIE2ETests/TestData/localsource.json index 5e7349a880..77eb3bd41d 100644 --- a/src/AppInstallerCLIE2ETests/TestData/localsource.json +++ b/src/AppInstallerCLIE2ETests/TestData/localsource.json @@ -8,25 +8,25 @@ { "Type": "exe", "Name": "AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe", - "Input": "%BUILDOUTDIR%/E2ETests/TestData/AppInstallerTestExeInstaller.exe", + "Input": "%BUILDOUTDIR%/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe", "HashToken": "" }, { "Type": "msi", "Name": "AppInstallerTestMsiInstaller/AppInstallerTestMsiInstaller.msi", - "Input": "%BUILDOUTDIR%/E2ETests/TestData/AppInstallerTestMsiInstaller.msi", + "Input": "%BUILD_SOURCESDIRECTORY%/src/AppInstallerCLIE2ETests/TestData/AppInstallerTestMsiInstaller.msi", "HashToken": "" }, { "Type": "msi", "Name": "AppInstallerTestMsiInstaller/AppInstallerTestMsiInstallerV2.msi", - "Input": "%BUILDOUTDIR%/E2ETests/TestData/AppInstallerTestMsiInstallerV2.msi", + "Input": "%BUILD_SOURCESDIRECTORY%/src/AppInstallerCLIE2ETests/TestData/AppInstallerTestMsiInstallerV2.msi", "HashToken": "" }, { "Type": "msix", "Name": "AppInstallerTestMsixInstaller/AppInstallerTestMsixInstaller.msix", - "Input": "%BUILDOUTDIR%/E2ETests/TestData/AppInstallerTestMsixInstaller.msix", + "Input": "%BUILD_ARTIFACTSTAGINGDIRECTORY%/AppInstallerTestMsixInstaller.msix", "HashToken": "", "SignatureToken": "" } diff --git a/templates/e2e-setup.yml b/templates/e2e-setup.yml index 5a5f078abb..97893d0e99 100644 --- a/templates/e2e-setup.yml +++ b/templates/e2e-setup.yml @@ -41,8 +41,12 @@ steps: Write-Host "##vso[task.setvariable variable=HttpsCert.Password;]$httpsCertPassword" displayName: Create and install localhost HTTPS cert - - pwsh: ${{ parameters.sourceDir }}\src\LocalhostWebServer\Run-LocalhostWebServer.ps1 -CertPath $(HttpsCert.Path) -CertPassword $(HttpsCert.Password) -OutCertFile $(Agent.TempDirectory)\servercert.cer -SourceCert $(TestSigningCert.CerPath) ${{ parameters.localhostWebServerArgs }} + - pwsh: ${{ parameters.sourceDir }}\src\LocalhostWebServer\Run-LocalhostWebServer.ps1 -CertPath $(HttpsCert.Path) -CertPassword $(HttpsCert.Password) -OutCertFile $(Agent.TempDirectory)\servercert.cer ${{ parameters.localhostWebServerArgs }} displayName: Launch LocalhostWebServer - - pwsh: ${{ parameters.sourceDir }}\src\AppInstallerCLIE2ETests\TestData\Configuration\Init-TestRepository.ps1 -Force + - task: PowerShell@2 displayName: Setup Local PS Repository + inputs: + filePath: '${{ parameters.sourceDir }}\src\AppInstallerCLIE2ETests\TestData\Configuration\Init-TestRepository.ps1' + arguments: '-Force' + pwsh: true diff --git a/templates/e2e-test.template.yml b/templates/e2e-test.template.yml index 5dd8f453da..9b4e6a4025 100644 --- a/templates/e2e-test.template.yml +++ b/templates/e2e-test.template.yml @@ -28,7 +28,7 @@ steps: -AICLIPackagePath $(packageLayoutDir) -AICLIPath wingetdev.exe -LooseFileRegistration true - -StaticFileRootPath $(Agent.TempDirectory)\TestLocalIndex + -StaticFileRootPath $(buildOutDir)\E2ETests\TestLocalIndex -PowerShellModulePath $(buildOutDir)\PowerShell\Microsoft.WinGet.Client\Microsoft.WinGet.Client.psd1 -LocalServerCertPath $(Agent.TempDirectory)\servercert.cer -SkipTestSource true @@ -36,7 +36,7 @@ steps: ${{ else }}: overrideTestrunParameters: '-PackagedContext false -AICLIPath $(packageLayoutDir)\AppInstallerCLI\winget.exe - -StaticFileRootPath $(Agent.TempDirectory)\TestLocalIndex + -StaticFileRootPath $(buildOutDir)\E2ETests\TestLocalIndex -PowerShellModulePath $(buildOutDir)\PowerShell\Microsoft.WinGet.Client\Microsoft.WinGet.Client.psd1 -LocalServerCertPath $(Agent.TempDirectory)\servercert.cer -SkipTestSource true