]> git.proxmox.com Git - mirror_edk2.git/blame - .azurepipelines/templates/pr-gate-steps.yml
CI: add ~/.local/bin to PATH (Linux only)
[mirror_edk2.git] / .azurepipelines / templates / pr-gate-steps.yml
CommitLineData
106c7a99
SB
1## @file\r
2# File templates/pr-gate-steps.yml\r
3#\r
4# template file containing the steps to build\r
5#\r
6# Copyright (c) Microsoft Corporation.\r
7# SPDX-License-Identifier: BSD-2-Clause-Patent\r
8##\r
9\r
10parameters:\r
11 tool_chain_tag: ''\r
12 build_pkgs: ''\r
13 build_targets: ''\r
14 build_archs: ''\r
35795517 15 usePythonVersion: ''\r
89c5d900 16 extra_install_step: []\r
106c7a99
SB
17\r
18steps:\r
becff4f4
OS
19- bash: |\r
20 echo "##vso[task.prependpath]${HOME}/.local/bin"\r
21 echo "new PATH=${PATH}"\r
22 displayName: Set PATH\r
23 condition: eq('${{ parameters.tool_chain_tag }}', 'GCC5')\r
24\r
106c7a99
SB
25- checkout: self\r
26 clean: true\r
27 fetchDepth: 1\r
28\r
29- task: UsePythonVersion@0\r
30 inputs:\r
35795517
OS
31 versionSpec: ${{ parameters.usePythonVersion }}\r
32 architecture: "x64"\r
33 condition: ne('${{ parameters.usePythonVersion }}', '')\r
106c7a99
SB
34\r
35- script: pip install -r pip-requirements.txt --upgrade\r
36 displayName: 'Install/Upgrade pip modules'\r
37\r
38# Set default\r
39- bash: |\r
40 echo "##vso[task.setvariable variable=pkgs_to_build]${{ parameters.build_pkgs }}"\r
41 echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"\r
39161090
SB
42\r
43# Fetch the target branch so that pr_eval can diff them.\r
44# Seems like azure pipelines/github changed checkout process in nov 2020.\r
45- script: git fetch origin $(System.PullRequest.targetBranch)\r
46 displayName: fetch target branch\r
47 condition: eq(variables['Build.Reason'], 'PullRequest')\r
106c7a99 48\r
89c5d900
GG
49- ${{ parameters.extra_install_step }}\r
50\r
106c7a99
SB
51# trim the package list if this is a PR\r
52- task: CmdLine@1\r
53 displayName: Check if ${{ parameters.build_pkgs }} need testing\r
54 inputs:\r
55 filename: stuart_pr_eval\r
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}"\r
57 condition: eq(variables['Build.Reason'], 'PullRequest')\r
58\r
106c7a99
SB
59# install spell check prereqs\r
60- template: spell-check-prereq-steps.yml\r
61\r
62# Build repo\r
63- task: CmdLine@1\r
64 displayName: Setup ${{ parameters.build_pkgs }} ${{ parameters.build_archs}}\r
65 inputs:\r
66 filename: stuart_setup\r
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}}\r
68 condition: and(gt(variables.pkg_count, 0), succeeded())\r
69\r
70- task: CmdLine@1\r
71 displayName: Update ${{ parameters.build_pkgs }} ${{ parameters.build_archs}}\r
72 inputs:\r
73 filename: stuart_update\r
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}}\r
75 condition: and(gt(variables.pkg_count, 0), succeeded())\r
76\r
e1fbff3d
SB
77# build basetools\r
78# do this after setup and update so that code base dependencies\r
79# are all resolved.\r
80- template: basetools-build-steps.yml\r
81 parameters:\r
82 tool_chain_tag: ${{ parameters.tool_chain_tag }}\r
83\r
106c7a99
SB
84- task: CmdLine@1\r
85 displayName: Build and Test ${{ parameters.build_pkgs }} ${{ parameters.build_archs}}\r
86 inputs:\r
87 filename: stuart_ci_build\r
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}}\r
89 condition: and(gt(variables.pkg_count, 0), succeeded())\r
90\r
91# Publish Test Results to Azure Pipelines/TFS\r
92- task: PublishTestResults@2\r
93 displayName: 'Publish junit test results'\r
94 continueOnError: true\r
95 condition: and( succeededOrFailed(),gt(variables.pkg_count, 0))\r
96 inputs:\r
97 testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit\r
98 testResultsFiles: 'Build/TestSuites.xml'\r
99 #searchFolder: '$(System.DefaultWorkingDirectory)' # Optional\r
100 mergeTestResults: true # Optional\r
101 testRunTitle: $(System.JobName) # Optional\r
102 #buildPlatform: # Optional\r
103 #buildConfiguration: # Optional\r
104 publishRunAttachments: true # Optional\r
105\r
106# Publish Test Results to Azure Pipelines/TFS\r
107- task: PublishTestResults@2\r
108 displayName: 'Publish host based test results for $(System.JobName)'\r
109 continueOnError: true\r
110 condition: and( succeededOrFailed(), gt(variables.pkg_count, 0))\r
111 inputs:\r
112 testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit\r
113 testResultsFiles: 'Build/**/*.result.xml'\r
114 #searchFolder: '$(System.DefaultWorkingDirectory)' # Optional\r
115 mergeTestResults: false # Optional\r
116 testRunTitle: ${{ parameters.build_pkgs }} # Optional\r
117 #buildPlatform: # Optional\r
118 #buildConfiguration: # Optional\r
119 publishRunAttachments: true # Optional\r
120\r
121# Copy the build logs to the artifact staging directory\r
122- task: CopyFiles@2\r
123 displayName: "Copy build logs"\r
124 inputs:\r
125 targetFolder: '$(Build.ArtifactStagingDirectory)'\r
126 SourceFolder: 'Build'\r
127 contents: |\r
128 BUILDLOG_*.txt\r
129 BUILDLOG_*.md\r
130 CI_*.txt\r
131 CI_*.md\r
132 CISETUP.txt\r
133 SETUPLOG.txt\r
134 UPDATE_LOG.txt\r
135 PREVALLOG.txt\r
136 TestSuites.xml\r
137 **/BUILD_TOOLS_REPORT.html\r
138 **/OVERRIDELOG.TXT\r
89c5d900 139 coverage.xml\r
106c7a99
SB
140 flattenFolders: true\r
141 condition: succeededOrFailed()\r
142\r
143# Publish build artifacts to Azure Artifacts/TFS or a file share\r
144- task: PublishBuildArtifacts@1\r
145 continueOnError: true\r
146 displayName: "Publish build logs"\r
147 inputs:\r
148 pathtoPublish: '$(Build.ArtifactStagingDirectory)'\r
149 artifactName: 'Build Logs $(System.JobName)'\r
150 condition: succeededOrFailed()\r