diff --git a/.vsts-ci/linux.yml b/.vsts-ci/linux.yml index fd9aade734..66e2e2c7c5 100644 --- a/.vsts-ci/linux.yml +++ b/.vsts-ci/linux.yml @@ -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 diff --git a/.vsts-ci/mac.yml b/.vsts-ci/mac.yml index f9e8348fa3..842464a98f 100644 --- a/.vsts-ci/mac.yml +++ b/.vsts-ci/mac.yml @@ -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 diff --git a/tools/ci.psm1 b/tools/ci.psm1 index bda8323a93..f268663f25 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -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' } } @@ -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 { diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 1172516487..3d70f78a0b 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -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" } @@ -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" } @@ -952,7 +952,7 @@ 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 { @@ -960,7 +960,7 @@ function New-MacOsDistributionPackage Remove-item -Path $tempDir -Recurse -Force } - return $newPackagePath + return (Get-Item $newPackagePath) } function Get-FpmArguments { @@ -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 { diff --git a/tools/travis.ps1 b/tools/travis.ps1 index 9717654f2a..2b08cddf95 100644 --- a/tools/travis.ps1 +++ b/tools/travis.ps1 @@ -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) @@ -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}" } }