]> git.proxmox.com Git - mirror_edk2.git/blob - .azurepipelines/templates/platform-build-run-steps.yml
.azurepipelines: Use Python 3.10.6+
[mirror_edk2.git] / .azurepipelines / templates / platform-build-run-steps.yml
1
2 ## @file
3 # File steps.yml
4 #
5 # template file containing the steps to build
6 #
7 # Copyright (c) Microsoft Corporation.
8 # SPDX-License-Identifier: BSD-2-Clause-Patent
9 ##
10
11 parameters:
12 - name: tool_chain_tag
13 type: string
14 default: ''
15 - name: build_pkg
16 type: string
17 default: ''
18 - name: build_target
19 type: string
20 default: ''
21 - name: build_arch
22 type: string
23 default: ''
24 - name: build_file
25 type: string
26 default: ''
27 - name: build_flags
28 type: string
29 default: ''
30 - name: run_flags
31 type: string
32 default: ''
33
34 - name: extra_install_step
35 type: stepList
36 default: []
37
38 steps:
39 - checkout: self
40 clean: true
41 fetchDepth: 1
42
43 - task: UsePythonVersion@0
44 inputs:
45 versionSpec: ">=3.10.6"
46 architecture: "x64"
47
48 - script: pip install -r pip-requirements.txt --upgrade
49 displayName: 'Install/Upgrade pip modules'
50
51 # Set default
52 - bash: echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
53
54 # Fetch the target branch so that pr_eval can diff them.
55 # Seems like azure pipelines/github changed checkout process in nov 2020.
56 - script: git fetch origin $(System.PullRequest.targetBranch)
57 displayName: fetch target branch
58 condition: eq(variables['Build.Reason'], 'PullRequest')
59
60 # trim the package list if this is a PR
61 - task: CmdLine@1
62 displayName: Check if ${{ parameters.build_pkg }} need testing
63 inputs:
64 filename: stuart_pr_eval
65 arguments: -c ${{ parameters.build_file }} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} --pr-target origin/$(System.PullRequest.targetBranch) --output-count-format-string "##vso[task.setvariable variable=pkg_count;isOutpout=true]{pkgcount}"
66 condition: eq(variables['Build.Reason'], 'PullRequest')
67
68 # Setup repo
69 - task: CmdLine@1
70 displayName: Setup
71 inputs:
72 filename: stuart_setup
73 arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}
74 condition: and(gt(variables.pkg_count, 0), succeeded())
75
76 # Stuart Update
77 - task: CmdLine@1
78 displayName: Update
79 inputs:
80 filename: stuart_update
81 arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}
82 condition: and(gt(variables.pkg_count, 0), succeeded())
83
84 # build basetools
85 # do this after setup and update so that code base dependencies
86 # are all resolved.
87 - template: basetools-build-steps.yml
88 parameters:
89 tool_chain_tag: ${{ parameters.tool_chain_tag }}
90
91 # Potential Extra steps
92 - ${{ parameters.extra_install_step }}
93
94 # Build
95 - task: CmdLine@1
96 displayName: Build
97 inputs:
98 filename: stuart_build
99 arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} TARGET=${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}
100 condition: and(gt(variables.pkg_count, 0), succeeded())
101
102 # Run
103 - task: CmdLine@1
104 displayName: Run to shell
105 inputs:
106 filename: stuart_build
107 arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} TARGET=${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}} ${{ parameters.run_flags }} --FlashOnly
108 condition: and(and(gt(variables.pkg_count, 0), succeeded()), eq(variables['Run'], true))
109 timeoutInMinutes: 1
110
111 # Copy the build logs to the artifact staging directory
112 - task: CopyFiles@2
113 displayName: "Copy build logs"
114 inputs:
115 targetFolder: "$(Build.ArtifactStagingDirectory)"
116 SourceFolder: "Build"
117 contents: |
118 BUILDLOG_*.txt
119 BUILDLOG_*.md
120 CI_*.txt
121 CI_*.md
122 CISETUP.txt
123 SETUPLOG.txt
124 UPDATE_LOG.txt
125 PREVALLOG.txt
126 TestSuites.xml
127 **/BUILD_TOOLS_REPORT.html
128 **/OVERRIDELOG.TXT
129 BASETOOLS_BUILD*.*
130 flattenFolders: true
131 condition: succeededOrFailed()
132
133 # Publish build artifacts to Azure Artifacts/TFS or a file share
134 - task: PublishBuildArtifacts@1
135 continueOnError: true
136 displayName: "Publish build logs"
137 inputs:
138 pathtoPublish: "$(Build.ArtifactStagingDirectory)"
139 artifactName: "Build Logs $(System.JobName)"
140 condition: succeededOrFailed()