-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Expand file tree
/
Copy pathpowershell-core.yml
More file actions
175 lines (168 loc) · 6.15 KB
/
powershell-core.yml
File metadata and controls
175 lines (168 loc) · 6.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
variables:
WindowsName: windows
WindowsAgentPoolName: pool-windows-2022
WindowsAgentPoolVMImage: ''
LinuxName: linux
LinuxAgentPoolName: pool-ubuntu-2404
LinuxAgentPoolVMImage: ''
MacOSName: macOS
MacOSAgentPoolName: 'Azure Pipelines'
MacOSAgentPoolVMImage: macOS-latest
TestFramework: net8.0
TestTarget: Test
Configuration: Debug
DebugLocalBuildTasks: true
IsGenerateBased: $[startsWith(variables['system.pullRequest.targetBranch'], 'generation')]
BuildTimeoutInMinutes: 120
AnalysisTimeoutInMinutes: 120
TestTimeoutInMinutes: 180
BuildAzPredictor: false
EnableTestCoverage: true
TestCoverageLocation: $(Build.SourcesDirectory)/artifacts
PowerShellPlatform: PowerShell Core
AZURE_CLIENTS_SHOW_SECRETS_WARNING: true
trigger: none
pr:
branches:
include:
- '*'
exclude:
- Azs-tzl
jobs:
- job: Build
displayName: Build
condition: succeeded()
timeoutInMinutes: ${{ variables.BuildTimeoutInMinutes }}
pool: pool-windows-2022
steps:
- checkout: self
- task: UseDotNet@2
displayName: 'Use .NET SDK for Build'
inputs:
packageType: sdk
version: 8.x
- task: NodeTool@0
displayName: Install Autorest
inputs:
versionSpec: '20.19.6'
command: custom
verbose: false
customCommand: install autorest@latest
- task: PowerShell@2
displayName: Setup environment for Autorest
inputs:
targetType: inline
script: "$env:NODE_OPTIONS=\"--max-old-space-size=65536\""
pwsh: true
- task: PowerShell@2
displayName: 'Build'
inputs:
targetType: inline
pwsh: true
script: |
if ("Manual" -eq "$(Build.Reason)") {
#TODO: change value of $trigger to the account who trigger this run
$trigger = 'Manual'
} else {
$trigger = "$(System.PullRequest.PullRequestNumber)"
}
$filesChangedOutputPath = Join-Path "$(Build.SourcesDirectory)" 'artifacts' 'FilesChanged.txt'
New-Item -Type File -Path $filesChangedOutputPath -Force
$subTasksFilePath = Join-Path "$(Build.SourcesDirectory)" 'artifacts' 'SubTasksFile.txt'
Write-Host "`n##[group]Filter changed files"
$filesChangedScriptPath = Join-Path "$(Build.SourcesDirectory)" 'tools' 'BuildScripts' 'FilesChangedScript.psm1'
Import-Module $filesChangedScriptPath
if ("PullRequest" -eq "$(Build.Reason)") {
Get-FilesChangedFromPR -RepoRoot "$(Build.SourcesDirectory)" -TargetBranch "$(System.PullRequest.TargetBranch)" | Out-File $filesChangedOutputPath
} else {
Get-AllModule -RepoRoot "$(Build.SourcesDirectory)" | ForEach-Object { Join-Path 'src' $_ } | Out-File $filesChangedOutputPath
}
Write-Host "`n##[group]build steps"
$buildStepsPath = Join-Path "$(Build.SourcesDirectory)" '.azure-pipelines' 'PipelineSteps' 'build-steps.ps1'
& $buildStepsPath -RepoRoot "$(Build.SourcesDirectory)" -Configuration "${{ variables.Configuration }}" -PowerShellPlatform "${{ variables.PowerShellPlatform }}" -FilesChangedOutputPath $filesChangedOutputPath -SubTasksFilePath $subTasksFilePath -BuildReason $(Build.Reason) -Trigger $trigger
- template: util/publish-artifacts-steps.yml
parameters:
artifactName: build-${{ variables.TestFramework }}
- job: Analyze
displayName: Analyze
dependsOn: Build
condition: succeeded()
timeoutInMinutes: ${{ variables.AnalysisTimeoutInMinutes }}
pool: pool-windows-2022
steps:
- template: util/download-build-steps.yml
parameters:
artifactName: build-${{ variables.TestFramework }}
- task: NodeTool@0
displayName: Install autorest
inputs:
versionSpec: '20.19.6'
command: custom
verbose: false
customCommand: install autorest@latest
- task: PowerShell@2
displayName: Setup environment for autorest
inputs:
targetType: inline
script: "$env:NODE_OPTIONS=\"--max-old-space-size=65536\""
pwsh: true
- task: UseDotNet@2
displayName: 'Use .NET SDK for Static Analysis'
inputs:
packageType: sdk
version: 8.x
- task: PowerShell@2
displayName: 'Analyze'
inputs:
targetType: inline
workingDirectory: $(Build.SourcesDirectory)
pwsh: true
script: .azure-pipelines/PipelineSteps/analyze-steps.ps1 -RepoRoot "$(Build.SourcesDirectory)" -Configuration "${{ variables.Configuration }}" -PowerShellPlatform "${{ variables.PowerShellPlatform }}"
- template: util/publish-artifacts-steps.yml
parameters:
artifactName: analyze-${{ variables.testFramework }}-$(System.JobAttempt)
- job: Test
displayName: Test
dependsOn: Build
condition: succeeded()
timeoutInMinutes: ${{ variables.TestTimeoutInMinutes }}
strategy:
matrix:
windows:
OSName: ${{ variables.WindowsName }}
agentPoolName: ${{ variables.WindowsAgentPoolName }}
agentPoolVMImage: ${{ variables.WindowsAgentPoolVMImage }}
linux:
OSName: ${{ variables.LinuxName }}
agentPoolName: ${{ variables.LinuxAgentPoolName }}
agentPoolVMImage: ${{ variables.LinuxAgentPoolVMImage }}
macOS:
OSName: ${{ variables.MacOSName }}
agentPoolName: ${{ variables.MacOSAgentPoolName }}
agentPoolVMImage: ${{ variables.MacOSAgentPoolVMImage }}
pool:
name: $(agentPoolName)
vmImage: $(agentPoolVMImage)
steps:
- template: util/download-build-steps.yml
parameters:
artifactName: build-${{ variables.TestFramework }}
- task: UseDotNet@2
displayName: 'Use .NET SDK for Test'
inputs:
packageType: sdk
version: 8.x
- task: PowerShell@2
displayName: 'Test'
inputs:
targetType: inline
workingDirectory: $(Build.SourcesDirectory)
pwsh: true
script: .azure-pipelines/PipelineSteps/test-steps.ps1 -RepoRoot "$(Build.SourcesDirectory)" -Configuration "${{ variables.Configuration }}" -PowerShellPlatform "${{ variables.PowerShellPlatform }}" -TestFramework "${{ variables.testFramework }}"
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
- template: util/publish-artifacts-steps.yml
parameters:
artifactName: test-${{ variables.testFramework }}-$(OSName)-$(System.JobAttempt)