Optimize pull request validation pipelines (#17544)

* Update pipeline

* update code

* Fix one issue

* Update it
This commit is contained in:
Dingmeng Xue 2022-04-13 11:30:14 +08:00 коммит произвёл GitHub
Родитель d96c2490d0
Коммит 28ce971ce7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 38 добавлений и 50 удалений

Просмотреть файл

@ -12,6 +12,7 @@ variables:
IsGenerateBased: $[eq(variables['system.pullRequest.targetBranch'], 'generation')]
BuildTimeoutInMinutes: 120
AnalysisTimeoutInMinutes: 120
TestTimeoutInMinutes: 180
trigger: none
@ -32,12 +33,6 @@ jobs:
windows:
OSName: ${{ variables.WindowsName }}
ImageName: ${{ variables.WindowsImage }}
linux:
OSName: ${{ variables.LinuxName }}
ImageName: ${{ variables.LinuxImage }}
macOS:
OSName: ${{ variables.MacOSName }}
ImageName: ${{ variables.MacOSImage }}
pool:
vmImage: $(ImageName)
@ -45,8 +40,8 @@ jobs:
- template: util/build-steps.yml
parameters:
osName: $(OSName)
testFramework: ${{ variables.TestFramework }}
configuration: ${{ variables.Configuration }}
testFramework: ${{ variables.TestFramework }}
- job: Analyze
displayName: Analyze
@ -58,12 +53,6 @@ jobs:
windows:
OSName: ${{ variables.WindowsName }}
ImageName: ${{ variables.WindowsImage }}
linux:
OSName: ${{ variables.LinuxName }}
ImageName: ${{ variables.LinuxImage }}
macOS:
OSName: ${{ variables.MacOSName }}
ImageName: ${{ variables.MacOSImage }}
pool:
vmImage: $(ImageName)
@ -72,12 +61,13 @@ jobs:
parameters:
osName: $(OSName)
configuration: ${{ variables.Configuration }}
testFramework: ${{ variables.TestFramework }}
- job: Test
displayName: Test
dependsOn: Build
condition: succeeded()
timeoutInMinutes: 180
timeoutInMinutes: ${{ variables.TestTimeoutInMinutes }}
strategy:
matrix:
windows:

Просмотреть файл

@ -1,11 +1,12 @@
parameters:
osName: ''
configuration: ''
testFramework: ''
steps:
- template: download-build-steps.yml
parameters:
osName: ${{ parameters.osName }}
artifactName: build-${{ parameters.testFramework }}
- task: NodeTool@0
condition: eq(variables.IsGenerateBased, true)
displayName: Install autorest
@ -47,4 +48,4 @@ steps:
- template: publish-artifacts-steps.yml
parameters:
artifactName: analyze-${{ parameters.osName }}
artifactName: analyze-${{ parameters.testFramework }}

Просмотреть файл

@ -6,7 +6,7 @@ parameters:
steps:
- task: NodeTool@0
condition: eq(variables.IsGenerateBased, true)
displayName: Install autorest
displayName: Install Autorest
inputs:
versionSpec: '14.17.1'
command: custom
@ -14,13 +14,13 @@ steps:
customCommand: install autorest@latest
- task: PowerShell@2
condition: eq(variables.IsGenerateBased, true)
displayName: Setup environment for autorest
displayName: Setup environment for Autorest
inputs:
targetType: inline
script: "$env:NODE_OPTIONS=\"--max-old-space-size=65536\""
pwsh: true
- task: PowerShell@2
displayName: 'Check Ingored File'
displayName: 'Check Ignored File'
inputs:
filePath: tools/CheckIgnoredFile.ps1
@ -39,4 +39,4 @@ steps:
- template: publish-artifacts-steps.yml
parameters:
artifactName: build-${{ parameters.osName }}
artifactName: build-${{ parameters.testFramework }}

Просмотреть файл

@ -1,9 +1,9 @@
parameters:
osName: ''
artifactName: ''
steps:
- task: DownloadPipelineArtifact@0
displayName: 'Download build-${{ parameters.osName }}'
displayName: 'Download {{ parameters.artifactName }}'
inputs:
artifactName: build-${{ parameters.osName }}
artifactName: ${{ parameters.artifactName }}
targetPath: artifacts

Просмотреть файл

@ -7,10 +7,10 @@ parameters:
steps:
- template: download-build-steps.yml
parameters:
osName: ${{ parameters.osName }}
artifactName: build-${{ parameters.testFramework }}
- task: NodeTool@0
condition: eq(variables.IsGenerateBased, true)
displayName: Install autorest
displayName: Install Autorest
inputs:
versionSpec: '14.17.1'
command: custom
@ -18,7 +18,7 @@ steps:
customCommand: install autorest@latest
- task: PowerShell@2
condition: eq(variables.IsGenerateBased, true)
displayName: Setup environment for autorest
displayName: Setup environment for Autorest
inputs:
targetType: inline
script: "$env:NODE_OPTIONS=\"--max-old-space-size=65536\""
@ -63,4 +63,4 @@ steps:
- template: publish-artifacts-steps.yml
parameters:
artifactName: test-${{ parameters.osName }}
artifactName: test-${{ parameters.testFramework }}-${{ parameters.osName }}

Просмотреть файл

@ -6,6 +6,8 @@ variables:
Configuration: Debug
DebugLocalBuildTasks: true
IsGenerateBased: $[eq(variables['system.pullRequest.targetBranch'], 'generation')]
BuildTimeoutInMinutes: 120
AnalysisTimeoutInMinutes: 120
trigger: none
@ -20,6 +22,7 @@ jobs:
- job: Build
displayName: Build
condition: and(eq(variables.IsGenerateBased, false), succeeded())
timeoutInMinutes: ${{ variables.BuildTimeoutInMinutes }}
pool:
vmImage: ${{ variables.WindowsImage }}
@ -36,46 +39,40 @@ jobs:
- job: Analyze
displayName: Analyze
dependsOn: Build
condition: and(eq(variables.IsGenerateBased, false), succeeded())
timeoutInMinutes: 90
condition: succeeded()
timeoutInMinutes: ${{ variables.AnalysisTimeoutInMinutes }}
strategy:
matrix:
windows:
OSName: ${{ variables.WindowsName }}
ImageName: ${{ variables.WindowsImage }}
pool:
vmImage: ${{ variables.WindowsImage }}
vmImage: $(ImageName)
steps:
- template: util/analyze-steps.yml
parameters:
osName: ${{ variables.WindowsName }}
osName: $(OSName)
configuration: ${{ variables.Configuration }}
- task: PowerShell@2
displayName: 'Cleanup Build'
inputs:
targetType: filePath
filePath: tools/CleanupBuild.ps1
pwsh: true
- task: NuGetCommand@2
displayName: 'Download BinSkim'
inputs:
command: custom
arguments: 'install Microsoft.CodeAnalysis.BinSkim -OutputDirectory $(System.DefaultWorkingDirectory)/tools/SecurityTools -Version 1.7.0'
- task: PowerShell@2
displayName: 'Run BinSkim'
inputs:
targetType: filePath
filePath: tools/SecurityTools/RunBinSkim.ps1
pwsh: true
testFramework: ${{ variables.TestFramework }}
- job: Test
displayName: Test
dependsOn: Build
condition: and(eq(variables.IsGenerateBased, false), succeeded())
timeoutInMinutes: 180
strategy:
matrix:
windows:
OSName: ${{ variables.WindowsName }}
ImageName: ${{ variables.WindowsImage }}
pool:
vmImage: ${{ variables.WindowsImage }}
vmImage: $(ImageName)
steps:
- template: util/test-steps.yml
parameters:
osName: ${{ variables.WindowsName }}
osName: $(OSName)
testFramework: ${{ variables.TestFramework }}
testTarget: ${{ variables.TestTarget }}
configuration: ${{ variables.Configuration }}