mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Build test packages for windows, linux-x64, linux-arm, linux-arm64 and macOS (#9476)
This commit is contained in:
committed by
Travis Plunk
parent
e81aa9882c
commit
9f429f0206
+13
-4
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
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"
|
||||
}
|
||||
|
||||
$packageName = if ($IsWindows) {
|
||||
"TestPackage-win.zip"
|
||||
}
|
||||
elseif ($IsLinux) {
|
||||
"TestPackage-linux.zip"
|
||||
}
|
||||
else {
|
||||
"TestPackage-macOS.zip"
|
||||
}
|
||||
BuildTestPackage -runtime win7-x64
|
||||
BuildTestPackage -runtime linux-x64
|
||||
BuildTestPackage -runtime linux-arm
|
||||
BuildTestPackage -runtime linux-arm64
|
||||
BuildTestPackage -runtime osx-x64
|
||||
|
||||
Rename-Item $(System.ArtifactsDirectory)/TestPackage.zip $packageName
|
||||
|
||||
Write-Host "##vso[artifact.upload containerfolder=testArtifacts;artifactname=testArtifacts]$(System.ArtifactsDirectory)/$packageName"
|
||||
displayName: Upload to build artifacts
|
||||
displayName: Build test package and upload
|
||||
|
||||
Reference in New Issue
Block a user