Skip to content

Commit d9738a3

Browse files
authored
Add yaml and test files to support AzDO CI (#629)
* Initial changes for AzDO * Implement build and artifact upload
1 parent 316ebdc commit d9738a3

File tree

4 files changed

+614
-1
lines changed

4 files changed

+614
-1
lines changed

.azdo/ci.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: $(BuildDefinitionName)-$(date:yyMM).$(date:dd)$(rev:rrr)
2+
trigger:
3+
# Batch merge builds together while a merge build is running
4+
batch: true
5+
branches:
6+
include:
7+
- latestw_all
8+
pr:
9+
branches:
10+
include:
11+
- latestw_all
12+
13+
resources:
14+
repositories:
15+
- repository: ComplianceRepo
16+
type: github
17+
endpoint: ComplianceGHRepo
18+
name: PowerShell/compliance
19+
20+
stages:
21+
- stage: Build
22+
displayName: Build Win32-OpenSSH
23+
jobs:
24+
- job: BuildPkg
25+
displayName: Build Package
26+
pool:
27+
name: 1ES
28+
demands:
29+
- ImageOverride -equals PSMMS2019-OpenSSH-Secure
30+
31+
steps:
32+
- powershell: |
33+
$powerShellPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'powershell'
34+
Invoke-WebRequest -Uri https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 -outfile ./install-powershell.ps1
35+
./install-powershell.ps1 -Destination $powerShellPath
36+
$vstsCommandString = "vso[task.setvariable variable=PATH]$powerShellPath;$env:PATH"
37+
Write-Host "sending " + $vstsCommandString
38+
Write-Host "##$vstsCommandString"
39+
displayName: Install PowerShell Core
40+
41+
- pwsh: |
42+
Import-Module -Name "$(Build.SourcesDirectory)/contrib/win32/openssh/AzDOBuildTools" -Force
43+
Invoke-AzDOBuild
44+
displayName: Build Win32-OpenSSH
45+
46+
- pwsh: |
47+
$BuildOutPath = "$(Build.SourcesDirectory)/bin"
48+
$BuildOutx86Path = Join-Path -Path $BuildOutPath -ChildPath 'Win32/Release'
49+
Get-ChildItem -Path $BuildOutx86Path
50+
$BuildOutx64Path = Join-Path -Path $BuildOutPath -ChildPath 'x64/Release'
51+
Get-ChildItem -Path $BuildOutx64Path
52+
displayName: Capture build results
53+
54+
- pwsh: |
55+
Import-Module -Name "$(Build.SourcesDirectory)/contrib/win32/openssh/AzDOBuildTools" -Force
56+
$BuildDestPath = "$(Build.SourcesDirectory)/Win32-OpenSSH"
57+
if (Test-Path -Path $BuildDestPath) {
58+
Remove-Item -Path $BuildDestPath -Recurse -Force -ErrorAction SilentlyContinue
59+
}
60+
$null = New-Item -ItemType Directory -Path $BuildDestPath -Force
61+
# Copy build artifacts
62+
$BuildDestx86Path = Join-Path -Path $BuildDestPath -ChildPath 'x86/Release'
63+
Start-OpenSSHPackage -NativeHostArch x86 -Configuration Release -DestinationPath $BuildDestx86Path
64+
$BuildDestX64Path = Join-Path -Path $BuildDestPath -ChildPath 'x64/Release'
65+
Start-OpenSSHPackage -NativeHostArch x64 -Configuration Release -DestinationPath $BuildDestx64Path
66+
# Upload build artifacts
67+
$artifactName = 'Win32-OpenSSH'
68+
Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$BuildDestPath"
69+
displayName: Upload Win32-OpenSSH build artifacts
70+
71+
#- stage: Compliance
72+
# displayName: Compliance
73+
# dependsOn: Build
74+
# jobs:
75+
# - job: ComplianceJob
76+
# pool:
77+
# vmImage: windows-latest
78+
# steps:
79+
# - checkout: self
80+
# clean: true
81+
# - checkout: ComplianceRepo
82+
# clean: true
83+
# - download: current
84+
# artifact: 'Microsoft.PowerShell.SecretManagement'
85+
# - template: ci-compliance.yml@ComplianceRepo
86+
# parameters:
87+
# # credscan
88+
# suppressionsFile: ''
89+
90+
- stage: Test
91+
displayName: Test Win32-OpenSSH
92+
dependsOn: Build
93+
jobs:
94+
pool:
95+
vmImage: windows-latest
96+
steps:
97+
- powershell: |
98+
$powerShellPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'powershell'
99+
Invoke-WebRequest -Uri https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 -outfile ./install-powershell.ps1
100+
./install-powershell.ps1 -Destination $powerShellPath
101+
$vstsCommandString = "vso[task.setvariable variable=PATH]$powerShellPath;$env:PATH"
102+
Write-Host "sending " + $vstsCommandString
103+
Write-Host "##$vstsCommandString"
104+
displayName: Install PowerShell Core
105+
106+
- task: DownloadBuildArtifacts@0
107+
displayName: 'Download build artifacts'
108+
inputs:
109+
buildType: current
110+
downloadType: single
111+
artifactName: Win32-OpenSSH
112+
downloadPath: '$(System.ArtifactsDirectory)'
113+
114+
- pwsh: |
115+
Get-ChildItem -Path "$(System.ArtifactsDirectory)/* -Recurse"
116+
displayName: Capture downloaded artifact directory
117+
118+
- pwsh: |
119+
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
121+
displayName: Install Win32-OpenSSH
122+
123+
- pwsh: |
124+
Import-Module -Name "$(Build.SourcesDirectory)/contrib/win32/openssh/AzDOBuildTools" -Force
125+
Invoke-OpenSSHTests -OpenSSHBinPath "$env:SystemDrive/OpenSSH"
126+
Publish-OpenSSHTestResults # TODO: #
127+
displayName: Run tests and publish results
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
##
2+
## Azure DevOps CI build tools
3+
## (TODO: Add appropriate copyright)
4+
##
5+
@{
6+
7+
RootModule = './AzDOBuildTools.psm1'
8+
9+
ModuleVersion = '1.0.0'
10+
11+
GUID = '0b8fa798-ea71-40c7-b9ab-a417958bb3c4'
12+
13+
Author = 'Microsoft Corporation'
14+
15+
CompanyName = 'Microsoft Corporation'
16+
17+
Copyright = '(c) Microsoft Corporation. All rights reserved.'
18+
19+
Description = 'AzDO build tools for Win32-OpenSSH repository.'
20+
21+
PowerShellVersion = '5.1'
22+
DotnetFrameworkVersion = '4.6.1'
23+
CLRVersion = '4.0.0'
24+
25+
NestedModules = @(
26+
'../OpenSSHCommonUtils.psm1',
27+
'../OpenSSHBuildHelper.psm1',
28+
'../OpenSSHTestHelper.psm1')
29+
30+
FunctionsToExport = @(
31+
'Invoke-AllLocally',
32+
'Invoke-AzDOBuild',
33+
'Install-OpenSSH',
34+
'Invoke-OpenSSHTests',
35+
'Publish-OpenSSHTestResults')
36+
37+
}

0 commit comments

Comments
 (0)