Skip to content

Commit

Permalink
Fix daily CI builds to publish tar package as artifacts (PowerShell#8775
Browse files Browse the repository at this point in the history
)

Update the packaging script to always create the tar.gz packages.

## PR Context  

Daily builds for Linux and MacOS do not publish tar.gz package.
  • Loading branch information
adityapatwardhan authored and TravisEz13 committed Feb 4, 2019
1 parent 130298b commit ec12f37
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .vsts-ci/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ jobs:
# Uploads any packages as an artifact
- powershell: |
Get-ChildItem -Path *.rpm, *.deb, *.tar.gz, TestPackage.zip -Recurse | Select-Object -ExpandProperty FullName | ForEach-Object {
Get-ChildItem -Path ${env:BUILD_ARTIFACTSTAGINGDIRECTORY} -Include *.nupkg, *.rpm, *.deb, *.tar.gz, TestPackage.zip -Recurse | Select-Object -ExpandProperty FullName | ForEach-Object {
Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$_"
}
displayName: Publish Artifacts
condition: ne(variables['Build.Reason'], 'PullRequest')
condition: succeededOrFailed()
continueOnError: true
4 changes: 2 additions & 2 deletions .vsts-ci/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ jobs:
# Uploads any packages as an artifact
- powershell: |
Get-ChildItem -Path *.pkg, *.tar.gz, TestPackage.zip -Recurse | Select-Object -ExpandProperty FullName | ForEach-Object {
Get-ChildItem -Path ${env:BUILD_ARTIFACTSTAGINGDIRECTORY} -Include *.nupkg, *.pkg, *.tar.gz, TestPackage.zip -Recurse | Select-Object -ExpandProperty FullName | ForEach-Object {
Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$_"
}
displayName: Publish Artifacts
condition: ne(variables['Build.Reason'], 'PullRequest')
condition: succeededOrFailed()
continueOnError: true
6 changes: 3 additions & 3 deletions tools/ci.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,14 @@ function Invoke-AppVeyorAfterTest

Write-Host -ForegroundColor Green 'Upload CodeCoverage artifacts'
$codeCoverageArtifacts | ForEach-Object {
Push-Artifact -Path $_
Push-Artifact -Path $_ -Name 'CodeCoverage'
}

New-TestPackage -Destination (Get-Location).Path
$testPackageFullName = Join-Path $pwd 'TestPackage.zip'
Write-Verbose "Created TestPackage.zip" -Verbose
Write-Host -ForegroundColor Green 'Upload test package'
Push-Artifact $testPackageFullName
Push-Artifact $testPackageFullName -Name 'artifacts'
}
}

Expand Down Expand Up @@ -568,7 +568,7 @@ function Invoke-AppveyorFinish
Write-Host "Pushing $_ as Appveyor artifact"
if(Test-Path $_)
{
Push-Artifact -Path $_
Push-Artifact -Path $_ -Name 'artifacts'
}
else
{
Expand Down
16 changes: 8 additions & 8 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,16 @@ function Start-PSPackage {
if (-not $Type) {
$Type = if ($Environment.IsLinux) {
if ($Environment.LinuxInfo.ID -match "ubuntu") {
"deb", "nupkg"
"deb", "nupkg", "tar"
} elseif ($Environment.IsRedHatFamily) {
"rpm", "nupkg"
"rpm", "nupkg", "tar"
} elseif ($Environment.IsSUSEFamily) {
"rpm", "nupkg"
"rpm", "nupkg", "tar"
} else {
throw "Building packages for $($Environment.LinuxInfo.PRETTY_NAME) is unsupported!"
}
} elseif ($Environment.IsMacOS) {
"osxpkg", "nupkg"
"osxpkg", "nupkg", "tar"
} elseif ($Environment.IsWindows) {
"msi", "nupkg"
}
Expand Down Expand Up @@ -521,7 +521,7 @@ function New-TarballPackage {

if (Test-Path -Path $packagePath) {
Write-Log "You can find the tarball package at $packagePath"
return $packagePath
return (Get-Item $packagePath)
} else {
throw "Failed to create $packageName"
}
Expand Down Expand Up @@ -952,15 +952,15 @@ function New-MacOsDistributionPackage
try
{
# productbuild is an xcode command line tool, and those tools are installed when you install brew
Start-NativeExecution -sb {productbuild --distribution $distributionXmlPath --resources $resourcesDir $newPackagePath}
Start-NativeExecution -sb {productbuild --distribution $distributionXmlPath --resources $resourcesDir $newPackagePath} -VerboseOutputOnError
}
finally
{
Pop-Location
Remove-item -Path $tempDir -Recurse -Force
}

return $newPackagePath
return (Get-Item $newPackagePath)
}
function Get-FpmArguments
{
Expand Down Expand Up @@ -2246,7 +2246,7 @@ function New-NugetContentPackage
$nupkgFile = "${nugetFolder}\${nuspecPackageName}-${packageRuntime}.${nugetSemanticVersion}.nupkg"
if (Test-Path $nupkgFile)
{
Get-ChildItem $nugetFolder\* | Select-Object -ExpandProperty FullName
Get-Item $nupkgFile
}
else
{
Expand Down
32 changes: 30 additions & 2 deletions tools/travis.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,15 @@ elseif($Stage -eq 'Build')
$packages = @(Start-PSPackage @packageParams -SkipReleaseChecks)
foreach($package in $packages)
{
if (Test-Path $package)
{
Write-Log "Package found: $package"
}
else
{
Write-Error -Message "Package NOT found: $package"
}

# Publish the packages to the nuget feed if:
# 1 - It's a Daily build (already checked, for not a PR)
# 2 - We have the info to publish (NUGET_KEY and NUGET_URL)
Expand All @@ -368,17 +377,36 @@ elseif($Stage -eq 'Build')
Write-Log "pushing $package to $env:NUGET_URL"
Start-NativeExecution -sb {dotnet nuget push $package --api-key $NugetKey --source "$env:NUGET_URL/api/v2/package"} -IgnoreExitcode
}

if($isDailyBuild)
{
if ($package -isnot [System.IO.FileInfo])
{
$packageObj = Get-Item $package
Write-Error -Message "The PACKAGE is not a FileInfo object"
}
else
{
$packageObj = $package
}

Write-Log -message "Artifacts directory: ${env:BUILD_ARTIFACTSTAGINGDIRECTORY}"

Copy-Item $packageObj.FullName -Destination "${env:BUILD_ARTIFACTSTAGINGDIRECTORY}" -Force
}
}

if ($IsLinux)
{
# Create and package Raspbian .tgz
Start-PSBuild -PSModuleRestore -Clean -Runtime linux-arm -Configuration 'Release'
Start-PSPackage @packageParams -Type tar-arm -SkipReleaseChecks
$armPackage = Start-PSPackage @packageParams -Type tar-arm -SkipReleaseChecks
Copy-Item $armPackage -Destination "${env:BUILD_ARTIFACTSTAGINGDIRECTORY}" -Force
}

if ($isDailyBuild)
{
New-TestPackage -Destination $pwd
New-TestPackage -Destination "${env:SYSTEM_ARTIFACTSDIRECTORY}"
}
}

Expand Down

0 comments on commit ec12f37

Please sign in to comment.