Skip to content

Commit 6e698f8

Browse files
Change CI and release build to use hosted images for windows (#47)
1 parent 13995fc commit 6e698f8

File tree

4 files changed

+120
-17
lines changed

4 files changed

+120
-17
lines changed

.vsts-ci/windows.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ variables:
99
resources:
1010
- repo: self
1111
clean: true
12-
phases:
13-
- phase: Build
1412

15-
queue:
16-
name: Hosted Windows Container
17-
parallel: 4
13+
jobs:
14+
- job: Build
15+
16+
pool:
17+
vmImage: vs2017-win2016
18+
19+
strategy:
1820
matrix:
1921
Windows x86:
2022
buildName: x86
@@ -31,17 +33,9 @@ phases:
3133
displayName: Install cmake
3234
condition: succeeded()
3335
- powershell: |
34-
choco install windows-sdk-10.1
35-
displayName: Install Windows SDK 10.1
36-
condition: succeeded()
37-
- powershell: |
38-
Invoke-WebRequest "https://aka.ms/vs/15/release/vs_BuildTools.exe" -OutFile vs_BuildTools.exe -UseBasicParsing
39-
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.Spectre', '--add Microsoft.VisualStudio.Component.VC.ATLMFC.Spectre', '--add Microsoft.VisualStudio.Component.VC.ATL.ARM.Spectre', '--add Microsoft.VisualStudio.Component.VC.ATL.ARM64.Spectre', '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre', '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre', '--add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre' -Wait
40-
Remove-Item .\vs_BuildTools.exe
41-
Remove-Item -Force -Recurse 'C:\Program Files (x86)\Microsoft Visual Studio\Installer'
4236
$vsPath = ${Env:ProgramFiles(x86)} + '\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin'
4337
Write-Host "##vso[task.prependpath]$vsPath"
44-
displayName: Install Visual Studio 2017
38+
displayName: Set Visual Studio Path
4539
condition: succeeded()
4640
- powershell: |
4741
$cmakeBinPath = "$env:ProgramFiles\CMake\bin\"

tools/releaseBuild/yaml/releaseBuild.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
trigger: none
2+
13
variables:
24
AuthenticodeSignType: '400'
35
BuildConfiguration: 'Release'
@@ -10,12 +12,30 @@ stages:
1012
dependsOn: []
1113
jobs:
1214
- job: BuildWin
15+
pool:
16+
vmImage: vs2017-win2016
17+
displayName: Windows
18+
strategy:
19+
matrix:
20+
x64:
21+
ARCHITECTURE: x64
22+
x86:
23+
ARCHITECTURE: x86
24+
x64ARM:
25+
ARCHITECTURE: x64_arm
26+
x64ARM64:
27+
ARCHITECTURE: x64_arm64
28+
steps:
29+
- template: windows-build.yml
30+
31+
- job: SignWin
1332
pool:
1433
name: PowerShell
1534
demands:
1635
- DotNetFramework
1736
- Agent.Image
18-
displayName: Windows
37+
displayName: Sign Windows
38+
dependsOn: BuildWin
1939
strategy:
2040
matrix:
2141
x64:
@@ -27,7 +47,7 @@ stages:
2747
x64ARM64:
2848
ARCHITECTURE: x64_arm64
2949
steps:
30-
- template: windows.yml
50+
- template: windows-sign.yml
3151

3252
- job: BuildLinux
3353
displayName: Linux
@@ -55,7 +75,7 @@ stages:
5575
- job: BuildNuGetPkg
5676
displayName: Build NuGet Package
5777
dependsOn:
58-
- BuildWin
78+
- SignWin
5979
- BuildLinux
6080
- BuildMac
6181
pool:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
steps:
2+
- powershell: |
3+
choco install cmake.install --installargs 'ADD_CMAKE_TO_PATH=System'
4+
displayName: Install cmake
5+
condition: succeeded()
6+
- powershell: |
7+
$vsPath = ${Env:ProgramFiles(x86)} + '\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin'
8+
Write-Host "##vso[task.prependpath]$vsPath"
9+
displayName: Set Visual Studio Path
10+
condition: succeeded()
11+
- powershell: |
12+
$cmakeBinPath = "$env:ProgramFiles\CMake\bin\"
13+
if(Test-Path $cmakeBinPath) { $env:Path = "$cmakeBinPath;$env:PATH" } else { throw "CMake not installed under $cmakeBinPath" }
14+
$(Build.SourcesDirectory)\tools\releaseBuild\PowerShellNative.ps1 -RepoRoot $(Build.SourcesDirectory) -TargetLocation "$(System.ArtifactsDirectory)\Packages" -Arch $(ARCHITECTURE) -Configuration Release -Symbols
15+
displayName: Start build - $(ARCHITECTURE)
16+
condition: succeeded()
17+
- powershell: |
18+
Write-Host "##vso[artifact.upload containerfolder=release;artifactname=release]$(System.ArtifactsDirectory)\Packages\$(ARCHITECTURE)-symbols.zip"
19+
displayName: Upload artifacts
20+
condition: succeeded()
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
steps:
2+
- task: PkgESSetupBuild@10
3+
displayName: 'Initialize build'
4+
env:
5+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
6+
inputs:
7+
useDfs: false
8+
productName: PowerShellCore
9+
branchVersion: true
10+
disableWorkspace: true
11+
disableBuildTools: true
12+
disableNugetPack: true
13+
condition: and(succeeded(), eq(variables['Build.Reason'], 'Manual'))
14+
15+
- task: DownloadBuildArtifacts@0
16+
inputs:
17+
buildType: current
18+
artifactName: release
19+
20+
- powershell: |
21+
$zipFilePath = '$(System.ArtifactsDirectory)\release\$(ARCHITECTURE)-symbols.zip'
22+
Get-ChildItem $zipFilePath -Verbose
23+
24+
Expand-Archive $zipFilePath -Destination '$(System.ArtifactsDirectory)\Expanded' -Force
25+
26+
$vstsCommandString = "vso[task.setvariable variable=Symbols]$(System.ArtifactsDirectory)\Expanded"
27+
Write-Host "sending " + $vstsCommandString
28+
Write-Host "##$vstsCommandString"
29+
displayName: Expand artifact $(ARCHITECTURE)-symbols.zip
30+
31+
- task: PowerShell@2
32+
displayName: 'Update Signing Xml'
33+
inputs:
34+
targetType: filePath
35+
filePath: $(Build.SourcesDirectory)/tools/releaseBuild/updateSigning.ps1
36+
37+
- task: PkgESCodeSign@10
38+
displayName: 'CodeSign $(ARCHITECTURE)'
39+
env:
40+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
41+
inputs:
42+
signConfigXml: '$(Build.SourcesDirectory)\tools\releaseBuild\signing.xml'
43+
inPathRoot: '$(Symbols)'
44+
outPathRoot: '$(Symbols)\Signed'
45+
condition: ne(variables['SKIP_SIGNING'], 'True')
46+
47+
- powershell: |
48+
Compress-Archive -Path '$(Symbols)\Signed\*' -DestinationPath '$(Symbols)\Signed\win-$(ARCHITECTURE).zip'
49+
displayName: Compress signed binaries
50+
condition: ne(variables['SKIP_SIGNING'], 'True')
51+
52+
- powershell: |
53+
Get-ChildItem -Path '$(Symbols)\*' -Recurse | Copy-Item -Destination '$(Symbols)\Signed' -Force -Verbose
54+
displayName: Copy unsigned binaries as signing is skipped
55+
condition: eq(variables['SKIP_SIGNING'], 'True')
56+
57+
- template: uploadArtifact.yml
58+
parameters:
59+
artifactPath: '$(Symbols)\Signed'
60+
artifactFilter: 'win-*.zip'
61+
artifactName: 'signed'
62+
63+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-antimalware.AntiMalware@3
64+
displayName: 'Run MpCmdRun.exe'
65+
66+
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
67+
displayName: 'Component Detection'
68+
inputs:
69+
sourceScanPath: '$(Build.SourcesDirectory)'

0 commit comments

Comments
 (0)