Repository navigation
Expand file tree
/
Copy pathbuild-steps-pgo.yml
More file actions
144 lines (121 loc) · 5.4 KB
/
Copy pathbuild-steps-pgo.yml
File metadata and controls
144 lines (121 loc) · 5.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
parameters:
PGInstrument: false
PGRun: false
PGUpdate: false
steps:
- template: ./checkout.yml
- ${{ if or(eq(parameters.PGInstrument, 'true'), eq(parameters.PGUpdate, 'true')) }}:
- template: ./acquire-vcruntime.yml
- powershell: |
$d = (.\PCbuild\build.bat -V) | %{ if($_ -match '\s+(\w+):\s*(.+)\s*$') { @{$Matches[1] = $Matches[2];} }};
Write-Host "##vso[task.setvariable variable=VersionText]$($d.PythonVersion)"
Write-Host "##vso[task.setvariable variable=VersionNumber]$($d.PythonVersionNumber)"
Write-Host "##vso[task.setvariable variable=VersionHex]$($d.PythonVersionHex)"
Write-Host "##vso[task.setvariable variable=VersionUnique]$($d.PythonVersionUnique)"
Write-Host "##vso[build.addbuildtag]$($d.PythonVersion)"
Write-Host "##vso[build.addbuildtag]$($d.PythonVersion)-$(Name)"
displayName: 'Extract version numbers'
- ${{ if eq(parameters.PGInstrument, 'true') }}:
- powershell: |
$env:SigningCertificate = $null
.\PCbuild\build.bat -v -p $(Platform) -c PGInstrument $(ExtraOptions)
displayName: 'Run build'
env:
IncludeUwp: true
Py_OutDir: '$(Build.BinariesDirectory)\bin'
- ${{ if ne(parameters.PGRun, 'true') }}:
# Not running in this job, so we publish our entire build and object files
- publish: '$(Build.BinariesDirectory)\bin\$(ArchDir)\instrumented'
artifact: instrumented_bin_$(Name)
displayName: 'Publish binaries for profiling'
- powershell: |
if ((Test-Path Python\frozen_modules) -and (Test-Path Python\deepfreeze)) {
move Python\frozen_modules, Python\deepfreeze PCbuild\obj\
}
displayName: 'Preserve frozen_modules'
- publish: '$(Build.SourcesDirectory)\PCbuild\obj'
artifact: instrumented_obj_$(Name)
displayName: 'Download artifact: instrumented_obj_$(Name)'
- ${{ if eq(parameters.PGRun, 'true') }}:
- ${{ if ne(parameters.PGInstrument, 'true') }}:
# Didn't build in this job, so download the required binaries
- task: DownloadPipelineArtifact@2
displayName: 'Download artifact: instrumented_bin_$(Name)'
inputs:
buildType: current
artifact: instrumented_bin_$(Name)
targetPath: '$(Build.BinariesDirectory)\bin\$(ArchDir)\instrumented'
- powershell: |
$exe = (gci "$(Build.BinariesDirectory)\bin\$(ArchDir)\instrumented\$(PythonExePattern)" | select -First 1)
& $exe -m test --pgo
ignoreLASTEXITCODE: true
displayName: 'Collect profile'
env:
PYTHONHOME: '$(Build.SourcesDirectory)'
- ${{ if ne(parameters.PGUpdate, 'true') }}:
# Not finishing in this job, so publish the binaries
- publish: '$(Build.BinariesDirectory)\bin\$(ArchDir)\instrumented'
artifact: profile_bin_$(Name)
displayName: 'Publish collected data and binaries'
- ${{ if eq(parameters.PGUpdate, 'true') }}:
- ${{ if ne(parameters.PGRun, 'true') }}:
# Didn't run/build in this job, so download files
- task: DownloadPipelineArtifact@2
displayName: 'Download artifact: profile_bin_$(Name)'
inputs:
buildType: current
artifact: profile_bin_$(Name)
targetPath: '$(Build.BinariesDirectory)\bin\$(ArchDir)\instrumented'
- task: DownloadPipelineArtifact@2
displayName: 'Download artifact: instrumented_obj_$(Name)'
inputs:
buildType: current
artifact: instrumented_obj_$(Name)
targetPath: '$(Build.SourcesDirectory)\PCbuild\obj'
- powershell: |
if (Test-Path PCbuild\obj\frozen_modules) {
copy -force -r PCbuild\obj\frozen_modules\* (mkdir -Force Python\frozen_modules)
}
if (Test-Path PCbuild\obj\deepfreeze) {
copy -force -r PCbuild\obj\deepfreeze\* (mkdir -Force Python\deepfreeze)
}
displayName: 'Restore frozen_modules'
- powershell: |
$env:SigningCertificate = $null
.\PCbuild\build.bat -v -p $(Platform) -c PGUpdate $(ExtraOptions)
displayName: 'Run build with PGO'
env:
IncludeUwp: true
Py_OutDir: '$(Build.BinariesDirectory)\bin'
- powershell: |
$kitroot = (gp 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\').KitsRoot10
$tool = (gci -r "$kitroot\Bin\*\x64\signtool.exe" | sort FullName -Desc | select -First 1)
if (-not $tool) {
throw "SDK is not available"
}
Write-Host "##vso[task.prependpath]$($tool.Directory)"
displayName: 'Add WinSDK tools to path'
- powershell: |
$env:SigningCertificate = $null
$(_HostPython) PC\layout -vv -b "$(Build.BinariesDirectory)\bin" -t "$(Build.BinariesDirectory)\catalog" --catalog "${env:CAT}.cdf" --preset-default --arch $(Arch)
makecat "${env:CAT}.cdf"
del "${env:CAT}.cdf"
if (-not (Test-Path "${env:CAT}.cat")) {
throw "Failed to build catalog file"
}
displayName: 'Generate catalog'
env:
CAT: $(Build.BinariesDirectory)\bin\$(ArchDir)\python
PYTHON_HEXVERSION: $(VersionHex)
- powershell: |
del instrumented -r -EA 0
del *.pgc, *.pgd, *.exp
displayName: 'Cleanup build'
workingDirectory: '$(Build.BinariesDirectory)\bin\$(ArchDir)'
- powershell: |
copy "$(Build.SourcesDirectory)\Lib\venv\scripts\common\Activate.ps1" .
displayName: 'Copy Powershell scripts from source'
workingDirectory: '$(Build.BinariesDirectory)\bin\$(ArchDir)'
- publish: '$(Build.BinariesDirectory)\bin\$(ArchDir)'
artifact: $(Artifact)
displayName: 'Publish binaries'