]>
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 | |
60f6a277 | 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 | |
33 | \r | |
34 | # trim the package list if this is a PR\r | |
35 | - task: CmdLine@1\r | |
36 | displayName: Check if ${{ parameters.build_pkgs }} need testing\r | |
37 | inputs:\r | |
38 | filename: stuart_pr_eval\r | |
39 | 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 | |
40 | condition: eq(variables['Build.Reason'], 'PullRequest')\r | |
41 | \r | |
106c7a99 SB |
42 | # install spell check prereqs\r |
43 | - template: spell-check-prereq-steps.yml\r | |
44 | \r | |
45 | # Build repo\r | |
46 | - task: CmdLine@1\r | |
47 | displayName: Setup ${{ parameters.build_pkgs }} ${{ parameters.build_archs}}\r | |
48 | inputs:\r | |
49 | filename: stuart_setup\r | |
50 | 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 | |
51 | condition: and(gt(variables.pkg_count, 0), succeeded())\r | |
52 | \r | |
53 | - task: CmdLine@1\r | |
54 | displayName: Update ${{ parameters.build_pkgs }} ${{ parameters.build_archs}}\r | |
55 | inputs:\r | |
56 | filename: stuart_update\r | |
57 | 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 | |
58 | condition: and(gt(variables.pkg_count, 0), succeeded())\r | |
59 | \r | |
e1fbff3d SB |
60 | # build basetools\r |
61 | # do this after setup and update so that code base dependencies\r | |
62 | # are all resolved.\r | |
63 | - template: basetools-build-steps.yml\r | |
64 | parameters:\r | |
65 | tool_chain_tag: ${{ parameters.tool_chain_tag }}\r | |
66 | \r | |
106c7a99 SB |
67 | - task: CmdLine@1\r |
68 | displayName: Build and Test ${{ parameters.build_pkgs }} ${{ parameters.build_archs}}\r | |
69 | inputs:\r | |
70 | filename: stuart_ci_build\r | |
71 | 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 | |
72 | condition: and(gt(variables.pkg_count, 0), succeeded())\r | |
73 | \r | |
74 | # Publish Test Results to Azure Pipelines/TFS\r | |
75 | - task: PublishTestResults@2\r | |
76 | displayName: 'Publish junit test results'\r | |
77 | continueOnError: true\r | |
78 | condition: and( succeededOrFailed(),gt(variables.pkg_count, 0))\r | |
79 | inputs:\r | |
80 | testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit\r | |
81 | testResultsFiles: 'Build/TestSuites.xml'\r | |
82 | #searchFolder: '$(System.DefaultWorkingDirectory)' # Optional\r | |
83 | mergeTestResults: true # Optional\r | |
84 | testRunTitle: $(System.JobName) # Optional\r | |
85 | #buildPlatform: # Optional\r | |
86 | #buildConfiguration: # Optional\r | |
87 | publishRunAttachments: true # Optional\r | |
88 | \r | |
89 | # Publish Test Results to Azure Pipelines/TFS\r | |
90 | - task: PublishTestResults@2\r | |
91 | displayName: 'Publish host based test results for $(System.JobName)'\r | |
92 | continueOnError: true\r | |
93 | condition: and( succeededOrFailed(), gt(variables.pkg_count, 0))\r | |
94 | inputs:\r | |
95 | testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit\r | |
96 | testResultsFiles: 'Build/**/*.result.xml'\r | |
97 | #searchFolder: '$(System.DefaultWorkingDirectory)' # Optional\r | |
98 | mergeTestResults: false # Optional\r | |
99 | testRunTitle: ${{ parameters.build_pkgs }} # Optional\r | |
100 | #buildPlatform: # Optional\r | |
101 | #buildConfiguration: # Optional\r | |
102 | publishRunAttachments: true # Optional\r | |
103 | \r | |
104 | # Copy the build logs to the artifact staging directory\r | |
105 | - task: CopyFiles@2\r | |
106 | displayName: "Copy build logs"\r | |
107 | inputs:\r | |
108 | targetFolder: '$(Build.ArtifactStagingDirectory)'\r | |
109 | SourceFolder: 'Build'\r | |
110 | contents: |\r | |
111 | BUILDLOG_*.txt\r | |
112 | BUILDLOG_*.md\r | |
113 | CI_*.txt\r | |
114 | CI_*.md\r | |
115 | CISETUP.txt\r | |
116 | SETUPLOG.txt\r | |
117 | UPDATE_LOG.txt\r | |
118 | PREVALLOG.txt\r | |
119 | TestSuites.xml\r | |
120 | **/BUILD_TOOLS_REPORT.html\r | |
121 | **/OVERRIDELOG.TXT\r | |
122 | flattenFolders: true\r | |
123 | condition: succeededOrFailed()\r | |
124 | \r | |
125 | # Publish build artifacts to Azure Artifacts/TFS or a file share\r | |
126 | - task: PublishBuildArtifacts@1\r | |
127 | continueOnError: true\r | |
128 | displayName: "Publish build logs"\r | |
129 | inputs:\r | |
130 | pathtoPublish: '$(Build.ArtifactStagingDirectory)'\r | |
131 | artifactName: 'Build Logs $(System.JobName)'\r | |
132 | condition: succeededOrFailed()\r |