diff --git a/.vsts-ci/linux.yml b/.vsts-ci/linux.yml index 1bee398..3f3281a 100644 --- a/.vsts-ci/linux.yml +++ b/.vsts-ci/linux.yml @@ -25,4 +25,4 @@ phases: - powershell: | tools/releaseBuild/vstsBuild.ps1 -Name $(buildName) -Verbose displayName: Start build - $(buildName) - condition: succeededOrFailed() + condition: succeeded() diff --git a/.vsts-ci/mac.yml b/.vsts-ci/mac.yml index c0b3dcb..78f53bf 100644 --- a/.vsts-ci/mac.yml +++ b/.vsts-ci/mac.yml @@ -17,8 +17,9 @@ phases: steps: - powershell: | tools/releaseBuild/PowershellNative.ps1 -Arch osx -Configuration Release -RepoRoot $(Build.SourcesDirectory) -TargetLocation "$(System.ArtifactsDirectory)/Packages" -Verbose - Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$(System.ArtifactsDirectory)/Packages/osx-symbols.zip" - $testResultPath = Get-ChildItem -Recurse -Filter 'native-tests.xml' - if($testResultPath -and (Test-Path $testResultPath)) { Write-Host "##vso[results.publish type=JUnit;mergeResults=true;runTitle=Native Test Results OSX;publishRunAttachments=true;resultFiles=$testResultPath;]"} displayName: Start build - condition: succeededOrFailed() + condition: succeeded() + - powershell: | + Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$(System.ArtifactsDirectory)/Packages/osx-symbols.zip" + displayName: Upload artifacts + condition: ne(variables['Build.Reason'], 'PullRequest') diff --git a/.vsts-ci/windows.yml b/.vsts-ci/windows.yml index 6c6ef5c..3d28029 100644 --- a/.vsts-ci/windows.yml +++ b/.vsts-ci/windows.yml @@ -29,7 +29,7 @@ phases: - powershell: | choco install cmake.install --installargs 'ADD_CMAKE_TO_PATH=System' displayName: Install cmake - condition: succeededOrFailed() + condition: succeeded() - powershell: | choco install windows-sdk-10.1 displayName: Install Windows SDK 10.1 @@ -39,13 +39,17 @@ phases: Start-Process -FilePath 'vs_BuildTools.exe' -ArgumentList '--quiet', '--norestart', '--locale en-US', '--add Microsoft.VisualStudio.Component.VC.Tools.ARM', '--add Microsoft.VisualStudio.Component.VC.Tools.ARM64', '--includeRecommended', '--add Microsoft.VisualStudio.Workload.VCTools', '--add Microsoft.VisualStudio.Component.Windows10SDK.16299.Desktop.arm', '--add Microsoft.VisualStudio.Component.VC.ATL', '--add Microsoft.VisualStudio.Component.VC.ATLMFC', '--add Microsoft.VisualStudio.Component.VC.ATL.ARM', '--add Microsoft.VisualStudio.Component.VC.ATL.ARM64' -Wait Remove-Item .\vs_BuildTools.exe Remove-Item -Force -Recurse 'C:\Program Files (x86)\Microsoft Visual Studio\Installer' - setx /M PATH $($Env:PATH + ';' + ${Env:ProgramFiles(x86)} + '\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin') + $vsPath = ${Env:ProgramFiles(x86)} + '\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin' + Write-Host "##vso[task.prependpath]$vsPath" displayName: Install Visual Studio 2017 condition: succeeded() - powershell: | $cmakeBinPath = "$env:ProgramFiles\CMake\bin\" if(Test-Path $cmakeBinPath) { $env:Path = "$cmakeBinPath;$env:PATH" } else { throw "CMake not installed under $cmakeBinPath" } $(Build.SourcesDirectory)\tools\releaseBuild\PowerShellNative.ps1 -RepoRoot $(Build.SourcesDirectory) -TargetLocation "$(System.ArtifactsDirectory)\Packages" -Arch $(buildName) -Configuration Release -Symbols - Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$(System.ArtifactsDirectory)\Packages\$(buildName)-symbols.zip" displayName: Start build - $(buildName) - condition: succeeded() \ No newline at end of file + condition: succeeded() + - powershell: | + Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$(System.ArtifactsDirectory)\Packages\$(buildName)-symbols.zip" + displayName: Upload artifacts + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) diff --git a/tools/releaseBuild/PowershellNative.ps1 b/tools/releaseBuild/PowershellNative.ps1 index cbe69bb..863d0a2 100644 --- a/tools/releaseBuild/PowershellNative.ps1 +++ b/tools/releaseBuild/PowershellNative.ps1 @@ -38,28 +38,30 @@ end { Start-PSBootstrap Start-BuildNativeUnixBinaries - $buildOutputPath = Join-Path $RepoRoot "src/powershell-unix" - Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose + if ($env:BUILD_REASON -ne 'PullRequest') { + $buildOutputPath = Join-Path $RepoRoot "src/powershell-unix" + Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose + } else { + Write-Verbose -Verbose "Skipping artifact upload since this is a PR." + } $testResultPath = Join-Path $RepoRoot -ChildPath 'src/libpsl-native/test/native-tests.xml' if (Test-Path $testResultPath) { - if ($Arch -eq 'linux-x64') { - $name = 'linux-x64-native-tests.xml' - } - else { - $name = 'osx-native-tests.xml' - } - - Copy-Item $testResultPath -Destination "$TargetLocation/$name" -Verbose + Copy-Item $testResultPath -Destination $TargetLocation -Verbose -Force } } elseif ($Arch -eq 'linux-arm') { Start-PSBootstrap -BuildLinuxArm Start-BuildNativeUnixBinaries -BuildLinuxArm - $buildOutputPath = Join-Path $RepoRoot "src/powershell-unix" - Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose + if ($env:BUILD_REASON -ne 'PullRequest') { + $buildOutputPath = Join-Path $RepoRoot "src/powershell-unix" + Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose + } else { + Write-Verbose -Verbose "Skipping artifact upload since this is a PR." + } + } else { Write-Verbose "Starting Start-PSBootstrap" -Verbose @@ -67,11 +69,16 @@ end { Write-Verbose "Starting Start-BuildNativeWindowsBinaries" -Verbose Start-BuildNativeWindowsBinaries -Configuration $Configuration -Arch $Arch -Clean Write-Verbose "Completed Start-BuildNativeWindowsBinaries" -Verbose - $buildOutputPath = Join-Path $RepoRoot "src/powershell-win-core" - Compress-Archive -Path "$buildOutputPath/*.dll" -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose - if ($Symbols.IsPresent) { - Compress-Archive -Path "$buildOutputPath/*.pdb" -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Update -Verbose + if ($env:BUILD_REASON -ne 'PullRequest') { + $buildOutputPath = Join-Path $RepoRoot "src/powershell-win-core" + Compress-Archive -Path "$buildOutputPath/*.dll" -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose + + if ($Symbols.IsPresent) { + Compress-Archive -Path "$buildOutputPath/*.pdb" -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Update -Verbose + } + } else { + Write-Verbose -Verbose "Skipping artifact upload since this is a PR." } } } diff --git a/tools/releaseBuild/vstsBuild.ps1 b/tools/releaseBuild/vstsBuild.ps1 index 3ee5c8b..23a0ea3 100644 --- a/tools/releaseBuild/vstsBuild.ps1 +++ b/tools/releaseBuild/vstsBuild.ps1 @@ -75,9 +75,9 @@ end { Write-VstsError -Error $_ } finally { - $testResultPath = Get-ChildItem $env:AGENT_TEMPDIRECTORY -Recurse -Filter 'linux-x64-native-tests.xml' + $testResultPath = Get-ChildItem $env:AGENT_TEMPDIRECTORY -Recurse -Filter 'native-tests.xml' - if($testResultPath -and (Test-Path $testResultPath)) { + if ($testResultPath -and (Test-Path $testResultPath)) { Write-Host "##vso[results.publish type=JUnit;mergeResults=true;runTitle=Native Test Results;publishRunAttachments=true;resultFiles=$testResultPath;]" } else {