From e7aaa2edccc94c89995aaf827b08bef805b15314 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 25 Apr 2019 17:45:05 -0700 Subject: [PATCH 1/6] Build test packages for windows, linux-x64, linux-arm, linux-arm64 and macOS --- build.psm1 | 16 +++++-- .../azureDevOps/templates/testartifacts.yml | 43 +++++++++++-------- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/build.psm1 b/build.psm1 index 5f1851419c6..f1b3237f1ee 100644 --- a/build.psm1 +++ b/build.psm1 @@ -842,7 +842,9 @@ function Get-PesterTag { function Publish-PSTestTools { [CmdletBinding()] - param() + param( + $runtime + ) Find-Dotnet @@ -859,7 +861,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 +2981,8 @@ function New-TestPackage [CmdletBinding()] param( [Parameter(Mandatory = $true)] - [string] $Destination + [string] $Destination, + [string] $Runtime ) if (Test-Path $Destination -PathType Leaf) @@ -3002,7 +3010,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/templates/testartifacts.yml b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml index 8ebe18b0bbe..66024c5d641 100644 --- a/tools/releaseBuild/azureDevOps/templates/testartifacts.yml +++ b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml @@ -16,26 +16,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($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 From 400d335dbcd37cfe0be57d9012d7a7309e4a8439 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 25 Apr 2019 17:49:44 -0700 Subject: [PATCH 2/6] Fix typo --- tools/releaseBuild/azureDevOps/templates/testartifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/azureDevOps/templates/testartifacts.yml b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml index 66024c5d641..628e041a5ff 100644 --- a/tools/releaseBuild/azureDevOps/templates/testartifacts.yml +++ b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml @@ -34,7 +34,7 @@ jobs: 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" } + osx-x64 { $packageName = "TestPackage-macOS.zip" } } Rename-Item $(System.ArtifactsDirectory)/TestPackage.zip $packageName From 7c75d2d22659ab0c326ab7af454af5639dc72a64 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 26 Apr 2019 10:20:50 -0700 Subject: [PATCH 3/6] Remove duplication --- tools/releaseBuild/azureDevOps/releaseBuild.yml | 13 ------------- .../azureDevOps/templates/testartifacts.yml | 10 +++------- 2 files changed, 3 insertions(+), 20 deletions(-) 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 628e041a5ff..59e5841447b 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: | From 106cdd4ca94ac16ce4f74a2f913ee8d79a915dba Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 26 Apr 2019 11:30:19 -0700 Subject: [PATCH 4/6] Update diagram --- tools/releaseBuild/azureDevOps/diagram.puml | 2 ++ tools/releaseBuild/azureDevOps/diagram.svg | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) 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 From 4354f288ae80fb7f1fe9544f440aedd38ba10f29 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 26 Apr 2019 14:17:35 -0700 Subject: [PATCH 5/6] Update build.psm1 Co-Authored-By: adityapatwardhan --- build.psm1 | 1 + 1 file changed, 1 insertion(+) diff --git a/build.psm1 b/build.psm1 index f1b3237f1ee..60a37e07539 100644 --- a/build.psm1 +++ b/build.psm1 @@ -843,6 +843,7 @@ function Get-PesterTag { function Publish-PSTestTools { [CmdletBinding()] param( + [string] $runtime ) From bf51fe7b5e256df36d4714a61cc3bc1272b38c50 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 26 Apr 2019 14:17:46 -0700 Subject: [PATCH 6/6] Update tools/releaseBuild/azureDevOps/templates/testartifacts.yml Co-Authored-By: adityapatwardhan --- tools/releaseBuild/azureDevOps/templates/testartifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/azureDevOps/templates/testartifacts.yml b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml index 59e5841447b..3e72ed7038d 100644 --- a/tools/releaseBuild/azureDevOps/templates/testartifacts.yml +++ b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml @@ -13,7 +13,7 @@ jobs: - pwsh: | Import-Module ./build.psm1 - function BuildTestPackage($runtime) + function BuildTestPackage([string] $runtime) { Write-Verbose -Verbose "Starting to build package for $runtime"