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 | - name: usePythonVersion
|
---|
38 | type: string
|
---|
39 | default: ''
|
---|
40 |
|
---|
41 | steps:
|
---|
42 | - bash: |
|
---|
43 | echo "##vso[task.prependpath]${HOME}/.local/bin"
|
---|
44 | echo "new PATH=${PATH}"
|
---|
45 | displayName: Set PATH
|
---|
46 | condition: eq('${{ parameters.tool_chain_tag }}', 'GCC5')
|
---|
47 |
|
---|
48 | - checkout: self
|
---|
49 | clean: true
|
---|
50 | fetchDepth: 1
|
---|
51 |
|
---|
52 | - task: UsePythonVersion@0
|
---|
53 | inputs:
|
---|
54 | versionSpec: ${{ parameters.usePythonVersion }}
|
---|
55 | architecture: "x64"
|
---|
56 | condition: ne('${{ parameters.usePythonVersion }}', '')
|
---|
57 |
|
---|
58 | - script: pip install -r pip-requirements.txt --upgrade
|
---|
59 | displayName: 'Install/Upgrade pip modules'
|
---|
60 |
|
---|
61 | # Set default
|
---|
62 | - bash: echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
|
---|
63 |
|
---|
64 | # Fetch the target branch so that pr_eval can diff them.
|
---|
65 | # Seems like azure pipelines/github changed checkout process in nov 2020.
|
---|
66 | - script: git fetch origin $(System.PullRequest.targetBranch)
|
---|
67 | displayName: fetch target branch
|
---|
68 | condition: eq(variables['Build.Reason'], 'PullRequest')
|
---|
69 |
|
---|
70 | # trim the package list if this is a PR
|
---|
71 | - task: CmdLine@1
|
---|
72 | displayName: Check if ${{ parameters.build_pkg }} need testing
|
---|
73 | inputs:
|
---|
74 | filename: stuart_pr_eval
|
---|
75 | 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}"
|
---|
76 | condition: eq(variables['Build.Reason'], 'PullRequest')
|
---|
77 |
|
---|
78 | # Setup repo
|
---|
79 | - task: CmdLine@1
|
---|
80 | displayName: Setup
|
---|
81 | inputs:
|
---|
82 | filename: stuart_setup
|
---|
83 | arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}
|
---|
84 | condition: and(gt(variables.pkg_count, 0), succeeded())
|
---|
85 |
|
---|
86 | # Stuart Update
|
---|
87 | - task: CmdLine@1
|
---|
88 | displayName: Update
|
---|
89 | inputs:
|
---|
90 | filename: stuart_update
|
---|
91 | arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}
|
---|
92 | condition: and(gt(variables.pkg_count, 0), succeeded())
|
---|
93 |
|
---|
94 | # build basetools
|
---|
95 | # do this after setup and update so that code base dependencies
|
---|
96 | # are all resolved.
|
---|
97 | - template: basetools-build-steps.yml
|
---|
98 | parameters:
|
---|
99 | tool_chain_tag: ${{ parameters.tool_chain_tag }}
|
---|
100 |
|
---|
101 | # Potential Extra steps
|
---|
102 | - ${{ parameters.extra_install_step }}
|
---|
103 |
|
---|
104 | # Build
|
---|
105 | - task: CmdLine@1
|
---|
106 | displayName: Build
|
---|
107 | inputs:
|
---|
108 | filename: stuart_build
|
---|
109 | arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} TARGET=${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}
|
---|
110 | condition: and(gt(variables.pkg_count, 0), succeeded())
|
---|
111 |
|
---|
112 | # Run
|
---|
113 | - task: CmdLine@1
|
---|
114 | displayName: Run to shell
|
---|
115 | inputs:
|
---|
116 | filename: stuart_build
|
---|
117 | 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
|
---|
118 | condition: and(and(gt(variables.pkg_count, 0), succeeded()), eq(variables['Run'], true))
|
---|
119 | timeoutInMinutes: 2
|
---|
120 |
|
---|
121 | # Copy the build logs to the artifact staging directory
|
---|
122 | - task: CopyFiles@2
|
---|
123 | displayName: "Copy build logs"
|
---|
124 | inputs:
|
---|
125 | targetFolder: "$(Build.ArtifactStagingDirectory)"
|
---|
126 | SourceFolder: "Build"
|
---|
127 | contents: |
|
---|
128 | BUILDLOG_*.txt
|
---|
129 | BUILDLOG_*.md
|
---|
130 | CI_*.txt
|
---|
131 | CI_*.md
|
---|
132 | CISETUP.txt
|
---|
133 | SETUPLOG.txt
|
---|
134 | UPDATE_LOG.txt
|
---|
135 | PREVALLOG.txt
|
---|
136 | TestSuites.xml
|
---|
137 | **/BUILD_TOOLS_REPORT.html
|
---|
138 | **/OVERRIDELOG.TXT
|
---|
139 | BASETOOLS_BUILD*.*
|
---|
140 | flattenFolders: true
|
---|
141 | condition: succeededOrFailed()
|
---|
142 |
|
---|
143 | # Publish build artifacts to Azure Artifacts/TFS or a file share
|
---|
144 | - task: PublishBuildArtifacts@1
|
---|
145 | continueOnError: true
|
---|
146 | displayName: "Publish build logs"
|
---|
147 | inputs:
|
---|
148 | pathtoPublish: "$(Build.ArtifactStagingDirectory)"
|
---|
149 | artifactName: "Build Logs $(System.JobName)"
|
---|
150 | condition: succeededOrFailed()
|
---|