2 # File templates/pr-gate-steps.yml
4 # template file containing the steps to build
6 # Copyright (c) Microsoft Corporation.
7 # SPDX-License-Identifier: BSD-2-Clause-Patent
16 extra_install_step: []
20 echo "##vso[task.prependpath]${HOME}/.local/bin"
21 echo "new PATH=${PATH}"
23 condition: eq('${{ parameters.tool_chain_tag }}', 'GCC5')
29 - task: UsePythonVersion@0
31 versionSpec: ${{ parameters.usePythonVersion }}
33 condition: ne('${{ parameters.usePythonVersion }}', '')
35 - script: pip install -r pip-requirements.txt --upgrade
36 displayName: 'Install/Upgrade pip modules'
40 echo "##vso[task.setvariable variable=pkgs_to_build]${{ parameters.build_pkgs }}"
41 echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
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')
49 - ${{ parameters.extra_install_step }}
51 # trim the package list if this is a PR
53 displayName: Check if ${{ parameters.build_pkgs }} need testing
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')
59 # install spell check prereqs
60 - template: spell-check-prereq-steps.yml
64 displayName: Setup ${{ parameters.build_pkgs }} ${{ parameters.build_archs}}
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())
71 displayName: Update ${{ parameters.build_pkgs }} ${{ parameters.build_archs}}
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())
78 # do this after setup and update so that code base dependencies
80 - template: basetools-build-steps.yml
82 tool_chain_tag: ${{ parameters.tool_chain_tag }}
85 displayName: Build and Test ${{ parameters.build_pkgs }} ${{ parameters.build_archs}}
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())
91 # Publish Test Results to Azure Pipelines/TFS
92 - task: PublishTestResults@2
93 displayName: 'Publish junit test results'
95 condition: and( succeededOrFailed(),gt(variables.pkg_count, 0))
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
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))
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
121 # Copy the build logs to the artifact staging directory
123 displayName: "Copy build logs"
125 targetFolder: '$(Build.ArtifactStagingDirectory)'
126 SourceFolder: 'Build'
137 **/BUILD_TOOLS_REPORT.html
141 condition: succeededOrFailed()
143 # Publish build artifacts to Azure Artifacts/TFS or a file share
144 - task: PublishBuildArtifacts@1
145 continueOnError: true
146 displayName: "Publish build logs"
148 pathtoPublish: '$(Build.ArtifactStagingDirectory)'
149 artifactName: 'Build Logs $(System.JobName)'
150 condition: succeededOrFailed()