Skip to content

Commit

Permalink
Create local index in build
Browse files Browse the repository at this point in the history
  • Loading branch information
florelis committed Aug 21, 2024
1 parent bbf473a commit 9b2cf5e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 17 deletions.
29 changes: 20 additions & 9 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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\
Expand Down
8 changes: 4 additions & 4 deletions src/AppInstallerCLIE2ETests/TestData/localsource.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@
{
"Type": "exe",
"Name": "AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe",
"Input": "%BUILDOUTDIR%/E2ETests/TestData/AppInstallerTestExeInstaller.exe",
"Input": "%BUILDOUTDIR%/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe",
"HashToken": "<EXEHASH>"
},
{
"Type": "msi",
"Name": "AppInstallerTestMsiInstaller/AppInstallerTestMsiInstaller.msi",
"Input": "%BUILDOUTDIR%/E2ETests/TestData/AppInstallerTestMsiInstaller.msi",
"Input": "%BUILD_SOURCESDIRECTORY%/src/AppInstallerCLIE2ETests/TestData/AppInstallerTestMsiInstaller.msi",
"HashToken": "<MSIHASH>"
},
{
"Type": "msi",
"Name": "AppInstallerTestMsiInstaller/AppInstallerTestMsiInstallerV2.msi",
"Input": "%BUILDOUTDIR%/E2ETests/TestData/AppInstallerTestMsiInstallerV2.msi",
"Input": "%BUILD_SOURCESDIRECTORY%/src/AppInstallerCLIE2ETests/TestData/AppInstallerTestMsiInstallerV2.msi",
"HashToken": "<MSIHASHV2>"
},
{
"Type": "msix",
"Name": "AppInstallerTestMsixInstaller/AppInstallerTestMsixInstaller.msix",
"Input": "%BUILDOUTDIR%/E2ETests/TestData/AppInstallerTestMsixInstaller.msix",
"Input": "%BUILD_ARTIFACTSTAGINGDIRECTORY%/AppInstallerTestMsixInstaller.msix",
"HashToken": "<MSIXHASH>",
"SignatureToken": "<SIGNATUREHASH>"
}
Expand Down
8 changes: 6 additions & 2 deletions templates/e2e-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions templates/e2e-test.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ 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
-ForcedExperimentalFeatures ${{ parameters.experimentalFeatures }}'
${{ 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
Expand Down

0 comments on commit 9b2cf5e

Please sign in to comment.