diff --git a/build.psm1 b/build.psm1 index 5f1851419c6..60a37e07539 100644 --- a/build.psm1 +++ b/build.psm1 @@ -842,7 +842,10 @@ function Get-PesterTag { function Publish-PSTestTools { [CmdletBinding()] - param() + param( + [string] + $runtime + ) Find-Dotnet @@ -859,7 +862,12 @@ function Publish-PSTestTools { { Push-Location $tool.Path try { - dotnet publish --output bin --configuration $Options.Configuration --framework $Options.Framework --runtime $Options.Runtime + if (-not $runtime) { + dotnet publish --output bin --configuration $Options.Configuration --framework $Options.Framework --runtime $Options.Runtime + } else { + dotnet publish --output bin --configuration $Options.Configuration --framework $Options.Framework --runtime $runtime + } + $toolPath = Join-Path -Path $tool.Path -ChildPath "bin" if ( -not $env:PATH.Contains($toolPath) ) { @@ -2974,7 +2982,8 @@ function New-TestPackage [CmdletBinding()] param( [Parameter(Mandatory = $true)] - [string] $Destination + [string] $Destination, + [string] $Runtime ) if (Test-Path $Destination -PathType Leaf) @@ -3002,7 +3011,7 @@ function New-TestPackage Write-Verbose -Verbose "PackagePath: $packagePath" # Build test tools so they are placed in appropriate folders under 'test' then copy to package root. - $null = Publish-PSTestTools + $null = Publish-PSTestTools -runtime $Runtime $powerShellTestRoot = Join-Path $PSScriptRoot 'test' Copy-Item $powerShellTestRoot -Recurse -Destination $packageRoot -Force Write-Verbose -Message "Copied test directory" diff --git a/tools/releaseBuild/azureDevOps/diagram.puml b/tools/releaseBuild/azureDevOps/diagram.puml index b72312ae504..ade53b11b9c 100644 --- a/tools/releaseBuild/azureDevOps/diagram.puml +++ b/tools/releaseBuild/azureDevOps/diagram.puml @@ -39,6 +39,8 @@ folder "Package Signing and Upload" as PkgSignUpload { folder "Build Test Artifacts" as TestArtifacts { agent "Windows" as WinTest agent "Linux" as LinuxTest + agent "Linux-ARM" as LinuxArmTest + agent "Linux-ARM64" as LinuxArm64Test } agent "Compliance" as Compliance diff --git a/tools/releaseBuild/azureDevOps/diagram.svg b/tools/releaseBuild/azureDevOps/diagram.svg index 5d1b162f1a8..024128bf988 100644 --- a/tools/releaseBuild/azureDevOps/diagram.svg +++ b/tools/releaseBuild/azureDevOps/diagram.svg @@ -1,4 +1,4 @@ -Linux BuildsWindows BuildsLinux Package Scanning and UploadPackage Signing and UploadBuild Test ArtifactsDEBRPMAlpineLinux-FxDependentx64x86arm32arm64FxDependentDEBRPMAlpineLinux-FxDependentmacOSWindowsWindowsLinuxmacOS BuildUpload build metadataComponentRegistrationComplianceCreate SDK and Global Tool and UploadFinishStartLinux BuildsWindows BuildsLinux Package Scanning and UploadPackage Signing and UploadBuild Test ArtifactsDEBRPMAlpineLinux-FxDependentx64x86arm32arm64FxDependentDEBRPMAlpineLinux-FxDependentmacOSWindowsWindowsLinuxLinux-ARMLinux-ARM64macOS BuildUpload build metadataComponentRegistrationComplianceCreate SDK and Global Tool and UploadFinishStart \ No newline at end of file diff --git a/tools/releaseBuild/azureDevOps/releaseBuild.yml b/tools/releaseBuild/azureDevOps/releaseBuild.yml index 481341d0939..be7714dd135 100644 --- a/tools/releaseBuild/azureDevOps/releaseBuild.yml +++ b/tools/releaseBuild/azureDevOps/releaseBuild.yml @@ -88,19 +88,6 @@ jobs: - build_macOS - template: templates/testartifacts.yml - parameters: - buildName: windows - pool: Hosted VS2017 - -- template: templates/testartifacts.yml - parameters: - buildName: linux - pool: Hosted Ubuntu 1604 - -- template: templates/testartifacts.yml - parameters: - buildName: macOS - pool: Hosted Mac Internal - job: release_json displayName: Create and Upload release.json diff --git a/tools/releaseBuild/azureDevOps/templates/testartifacts.yml b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml index 8ebe18b0bbe..3e72ed7038d 100644 --- a/tools/releaseBuild/azureDevOps/templates/testartifacts.yml +++ b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml @@ -1,12 +1,8 @@ -parameters: - buildName: 'linux' - pool: 'Hosted Ubuntu 1604' - jobs: -- job: build_testartifacts_${{ parameters.buildName }} - displayName: Build test artifacts ${{ parameters.buildName }} +- job: build_testartifacts + displayName: Build test artifacts condition: succeeded() - pool: ${{ parameters.pool }} + pool: 'Hosted Ubuntu 1604' steps: - pwsh: | @@ -16,26 +12,35 @@ jobs: - pwsh: | Import-Module ./build.psm1 - New-TestPackage -Destination $(System.ArtifactsDirectory) - displayName: Build test package - - pwsh: | - if (-not (Test-Path $(System.ArtifactsDirectory)/TestPackage.zip)) + function BuildTestPackage([string] $runtime) { - throw "Test Package was not found at: $(System.ArtifactsDirectory)" - } + Write-Verbose -Verbose "Starting to build package for $runtime" - $packageName = if ($IsWindows) { - "TestPackage-win.zip" - } - elseif ($IsLinux) { - "TestPackage-linux.zip" - } - else { - "TestPackage-macOS.zip" + New-TestPackage -Destination $(System.ArtifactsDirectory) -Runtime $runtime + + if (-not (Test-Path $(System.ArtifactsDirectory)/TestPackage.zip)) + { + throw "Test Package was not found at: $(System.ArtifactsDirectory)" + } + + switch ($runtime) + { + win7-x64 { $packageName = "TestPackage-win.zip" } + linux-x64 { $packageName = "TestPackage-linux-x64.zip" } + linux-arm { $packageName = "TestPackage-linux-arm.zip" } + linux-arm64 { $packageName = "TestPackage-linux-arm64.zip" } + osx-x64 { $packageName = "TestPackage-macOS.zip" } + } + + Rename-Item $(System.ArtifactsDirectory)/TestPackage.zip $packageName + Write-Host "##vso[artifact.upload containerfolder=testArtifacts;artifactname=testArtifacts]$(System.ArtifactsDirectory)/$packageName" } - Rename-Item $(System.ArtifactsDirectory)/TestPackage.zip $packageName + BuildTestPackage -runtime win7-x64 + BuildTestPackage -runtime linux-x64 + BuildTestPackage -runtime linux-arm + BuildTestPackage -runtime linux-arm64 + BuildTestPackage -runtime osx-x64 - Write-Host "##vso[artifact.upload containerfolder=testArtifacts;artifactname=testArtifacts]$(System.ArtifactsDirectory)/$packageName" - displayName: Upload to build artifacts + displayName: Build test package and upload