-
Notifications
You must be signed in to change notification settings - Fork 4k
/
generate-badges.ps1
158 lines (125 loc) · 3.73 KB
/
generate-badges.ps1
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
# Script for generating our badges line in the README.md
[CmdletBinding(PositionalBinding=$false)]
param ()
$branchNames = @(
'main',
'main-vs-deps')
function Get-AzureBadge($branchName, $jobName, $configName, [switch]$integration = $false) {
$name = if ($integration) { "roslyn-integration-CI" } else { "roslyn-CI" }
$id = if ($integration) { 96 } else { 95 }
$jobName = [System.Web.HttpUtility]::UrlEncode($jobName)
$template = "[![Build Status](https://dev.azure.com/dnceng-public/public/_apis/build/status/dotnet/roslyn/$($name)?branchname=$branchName&jobname=$jobName&configuration=$jobName$configName&label=build)]"
$template += "(https://dev.azure.com/dnceng-public/public/_build/latest?definitionId=$($id)&branchname=$branchName&view=logs)"
return $template
}
function Get-AzureLine($branchName, $jobNames, [switch]$integration = $false) {
$line = "**$branchName**|"
foreach ($jobName in $jobNames) {
$configName = ""
$line += Get-AzureBadge $branchName $jobName $configName -integration:$integration
$line += "|"
}
return $line + [Environment]::NewLine
}
function Get-BuildsTable() {
$jobNames = @(
'Build_Windows_Debug'
'Build_Windows_Release'
'Build_Unix_Debug'
)
$table = @'
#### Builds
|Branch|Windows Debug|Windows Release|Unix Debug|
|:--:|:--:|:--:|:--:|
'@
foreach ($branchName in $branchNames) {
$table += Get-AzureLine $branchName $jobNames
}
return $table
}
function Get-DesktopTable() {
$jobNames = @(
'Test_Windows_Desktop_Debug_32'
'Test_Windows_Desktop_Debug_64'
'Test_Windows_Desktop_Release_32'
'Test_Windows_Desktop_Release_64'
)
$table = @'
#### Desktop Unit Tests
|Branch|Debug x86|Debug x64|Release x86|Release x64|
|:--:|:--:|:--:|:--:|:--:|
'@
foreach ($branchName in $branchNames) {
$table += Get-AzureLine $branchName $jobNames
}
return $table
}
function Get-CoreClrTable() {
$jobNames = @(
'Test_Windows_CoreClr_Debug',
'Test_Windows_CoreClr_Release',
'Test_Linux_Debug'
)
$table = @'
#### CoreClr Unit Tests
|Branch|Windows Debug|Windows Release|Linux|
|:--:|:--:|:--:|:--:|
'@
foreach ($branchName in $branchNames) {
$table += Get-AzureLine $branchName $jobNames
}
return $table
}
function Get-IntegrationTable() {
$jobNames = @(
'VS_Integration_Debug_32',
'VS_Integration_Debug_64',
'VS_Integration_Release_32',
'VS_Integration_Release_64'
)
$table = @'
#### Integration Tests
|Branch|Debug x86|Debug x64|Release x86|Release x64
|:--:|:--:|:--:|:--:|:--:|
'@
foreach ($branchName in $branchNames) {
$table += Get-AzureLine $branchName $jobNames -integration:$true
}
return $table
}
function Get-MiscTable() {
$jobNames = @(
'Correctness_Determinism',
'Correctness_Analyzers',
'Correctness_Build_Artifacts',
'Source-Build (Managed)',
'Correctness_TodoCheck',
'Test_Windows_Desktop_Spanish_Release_64',
'Test_macOS_Debug'
)
$table = @'
#### Misc Tests
|Branch|Determinism|Analyzers|Build Correctness|Source build|TODO/Prototype|Spanish|MacOS|
|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|
'@
foreach ($branchName in $branchNames) {
$table += Get-AzureLine $branchName $jobNames
}
return $table
}
Set-StrictMode -version 2.0
$ErrorActionPreference="Stop"
try {
Get-BuildsTable | Write-Output
Get-DesktopTable | Write-Output
Get-CoreClrTable | Write-Output
Get-IntegrationTable | Write-Output
Get-MiscTable | Write-Output
exit 0
}
catch {
Write-Host $_
Write-Host $_.Exception
Write-Host $_.ScriptStackTrace
exit 1
}