Skip to content

Commit 21a92f8

Browse files
authoredJun 14, 2019
Implement Windows release builds in Azure Pipelines (pythonGH-14065)
1 parent f0749da commit 21a92f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1691
-166
lines changed
 

‎.azure-pipelines/windows-release.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Release_$(Build.SourceBranchName)_$(SourceTag)_$(Date:yyyyMMdd)$(Rev:.rr)
2+
3+
# QUEUE TIME VARIABLES
4+
# variables:
5+
# GitRemote: python
6+
# SourceTag:
7+
# DoPGO: true
8+
# SigningCertificate: 'Python Software Foundation'
9+
# SigningDescription: 'Built: $(Build.BuildNumber)'
10+
# DoLayout: true
11+
# DoMSIX: true
12+
# DoNuget: true
13+
# DoEmbed: true
14+
# DoMSI: true
15+
# DoPublish: false
16+
17+
trigger: none
18+
pr: none
19+
20+
stages:
21+
- stage: Build
22+
displayName: Build binaries
23+
jobs:
24+
- template: windows-release/stage-build.yml
25+
26+
- stage: Sign
27+
displayName: Sign binaries
28+
dependsOn: Build
29+
jobs:
30+
- template: windows-release/stage-sign.yml
31+
32+
- stage: Layout
33+
displayName: Generate layouts
34+
dependsOn: Sign
35+
jobs:
36+
- template: windows-release/stage-layout-full.yml
37+
- template: windows-release/stage-layout-embed.yml
38+
- template: windows-release/stage-layout-nuget.yml
39+
40+
- stage: Pack
41+
dependsOn: Layout
42+
jobs:
43+
- template: windows-release/stage-pack-nuget.yml
44+
45+
- stage: Test
46+
dependsOn: Pack
47+
jobs:
48+
- template: windows-release/stage-test-embed.yml
49+
- template: windows-release/stage-test-nuget.yml
50+
51+
- stage: Layout_MSIX
52+
displayName: Generate MSIX layouts
53+
dependsOn: Sign
54+
condition: and(succeeded(), eq(variables['DoMSIX'], 'true'))
55+
jobs:
56+
- template: windows-release/stage-layout-msix.yml
57+
58+
- stage: Pack_MSIX
59+
displayName: Package MSIX
60+
dependsOn: Layout_MSIX
61+
jobs:
62+
- template: windows-release/stage-pack-msix.yml
63+
64+
- stage: Build_MSI
65+
displayName: Build MSI installer
66+
dependsOn: Sign
67+
condition: and(succeeded(), eq(variables['DoMSI'], 'true'))
68+
jobs:
69+
- template: windows-release/stage-msi.yml
70+
71+
- stage: Test_MSI
72+
displayName: Test MSI installer
73+
dependsOn: Build_MSI
74+
jobs:
75+
- template: windows-release/stage-test-msi.yml
76+
77+
- stage: PublishPyDotOrg
78+
displayName: Publish to python.org
79+
dependsOn: ['Test_MSI', 'Test']
80+
condition: and(succeeded(), eq(variables['DoPublish'], 'true'))
81+
jobs:
82+
- template: windows-release/stage-publish-pythonorg.yml
83+
84+
- stage: PublishNuget
85+
displayName: Publish to nuget.org
86+
dependsOn: Test
87+
condition: and(succeeded(), eq(variables['DoPublish'], 'true'))
88+
jobs:
89+
- template: windows-release/stage-publish-nugetorg.yml
90+
91+
- stage: PublishStore
92+
displayName: Publish to Store
93+
dependsOn: Pack_MSIX
94+
condition: and(succeeded(), eq(variables['DoPublish'], 'true'))
95+
jobs:
96+
- template: windows-release/stage-publish-store.yml
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
parameters:
2+
ShouldPGO: false
3+
4+
steps:
5+
- template: ./checkout.yml
6+
7+
- powershell: |
8+
$d = (.\PCbuild\build.bat -V) | %{ if($_ -match '\s+(\w+):\s*(.+)\s*$') { @{$Matches[1] = $Matches[2];} }};
9+
Write-Host "##vso[task.setvariable variable=VersionText]$($d.PythonVersion)"
10+
Write-Host "##vso[task.setvariable variable=VersionNumber]$($d.PythonVersionNumber)"
11+
Write-Host "##vso[task.setvariable variable=VersionHex]$($d.PythonVersionHex)"
12+
Write-Host "##vso[task.setvariable variable=VersionUnique]$($d.PythonVersionUnique)"
13+
Write-Host "##vso[build.addbuildtag]$($d.PythonVersion)"
14+
Write-Host "##vso[build.addbuildtag]$($d.PythonVersion)-$(Name)"
15+
displayName: 'Extract version numbers'
16+
17+
- ${{ if eq(parameters.ShouldPGO, 'false') }}:
18+
- powershell: |
19+
$env:SigningCertificate = $null
20+
.\PCbuild\build.bat -v -p $(Platform) -c $(Configuration)
21+
displayName: 'Run build'
22+
env:
23+
IncludeUwp: true
24+
Py_OutDir: '$(Build.BinariesDirectory)\bin'
25+
26+
- ${{ if eq(parameters.ShouldPGO, 'true') }}:
27+
- powershell: |
28+
$env:SigningCertificate = $null
29+
.\PCbuild\build.bat -v -p $(Platform) --pgo
30+
displayName: 'Run build with PGO'
31+
env:
32+
IncludeUwp: true
33+
Py_OutDir: '$(Build.BinariesDirectory)\bin'
34+
35+
- powershell: |
36+
$kitroot = (gp 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\').KitsRoot10
37+
$tool = (gci -r "$kitroot\Bin\*\x64\signtool.exe" | sort FullName -Desc | select -First 1)
38+
if (-not $tool) {
39+
throw "SDK is not available"
40+
}
41+
Write-Host "##vso[task.prependpath]$($tool.Directory)"
42+
displayName: 'Add WinSDK tools to path'
43+
44+
- powershell: |
45+
$env:SigningCertificate = $null
46+
.\python.bat PC\layout -vv -t "$(Build.BinariesDirectory)\catalog" --catalog "${env:CAT}.cdf" --preset-default
47+
makecat "${env:CAT}.cdf"
48+
del "${env:CAT}.cdf"
49+
if (-not (Test-Path "${env:CAT}.cat")) {
50+
throw "Failed to build catalog file"
51+
}
52+
displayName: 'Generate catalog'
53+
env:
54+
CAT: $(Build.BinariesDirectory)\bin\$(Arch)\python
55+
56+
- task: PublishBuildArtifacts@1
57+
displayName: 'Publish binaries'
58+
condition: and(succeeded(), not(and(eq(variables['Configuration'], 'Release'), variables['SigningCertificate'])))
59+
inputs:
60+
PathtoPublish: '$(Build.BinariesDirectory)\bin\$(Arch)'
61+
ArtifactName: bin_$(Name)
62+
63+
- task: PublishBuildArtifacts@1
64+
displayName: 'Publish binaries for signing'
65+
condition: and(succeeded(), and(eq(variables['Configuration'], 'Release'), variables['SigningCertificate']))
66+
inputs:
67+
PathtoPublish: '$(Build.BinariesDirectory)\bin\$(Arch)'
68+
ArtifactName: unsigned_bin_$(Name)
69+
70+
- task: CopyFiles@2
71+
displayName: 'Layout Artifact: symbols'
72+
inputs:
73+
sourceFolder: $(Build.BinariesDirectory)\bin\$(Arch)
74+
targetFolder: $(Build.ArtifactStagingDirectory)\symbols\$(Name)
75+
flatten: true
76+
contents: |
77+
**\*.pdb
78+
79+
- task: PublishBuildArtifacts@1
80+
displayName: 'Publish Artifact: symbols'
81+
inputs:
82+
PathToPublish: '$(Build.ArtifactStagingDirectory)\symbols'
83+
ArtifactName: symbols

0 commit comments

Comments
 (0)