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