summaryrefslogtreecommitdiffstats
path: root/.azure-pipelines/windows-release/build-steps.yml
blob: 5ca2016d65f9e1e1f4f7c07eb485ad12ccb421ab (plain)
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
parameters:
  ShouldPGO: false

steps:
- template: ./checkout.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.ShouldPGO, 'false') }}:
  - powershell: |
      $env:SigningCertificate = $null
      .\PCbuild\build.bat -v -p $(Platform) -c $(Configuration)
    displayName: 'Run build'
    env:
      IncludeUwp: true
      Py_OutDir: '$(Build.BinariesDirectory)\bin'

- ${{ if eq(parameters.ShouldPGO, 'true') }}:
  - powershell: |
      $env:SigningCertificate = $null
      .\PCbuild\build.bat -v -p $(Platform) --pgo
    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\$(Arch)\python
    PYTHON_HEXVERSION: $(VersionHex)

- task: PublishPipelineArtifact@0
  displayName: 'Publish binaries'
  condition: and(succeeded(), not(and(eq(variables['Configuration'], 'Release'), variables['SigningCertificate'])))
  inputs:
    targetPath: '$(Build.BinariesDirectory)\bin\$(Arch)'
    artifactName: bin_$(Name)

- task: PublishPipelineArtifact@0
  displayName: 'Publish binaries for signing'
  condition: and(succeeded(), and(eq(variables['Configuration'], 'Release'), variables['SigningCertificate']))
  inputs:
    targetPath: '$(Build.BinariesDirectory)\bin\$(Arch)'
    artifactName: unsigned_bin_$(Name)

- task: CopyFiles@2
  displayName: 'Layout Artifact: symbols'
  inputs:
    sourceFolder: $(Build.BinariesDirectory)\bin\$(Arch)
    targetFolder: $(Build.ArtifactStagingDirectory)\symbols\$(Name)
    flatten: true
    contents: |
      **\*.pdb

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: symbols'
  inputs:
    PathToPublish: '$(Build.ArtifactStagingDirectory)\symbols'
    ArtifactName: symbols