forked from microsoft/testfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
171 lines (155 loc) · 5.13 KB
/
azure-pipelines.yml
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
# Branches that trigger a build on commit
trigger:
branches:
include:
- main
- rel/*
exclude:
- rel/2.*
- rel/3.0.*
# Branch(es) that trigger(s) build(s) on PR
pr:
branches:
include:
- main
- rel/*
paths:
exclude:
- .github/*
- .devcontainer/*
- docs/*
- .markdownlint.json
- .markdownlintignore
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- README.md
- SECURITY.md
parameters:
- name: isRTM
displayName: "Produce RTM version?"
type: boolean
default: False
variables:
# Cannot use key:value syntax in root defined variables
- name: _TeamName
value: MSTest
- name: Codeql.Enabled
value: true
- name: _RunAsInternal
value: ${{ and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}
- name: _RunAsPublic
value: ${{ eq(variables._RunAsInternal, False) }}
# Set default value for variables of PR and Public builds
- name: _SignType
value: test
- name: _SignArgs
value: ''
- name: _Sign
value: False
- name: _InternalBuildArgs
value: ' '
# Produce real signed binaries for Internal builds
- ${{ if eq(variables._RunAsInternal, True) }}:
- group: DotNet-Symbol-Server-Pats
- name: _SignType
value: real
- name: _SignArgs
value: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName) /p:Sign=$(_Sign)
- name: _Sign
value: True
- name: _InternalBuildArgs
value: /p:DotNetSignType=$(_SignType)
/p:TeamName=$(_TeamName)
/p:DotNetPublishUsingPipelines=true
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
- ${{ if eq(parameters.isRTM, True) }}:
- name: _InternalBuildArgs
value: $(_InternalBuildArgs) /p:DotNetFinalVersionKind=release
stages:
- stage: build
displayName: Build
jobs:
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enableMicrobuild: true
enablePublishBuildArtifacts: true
enablePublishTestResults: true
testResultsFormat: 'vstest'
enablePublishBuildAssets: true
enablePublishUsingPipelines: true
enableTelemetry: true
jobs:
- job: Windows
timeoutInMinutes: 120
pool:
${{ if eq(variables._RunAsPublic, True) }}:
name: NetCore-Public
demands: ImageOverride -equals windows.vs2022.amd64.open
${{ if eq(variables._RunAsInternal, True) }}:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals 1es-windows-2022
strategy:
matrix:
Release:
_BuildConfig: Release
${{ if eq(variables._RunAsPublic, True) }}:
Debug:
_BuildConfig: Debug
steps:
- task: PowerShell@2
displayName: 'Install Windows SDK'
inputs:
targetType: filePath
filePath: './eng/Install-WindowsSDK.ps1'
failOnStderr: true
showWarnings: true
# This steps help to understand versions of .NET runtime installed on the machine,
# which is useful to diagnose some governance issues.
- task: DotNetCoreCLI@2
displayName: 'dotnet --info'
inputs:
command: custom
custom: '--info'
- script: eng\common\CIBuild.cmd
-configuration $(_BuildConfig)
-prepareMachine
$(_InternalBuildArgs)
/p:Test=false
name: Build
displayName: Build
# -ci is allowing to import some environment variables and some required configurations
- script: Test.cmd
-configuration $(_BuildConfig)
-ci
name: Test
displayName: Test
# This step is only helpful for diagnosing some issues with vstest/test host that would not appear
# through the console or trx
- task: PublishBuildArtifacts@1
displayName: 'Publish Test Results folders'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
ArtifactName: TestResults
condition: failed()
- ${{ if eq(variables._RunAsInternal, True) }}:
- task: NuGetAuthenticate@0
displayName: 'NuGet Authenticate to test-tools feed'
- task: NuGetCommand@2
displayName: 'Publish NuGet packages to test-tools feed'
inputs:
command: push
packagesToPush: 'artifacts/packages/$(_BuildConfig)/**/*.nupkg;!artifacts/packages/$(_BuildConfig)/**/*.symbols.nupkg'
publishVstsFeed: 'public/test-tools'
- ${{ if eq(variables._RunAsInternal, True) }}:
- template: /eng/common/templates/job/onelocbuild.yml
parameters:
GitHubOrg: microsoft
MirrorRepo: testfx
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-TESTFX'
- ${{ if eq(variables._RunAsInternal, True) }}:
- template: eng\common\templates\post-build\post-build.yml
parameters:
publishingInfraVersion: 3