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