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