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