10
10
include :
11
11
- latestw_all
12
12
13
- resources :
14
- repositories :
15
- - repository : ComplianceRepo
16
- type : github
17
- endpoint : ComplianceGHRepo
18
- name : PowerShell/compliance
13
+ # resources:
14
+ # repositories:
15
+ # - repository: ComplianceRepo
16
+ # type: github
17
+ # endpoint: ComplianceGHRepo
18
+ # name: PowerShell/compliance
19
19
20
20
stages :
21
21
- stage : Build
@@ -24,7 +24,7 @@ stages:
24
24
- job : BuildPkg
25
25
displayName : Build Package
26
26
pool :
27
- name : 1ES
27
+ name : PS-PowerShell-x64
28
28
demands :
29
29
- ImageOverride -equals PSMMS2019-OpenSSH-Secure
30
30
@@ -53,19 +53,39 @@ stages:
53
53
54
54
- pwsh : |
55
55
Import-Module -Name "$(Build.SourcesDirectory)/contrib/win32/openssh/AzDOBuildTools" -Force
56
+ #
57
+ # Copy build artifacts
56
58
$BuildDestPath = "$(Build.SourcesDirectory)/Win32-OpenSSH"
57
59
if (Test-Path -Path $BuildDestPath) {
58
60
Remove-Item -Path $BuildDestPath -Recurse -Force -ErrorAction SilentlyContinue
59
61
}
60
62
$null = New-Item -ItemType Directory -Path $BuildDestPath -Force
61
- # Copy build artifacts
62
63
$BuildDestx86Path = Join-Path -Path $BuildDestPath -ChildPath 'x86/Release'
63
- Start-OpenSSHPackage - NativeHostArch x86 -Configuration Release -DestinationPath $BuildDestx86Path
64
+ Copy-BuildResults -BuildResultsPath $BuildDestx86Path - NativeHostArch x86 -Configuration Release
64
65
$BuildDestX64Path = Join-Path -Path $BuildDestPath -ChildPath 'x64/Release'
65
- Start-OpenSSHPackage -NativeHostArch x64 -Configuration Release -DestinationPath $BuildDestx64Path
66
+ Copy-BuildResults -BuildResultsPath $BuildDestx64Path -NativeHostArch x64 -Configuration Release
67
+ #
66
68
# Upload build artifacts
69
+ Write-Verbose -Verbose -Message "Uploading build artifacts"
67
70
$artifactName = 'Win32-OpenSSH'
68
71
Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$BuildDestPath"
72
+ #
73
+ # Copy unit tests
74
+ $BuildOutPath = "$(Build.SourcesDirectory)/bin"
75
+ $UnitTestDestPath = "$(Build.SourcesDirectory)/UnitTests"
76
+ Copy-UnitTests -UnitTestsSrcDir $BuildOutPath -UnitTestsDestDir $UnitTestDestPath -NativeHostArch x86 -Configuration Release
77
+ Copy-UnitTests -UnitTestsSrcDir $BuildOutPath -UnitTestsDestDir $UnitTestDestPath -NativeHostArch x64 -Configuration Release
78
+ #
79
+ # Upload unit test artifacts
80
+ Write-Verbose -Verbose -Message "Uploading unit test artifacts"
81
+ $artifactName = 'UnitTests'
82
+ Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$UnitTestDestPath"
83
+ #
84
+ # Upload bash tests config.h file
85
+ Write-Verbose -Verbose -Message "Uploading config.h file for bash tests"
86
+ $artifactName = 'ConfigFile'
87
+ $configFilePath = "$(Build.SourcesDirectory)/config.h"
88
+ Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$configFilePath"
69
89
displayName: Upload Win32-OpenSSH build artifacts
70
90
71
91
# - stage: Compliance
@@ -91,17 +111,19 @@ stages:
91
111
displayName : Test Win32-OpenSSH
92
112
dependsOn : Build
93
113
jobs :
94
- pool :
95
- vmImage : windows-latest
96
- steps :
97
- - powershell : |
114
+ - job : TestPkgWin32OpenSSH
115
+ pool :
116
+ vmImage : windows-latest
117
+ displayName : Win32-OpenSSH On Windows
118
+ steps :
119
+ - powershell : |
98
120
$powerShellPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'powershell'
99
121
Invoke-WebRequest -Uri https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 -outfile ./install-powershell.ps1
100
122
./install-powershell.ps1 -Destination $powerShellPath
101
123
$vstsCommandString = "vso[task.setvariable variable=PATH]$powerShellPath;$env:PATH"
102
124
Write-Host "sending " + $vstsCommandString
103
125
Write-Host "##$vstsCommandString"
104
- displayName: Install PowerShell Core
126
+ displayName: ' Install PowerShell Core'
105
127
106
128
- task : DownloadBuildArtifacts@0
107
129
displayName : ' Download build artifacts'
@@ -111,25 +133,81 @@ stages:
111
133
artifactName : Win32-OpenSSH
112
134
downloadPath : ' $(System.ArtifactsDirectory)'
113
135
136
+ - task : DownloadBuildArtifacts@0
137
+ displayName : ' Download unit test artifacts'
138
+ inputs :
139
+ buildType : current
140
+ downloadType : single
141
+ artifactName : UnitTests
142
+ downloadPath : ' $(System.ArtifactsDirectory)'
143
+
144
+ - task : DownloadBuildArtifacts@0
145
+ displayName : ' Download bash test config file artifact'
146
+ inputs :
147
+ buildType : current
148
+ downloadType : single
149
+ artifactName : ConfigFile
150
+ downloadPath : ' $(System.ArtifactsDirectory)'
151
+
114
152
- pwsh : |
115
- Get-ChildItem -Path "$(System.ArtifactsDirectory)/* -Recurse"
153
+ $artifactDir = "$(System.ArtifactsDirectory)"
154
+ Write-Verbose -Verbose -Message "Artifacts directory: $artifactDir"
155
+ Get-ChildItem -Path $artifactDir -Recurse
116
156
displayName: Capture downloaded artifact directory
117
157
118
158
- pwsh : |
119
159
Import-Module -Name "$(Build.SourcesDirectory)/contrib/win32/openssh/AzDOBuildTools" -Force
120
- Install-OpenSSH -SourceDir "$(System.ArtifactsDirectory)/Win32-OpenSSH/x64/Release/* " -OpenSSHDir "$env:SystemDrive/OpenSSH" -NativeHostArch x64 -Configuration Release -Verbose
160
+ Install-OpenSSH -SourceDir "$(System.ArtifactsDirectory)/Win32-OpenSSH/x64/Release" -OpenSSHDir "$env:SystemDrive/OpenSSH" -Verbose
121
161
displayName: Install Win32-OpenSSH
122
-
162
+
123
163
- pwsh : |
164
+ Import-Module -Name "$(Build.SourcesDirectory)/contrib/win32/openssh/AzDOBuildTools" -Force
165
+ Install-UnitTests -SourceDir "$(System.ArtifactsDirectory)/UnitTests/x64/Release" -OpenSSHDir "$env:SystemDrive/OpenSSH" -Verbose
166
+ displayName: Install Unit Tests
167
+
168
+ - pwsh : |
169
+ $configFileSrc = "$(System.ArtifactsDirectory)/ConfigFile/config.h"
170
+ $configFileDest = "$(Build.SourcesDirectory)"
171
+ Write-Verbose -Verbose -Message "Copying config file from: ${configFileSrc} to: ${configFileDest}"
172
+ Copy-Item -Path $configFileSrc -Dest $configFileDest -Force
173
+ displayName: Copy config file artifact for bash tests
174
+
175
+ - pwsh : |
176
+ $sourceDir = "$(Build.SourcesDirectory)"
177
+ Write-Verbose -Verbose -Message "Source repo directory: $sourceDir"
178
+ Get-ChildItem -Path $sourceDir
179
+ displayName: Capture source repo directory for test
180
+
181
+ - pwsh : |
182
+ $installedOpenSSHDir = "$env:SystemDrive/OpenSSH"
183
+ Write-Verbose -Verbose -Message "Installed OpenSSH directory: $installedOpenSSHDir"
184
+ Get-ChildItem -Path $installedOpenSSHDir -Recurse
185
+ displayName: Capture installed OpenSSH directory
186
+
187
+ - pwsh : |
188
+ # Run OpenSSH tests
124
189
Import-Module -Name "$(Build.SourcesDirectory)/contrib/win32/openssh/AzDOBuildTools" -Force
125
190
Invoke-OpenSSHTests -OpenSSHBinPath "$env:SystemDrive/OpenSSH"
191
+ displayName: Run tests
192
+
193
+ - pwsh : |
194
+ Import-Module -Name "$(Build.SourcesDirectory)/contrib/win32/openssh/AzDOBuildTools" -Force
195
+ #
126
196
# Copy test results to results directory
127
197
$ResultsDirectory = "$(Build.SourcesDirectory)/Win32OpenSSHTestResults"
128
198
Copy-OpenSSHTestResults -ResultsPath $ResultsDirectory
199
+ #
129
200
# Upload test results artifact
130
201
if (Test-Path -Path $ResultsDirectory)
131
202
{
132
203
$artifactName = 'Win32-OpenSSH-TestResults'
133
204
Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$ResultsDirectory"
134
205
}
135
- displayName: Run tests and publish results
206
+ displayName: Upload test results
207
+ condition: always()
208
+
209
+ - pwsh : |
210
+ Import-Module -Name "$(Build.SourcesDirectory)/contrib/win32/openssh/AzDOBuildTools" -Force
211
+ Clear-TestEnvironmentSetup
212
+ displayName: Clean up OpenSSH test environment
213
+ condition: always()
0 commit comments