diff --git a/.vsts-ci/linux.yml b/.vsts-ci/linux.yml index e46adcb682f..5865686ae8f 100644 --- a/.vsts-ci/linux.yml +++ b/.vsts-ci/linux.yml @@ -78,7 +78,7 @@ phases: # Uploads any packages as an artifact - powershell: | - Get-ChildItem -Path *.rpm, *.deb, *.tar.gz -Recurse | Select-Object -ExpandProperty FullName | ForEach-Object { + Get-ChildItem -Path *.rpm, *.deb, *.tar.gz, *.zip -Recurse | Select-Object -ExpandProperty FullName | ForEach-Object { Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$_" } displayName: Publish Artifacts diff --git a/.vsts-ci/mac.yml b/.vsts-ci/mac.yml index 55212e9d868..985d905c7b3 100644 --- a/.vsts-ci/mac.yml +++ b/.vsts-ci/mac.yml @@ -53,7 +53,7 @@ phases: # Uploads any packages as an artifact - powershell: | - Get-ChildItem -Path *.pkg, *.tar.gz -Recurse | Select-Object -ExpandProperty FullName | ForEach-Object { + Get-ChildItem -Path *.pkg, *.tar.gz, *.zip -Recurse | Select-Object -ExpandProperty FullName | ForEach-Object { Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$_" } displayName: Publish Artifacts diff --git a/build.psm1 b/build.psm1 index 89c45bd1937..931fd8977fa 100644 --- a/build.psm1 +++ b/build.psm1 @@ -2972,3 +2972,64 @@ $script:RESX_TEMPLATE = @' {0} '@ + +function New-TestPackage +{ + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string] $Destination + ) + + if (Test-Path $Destination -PathType Leaf) + { + throw "Destination: '$Destination' is not a directory or does not exist." + } + else + { + $null = New-Item -Path $Destination -ItemType Directory -Force + Write-Verbose -Message "Creating destination folder: $Destination" + } + + $packageRoot = Join-Path $env:TEMP ('TestPackage-' + (new-guid)) + $null = New-Item -ItemType Directory -Path $packageRoot -Force + $packagePath = Join-Path $Destination "TestPackage.zip" + + # Build test tools so they are placed in appropriate folders under 'test' then copy to package root. + $null = Publish-PSTestTools + $powerShellTestRoot = Join-Path $PSScriptRoot 'test' + Copy-Item $powerShellTestRoot -Recurse -Destination $packageRoot -Force + Write-Verbose -Message "Copied test directory" + + # Copy assests folder to package root for wix related tests. + $assetsPath = Join-Path $PSScriptRoot 'assets' + Copy-Item $assetsPath -Recurse -Destination $packageRoot -Force + Write-Verbose -Message "Copied assests directory" + + # Create expected folder structure for resx files in package root. + $srcRootForResx = New-Item -Path "$packageRoot/src" -Force -ItemType Directory + + $resourceDirectories = Get-ChildItem -Recurse "$PSScriptRoot/src" -Directory -Filter 'resources' + + $resourceDirectories | ForEach-Object { + $directoryFullName = $_.FullName + + $partToRemove = Join-Path $PSScriptRoot "src" + + $assemblyPart = $directoryFullName.Replace($partToRemove, '') + $assemblyPart = $assemblyPart.TrimStart([io.path]::DirectorySeparatorChar) + $resxDestPath = Join-Path $srcRootForResx $assemblyPart + $null = New-Item -Path $resxDestPath -Force -ItemType Directory + Write-Verbose -Message "Created resx directory : $resxDestPath" + Copy-Item -Path "$directoryFullName\*" -Recurse $resxDestPath -Force + } + + Add-Type -AssemblyName System.IO.Compression.FileSystem + + if(Test-Path $packagePath) + { + Remove-Item -Path $packagePath -Force + } + + [System.IO.Compression.ZipFile]::CreateFromDirectory($packageRoot, $packagePath) +} diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index b70cb093cd5..07685c4f0ea 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -468,6 +468,12 @@ function Invoke-AppVeyorAfterTest Write-Host -ForegroundColor Green 'Upload CodeCoverage artifacts' $codeCoverageArtifacts | ForEach-Object { Push-AppveyorArtifact $_ } + + New-TestPackage -Destination $pwd + $testPackageFullName = Join-Path $pwd 'TestPackage.zip' + Write-Verbose "Created TestPackage.zip" -Verbose + Write-Host -ForegroundColor Green -'Upload test package' + Push-AppveyorArtifact $testPackageFullName } } diff --git a/tools/travis.ps1 b/tools/travis.ps1 index 791ca4560cb..a9823e2a6cd 100644 --- a/tools/travis.ps1 +++ b/tools/travis.ps1 @@ -370,6 +370,11 @@ elseif($Stage -eq 'Build') Start-PSBuild -PSModuleRestore -Clean -Runtime linux-arm -Configuration 'Release' Start-PSPackage @packageParams -Type tar-arm -SkipReleaseChecks } + + if ($isDailyBuild) + { + New-TestPackage -Destination $pwd + } } # if the tests did not pass, throw the reason why