Skip to content

Commit 047f132

Browse files
Fix CI builds (#14)
* Fix CI PR by making artifacts optional * Add newline at end
1 parent 1957c55 commit 047f132

File tree

5 files changed

+39
-27
lines changed

5 files changed

+39
-27
lines changed

.vsts-ci/linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ phases:
2525
- powershell: |
2626
tools/releaseBuild/vstsBuild.ps1 -Name $(buildName) -Verbose
2727
displayName: Start build - $(buildName)
28-
condition: succeededOrFailed()
28+
condition: succeeded()

.vsts-ci/mac.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ phases:
1717
steps:
1818
- powershell: |
1919
tools/releaseBuild/PowershellNative.ps1 -Arch osx -Configuration Release -RepoRoot $(Build.SourcesDirectory) -TargetLocation "$(System.ArtifactsDirectory)/Packages" -Verbose
20-
Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$(System.ArtifactsDirectory)/Packages/osx-symbols.zip"
21-
$testResultPath = Get-ChildItem -Recurse -Filter 'native-tests.xml'
22-
if($testResultPath -and (Test-Path $testResultPath)) { Write-Host "##vso[results.publish type=JUnit;mergeResults=true;runTitle=Native Test Results OSX;publishRunAttachments=true;resultFiles=$testResultPath;]"}
2320
displayName: Start build
24-
condition: succeededOrFailed()
21+
condition: succeeded()
22+
- powershell: |
23+
Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$(System.ArtifactsDirectory)/Packages/osx-symbols.zip"
24+
displayName: Upload artifacts
25+
condition: ne(variables['Build.Reason'], 'PullRequest')

.vsts-ci/windows.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ phases:
2929
- powershell: |
3030
choco install cmake.install --installargs 'ADD_CMAKE_TO_PATH=System'
3131
displayName: Install cmake
32-
condition: succeededOrFailed()
32+
condition: succeeded()
3333
- powershell: |
3434
choco install windows-sdk-10.1
3535
displayName: Install Windows SDK 10.1
@@ -39,13 +39,17 @@ phases:
3939
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
4040
Remove-Item .\vs_BuildTools.exe
4141
Remove-Item -Force -Recurse 'C:\Program Files (x86)\Microsoft Visual Studio\Installer'
42-
setx /M PATH $($Env:PATH + ';' + ${Env:ProgramFiles(x86)} + '\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin')
42+
$vsPath = ${Env:ProgramFiles(x86)} + '\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin'
43+
Write-Host "##vso[task.prependpath]$vsPath"
4344
displayName: Install Visual Studio 2017
4445
condition: succeeded()
4546
- powershell: |
4647
$cmakeBinPath = "$env:ProgramFiles\CMake\bin\"
4748
if(Test-Path $cmakeBinPath) { $env:Path = "$cmakeBinPath;$env:PATH" } else { throw "CMake not installed under $cmakeBinPath" }
4849
$(Build.SourcesDirectory)\tools\releaseBuild\PowerShellNative.ps1 -RepoRoot $(Build.SourcesDirectory) -TargetLocation "$(System.ArtifactsDirectory)\Packages" -Arch $(buildName) -Configuration Release -Symbols
49-
Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$(System.ArtifactsDirectory)\Packages\$(buildName)-symbols.zip"
5050
displayName: Start build - $(buildName)
51-
condition: succeeded()
51+
condition: succeeded()
52+
- powershell: |
53+
Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$(System.ArtifactsDirectory)\Packages\$(buildName)-symbols.zip"
54+
displayName: Upload artifacts
55+
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

tools/releaseBuild/PowershellNative.ps1

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,40 +38,47 @@ end {
3838
Start-PSBootstrap
3939
Start-BuildNativeUnixBinaries
4040

41-
$buildOutputPath = Join-Path $RepoRoot "src/powershell-unix"
42-
Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose
41+
if ($env:BUILD_REASON -ne 'PullRequest') {
42+
$buildOutputPath = Join-Path $RepoRoot "src/powershell-unix"
43+
Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose
44+
} else {
45+
Write-Verbose -Verbose "Skipping artifact upload since this is a PR."
46+
}
4347

4448
$testResultPath = Join-Path $RepoRoot -ChildPath 'src/libpsl-native/test/native-tests.xml'
4549

4650
if (Test-Path $testResultPath) {
47-
if ($Arch -eq 'linux-x64') {
48-
$name = 'linux-x64-native-tests.xml'
49-
}
50-
else {
51-
$name = 'osx-native-tests.xml'
52-
}
53-
54-
Copy-Item $testResultPath -Destination "$TargetLocation/$name" -Verbose
51+
Copy-Item $testResultPath -Destination $TargetLocation -Verbose -Force
5552
}
5653
}
5754
elseif ($Arch -eq 'linux-arm') {
5855
Start-PSBootstrap -BuildLinuxArm
5956
Start-BuildNativeUnixBinaries -BuildLinuxArm
6057

61-
$buildOutputPath = Join-Path $RepoRoot "src/powershell-unix"
62-
Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose
58+
if ($env:BUILD_REASON -ne 'PullRequest') {
59+
$buildOutputPath = Join-Path $RepoRoot "src/powershell-unix"
60+
Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose
61+
} else {
62+
Write-Verbose -Verbose "Skipping artifact upload since this is a PR."
63+
}
64+
6365
}
6466
else {
6567
Write-Verbose "Starting Start-PSBootstrap" -Verbose
6668
Start-PSBootstrap -BuildWindowsNative
6769
Write-Verbose "Starting Start-BuildNativeWindowsBinaries" -Verbose
6870
Start-BuildNativeWindowsBinaries -Configuration $Configuration -Arch $Arch -Clean
6971
Write-Verbose "Completed Start-BuildNativeWindowsBinaries" -Verbose
70-
$buildOutputPath = Join-Path $RepoRoot "src/powershell-win-core"
71-
Compress-Archive -Path "$buildOutputPath/*.dll" -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose
7272

73-
if ($Symbols.IsPresent) {
74-
Compress-Archive -Path "$buildOutputPath/*.pdb" -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Update -Verbose
73+
if ($env:BUILD_REASON -ne 'PullRequest') {
74+
$buildOutputPath = Join-Path $RepoRoot "src/powershell-win-core"
75+
Compress-Archive -Path "$buildOutputPath/*.dll" -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose
76+
77+
if ($Symbols.IsPresent) {
78+
Compress-Archive -Path "$buildOutputPath/*.pdb" -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Update -Verbose
79+
}
80+
} else {
81+
Write-Verbose -Verbose "Skipping artifact upload since this is a PR."
7582
}
7683
}
7784
}

tools/releaseBuild/vstsBuild.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ end {
7575
Write-VstsError -Error $_
7676
}
7777
finally {
78-
$testResultPath = Get-ChildItem $env:AGENT_TEMPDIRECTORY -Recurse -Filter 'linux-x64-native-tests.xml'
78+
$testResultPath = Get-ChildItem $env:AGENT_TEMPDIRECTORY -Recurse -Filter 'native-tests.xml'
7979

80-
if($testResultPath -and (Test-Path $testResultPath)) {
80+
if ($testResultPath -and (Test-Path $testResultPath)) {
8181
Write-Host "##vso[results.publish type=JUnit;mergeResults=true;runTitle=Native Test Results;publishRunAttachments=true;resultFiles=$testResultPath;]"
8282
}
8383
else {

0 commit comments

Comments
 (0)