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