1 | ## @file
|
---|
2 | # File templates/pr-gate-steps.yml
|
---|
3 | #
|
---|
4 | # template file containing the steps to build
|
---|
5 | #
|
---|
6 | # Copyright (c) Microsoft Corporation.
|
---|
7 | # SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
8 | ##
|
---|
9 |
|
---|
10 | parameters:
|
---|
11 | tool_chain_tag: ''
|
---|
12 | build_pkgs: ''
|
---|
13 | build_targets: ''
|
---|
14 | build_archs: ''
|
---|
15 | usePythonVersion: ''
|
---|
16 | extra_install_step: []
|
---|
17 |
|
---|
18 | steps:
|
---|
19 | - bash: |
|
---|
20 | echo "##vso[task.prependpath]${HOME}/.local/bin"
|
---|
21 | echo "new PATH=${PATH}"
|
---|
22 | displayName: Set PATH
|
---|
23 | condition: eq('${{ parameters.tool_chain_tag }}', 'GCC5')
|
---|
24 |
|
---|
25 | - checkout: self
|
---|
26 | clean: true
|
---|
27 | fetchDepth: 1
|
---|
28 |
|
---|
29 | - task: UsePythonVersion@0
|
---|
30 | inputs:
|
---|
31 | versionSpec: ${{ parameters.usePythonVersion }}
|
---|
32 | architecture: "x64"
|
---|
33 | condition: ne('${{ parameters.usePythonVersion }}', '')
|
---|
34 |
|
---|
35 | - script: pip install -r pip-requirements.txt --upgrade
|
---|
36 | displayName: 'Install/Upgrade pip modules'
|
---|
37 |
|
---|
38 | # Set default
|
---|
39 | - bash: |
|
---|
40 | echo "##vso[task.setvariable variable=pkgs_to_build]${{ parameters.build_pkgs }}"
|
---|
41 | echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
|
---|
42 |
|
---|
43 | # Fetch the target branch so that pr_eval can diff them.
|
---|
44 | # Seems like azure pipelines/github changed checkout process in nov 2020.
|
---|
45 | - script: git fetch origin $(System.PullRequest.targetBranch)
|
---|
46 | displayName: fetch target branch
|
---|
47 | condition: eq(variables['Build.Reason'], 'PullRequest')
|
---|
48 |
|
---|
49 | - ${{ parameters.extra_install_step }}
|
---|
50 |
|
---|
51 | # trim the package list if this is a PR
|
---|
52 | - task: CmdLine@1
|
---|
53 | displayName: Check if ${{ parameters.build_pkgs }} need testing
|
---|
54 | inputs:
|
---|
55 | filename: stuart_pr_eval
|
---|
56 | arguments: -c .pytool/CISettings.py -p ${{ parameters.build_pkgs }} --pr-target origin/$(System.PullRequest.targetBranch) --output-csv-format-string "##vso[task.setvariable variable=pkgs_to_build;isOutpout=true]{pkgcsv}" --output-count-format-string "##vso[task.setvariable variable=pkg_count;isOutpout=true]{pkgcount}"
|
---|
57 | condition: eq(variables['Build.Reason'], 'PullRequest')
|
---|
58 |
|
---|
59 | # install spell check prereqs
|
---|
60 | - template: spell-check-prereq-steps.yml
|
---|
61 |
|
---|
62 | # Build repo
|
---|
63 | - task: CmdLine@1
|
---|
64 | displayName: Setup ${{ parameters.build_pkgs }} ${{ parameters.build_archs}}
|
---|
65 | inputs:
|
---|
66 | filename: stuart_setup
|
---|
67 | arguments: -c .pytool/CISettings.py -p $(pkgs_to_build) -t ${{ parameters.build_targets}} -a ${{ parameters.build_archs}} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}}
|
---|
68 | condition: and(gt(variables.pkg_count, 0), succeeded())
|
---|
69 |
|
---|
70 | - task: CmdLine@1
|
---|
71 | displayName: Update ${{ parameters.build_pkgs }} ${{ parameters.build_archs}}
|
---|
72 | inputs:
|
---|
73 | filename: stuart_update
|
---|
74 | arguments: -c .pytool/CISettings.py -p $(pkgs_to_build) -t ${{ parameters.build_targets}} -a ${{ parameters.build_archs}} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}}
|
---|
75 | condition: and(gt(variables.pkg_count, 0), succeeded())
|
---|
76 |
|
---|
77 | # build basetools
|
---|
78 | # do this after setup and update so that code base dependencies
|
---|
79 | # are all resolved.
|
---|
80 | - template: basetools-build-steps.yml
|
---|
81 | parameters:
|
---|
82 | tool_chain_tag: ${{ parameters.tool_chain_tag }}
|
---|
83 |
|
---|
84 | - task: CmdLine@1
|
---|
85 | displayName: Build and Test ${{ parameters.build_pkgs }} ${{ parameters.build_archs}}
|
---|
86 | inputs:
|
---|
87 | filename: stuart_ci_build
|
---|
88 | arguments: -c .pytool/CISettings.py -p $(pkgs_to_build) -t ${{ parameters.build_targets}} -a ${{ parameters.build_archs}} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}}
|
---|
89 | condition: and(gt(variables.pkg_count, 0), succeeded())
|
---|
90 |
|
---|
91 | # Publish Test Results to Azure Pipelines/TFS
|
---|
92 | - task: PublishTestResults@2
|
---|
93 | displayName: 'Publish junit test results'
|
---|
94 | continueOnError: true
|
---|
95 | condition: and( succeededOrFailed(),gt(variables.pkg_count, 0))
|
---|
96 | inputs:
|
---|
97 | testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit
|
---|
98 | testResultsFiles: 'Build/TestSuites.xml'
|
---|
99 | #searchFolder: '$(System.DefaultWorkingDirectory)' # Optional
|
---|
100 | mergeTestResults: true # Optional
|
---|
101 | testRunTitle: $(System.JobName) # Optional
|
---|
102 | #buildPlatform: # Optional
|
---|
103 | #buildConfiguration: # Optional
|
---|
104 | publishRunAttachments: true # Optional
|
---|
105 |
|
---|
106 | # Publish Test Results to Azure Pipelines/TFS
|
---|
107 | - task: PublishTestResults@2
|
---|
108 | displayName: 'Publish host based test results for $(System.JobName)'
|
---|
109 | continueOnError: true
|
---|
110 | condition: and( succeededOrFailed(), gt(variables.pkg_count, 0))
|
---|
111 | inputs:
|
---|
112 | testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit
|
---|
113 | testResultsFiles: 'Build/**/*.result.xml'
|
---|
114 | #searchFolder: '$(System.DefaultWorkingDirectory)' # Optional
|
---|
115 | mergeTestResults: false # Optional
|
---|
116 | testRunTitle: ${{ parameters.build_pkgs }} # Optional
|
---|
117 | #buildPlatform: # Optional
|
---|
118 | #buildConfiguration: # Optional
|
---|
119 | publishRunAttachments: true # Optional
|
---|
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 | coverage.xml
|
---|
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()
|
---|