-
Notifications
You must be signed in to change notification settings - Fork 3
272 lines (258 loc) · 13 KB
/
sizestats.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
name: Generate size statistics
on:
issues:
types: [opened, reopened]
jobs:
check_title:
runs-on: ubuntu-latest
steps:
- name: Check title is correct
if: ${{ !(github.event.issue.title > 0) }}
run: |
curl \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments \
-d '{"body":"Error: issue title must be a pull request number. Reopen once you fix this."}'
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} \
-d '{"state":"closed"}'
exit 1
build:
needs: check_title
strategy:
matrix:
include:
- os: linux
osrid: linux
vm: ubuntu-latest
buildscript: ./build.sh
propertyswitch: '-'
- os: windows
osrid: win
vm: windows-latest
buildscript: .\build.cmd
propertyswitch: '/'
runs-on: ${{ matrix.vm }}
steps:
- name: Install dependencies
if: ${{ matrix.os == 'linux' }}
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y libkrb5-dev liblttng-ust-dev ninja-build libicu-dev libssl-dev
- name: Checkout runtime repo
uses: actions/checkout@v4
with:
repository: dotnet/runtime
fetch-depth: 0
path: runtime
show-progress: true
- name: Create baseline and compare branches (Linux)
if: ${{ matrix.os == 'linux' }}
run: cd runtime && git -c protocol.version=2 fetch --progress origin pull/${{ github.event.issue.title }}/head:compare && git branch baseline $(git merge-base compare main)
- name: Create baseline and compare branches (Windows)
if: ${{ matrix.os == 'windows' }}
shell: cmd
run: |
cd runtime
git -c protocol.version=2 fetch --progress origin pull/${{ github.event.issue.title }}/head:compare
for /f "tokens=*" %%i in ('git merge-base compare main') do set BASELINE_COMMIT=%%i
git branch baseline %BASELINE_COMMIT%
- name: Build baseline
run: |
cd runtime
git checkout baseline
git rev-parse HEAD
${{ matrix.buildscript }} clr.aot+libs.native+libs.sfx -c Release ${{ matrix.propertyswitch }}p:RunAnalyzers=false
- uses: actions/upload-artifact@v4
with:
name: baseline-${{ matrix.os }}
retention-days: 1
path: |
runtime/artifacts/bin/coreclr/${{ matrix.os }}.x64.Release/aotsdk
runtime/artifacts/bin/coreclr/${{ matrix.os }}.x64.Release/ilc-published
runtime/artifacts/bin/microsoft.netcore.app.runtime.${{ matrix.osrid }}-x64/Release/runtimes/${{ matrix.osrid }}-x64/lib/net10.0
runtime/artifacts/bin/microsoft.netcore.app.runtime.${{ matrix.osrid }}-x64/Release/runtimes/${{ matrix.osrid }}-x64/native
- name: Build compare
run: |
cd runtime
git checkout compare
git rev-parse HEAD
${{ matrix.buildscript }} clr.aot+libs.native+libs.sfx -c Release ${{ matrix.propertyswitch }}p:RunAnalyzers=false
- uses: actions/upload-artifact@v4
with:
name: compare-${{ matrix.os }}
retention-days: 1
path: |
runtime/artifacts/bin/coreclr/${{ matrix.os }}.x64.Release/aotsdk
runtime/artifacts/bin/coreclr/${{ matrix.os }}.x64.Release/ilc-published
runtime/artifacts/bin/microsoft.netcore.app.runtime.${{ matrix.osrid }}-x64/Release/runtimes/${{ matrix.osrid }}-x64/lib/net10.0
runtime/artifacts/bin/microsoft.netcore.app.runtime.${{ matrix.osrid }}-x64/Release/runtimes/${{ matrix.osrid }}-x64/native
dotnet:
needs: build
strategy:
matrix:
os: [linux, windows]
flavor: [baseline, compare]
project:
- hello
- hello-minimal
- webapiaot
- avalonia.app
- reflection
- kestrel-minimal
include:
- os: linux
osrid: linux
vm: ubuntu-latest
- os: windows
osrid: win
vm: windows-latest
runs-on: ${{ matrix.vm }}
steps:
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0"
dotnet-quality: daily
- name: Checkout repo
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.flavor }}-${{ matrix.os }}
- name: Publish (Linux)
if: ${{ matrix.os == 'linux' }}
run: |
chmod +x $GITHUB_WORKSPACE/coreclr/linux.x64.Release/ilc-published/ilc
cd src/${{ matrix.project }}
dotnet publish -p:IlcToolsPath=$GITHUB_WORKSPACE/coreclr/linux.x64.Release/ilc-published/ -p:IlcSdkPath=$GITHUB_WORKSPACE/coreclr/linux.x64.Release/aotsdk/ -p:IlcFrameworkPath=$GITHUB_WORKSPACE/microsoft.netcore.app.runtime.linux-x64/Release/runtimes/linux-x64/lib/net10.0/ -p:IlcFrameworkNativePath=$GITHUB_WORKSPACE/microsoft.netcore.app.runtime.linux-x64/Release/runtimes/linux-x64/native/ -p:IlcGenerateMstatFile=true -p:IlcGenerateDgmlFile=true -p:IlcGenerateMapFile=true ${{ toJson(github.event.issue.labels) == '[]' && ' ' || format('-p:{0}', join(github.event.issue.labels.*.name, ' -p:')) }}
- name: Publish (Windows)
if: ${{ matrix.os == 'windows' }}
shell: cmd
run: |
cd src\${{ matrix.project }}
dotnet publish -p:IlcToolsPath=%GITHUB_WORKSPACE%\coreclr\windows.x64.Release\ilc-published\ -p:IlcSdkPath=%GITHUB_WORKSPACE%\coreclr\windows.x64.Release\aotsdk\ -p:IlcFrameworkPath=%GITHUB_WORKSPACE%\microsoft.netcore.app.runtime.win-x64\Release\runtimes\win-x64\lib\net10.0\ -p:IlcFrameworkNativePath=%GITHUB_WORKSPACE%\microsoft.netcore.app.runtime.win-x64\Release\runtimes\win-x64\native\ -p:IlcGenerateMstatFile=true -p:IlcGenerateDgmlFile=true -p:IlcGenerateMapFile=true ${{ toJson(github.event.issue.labels) == '[]' && ' ' || format('-p:{0}', join(github.event.issue.labels.*.name, ' -p:')) }}
- uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
retention-days: 90
name: logs-${{ matrix.project }}-${{ matrix.flavor }}-${{ matrix.os }}
path: |
src/${{ matrix.project }}/obj/Release/net10.0/${{ matrix.osrid }}-x64/native/${{ matrix.project }}.mstat
src/${{ matrix.project }}/obj/Release/net10.0/${{ matrix.osrid }}-x64/native/${{ matrix.project }}.map.xml
src/${{ matrix.project }}/obj/Release/net10.0/${{ matrix.osrid }}-x64/native/*.dgml.xml
- name: Log stats (Linux)
if: ${{ matrix.os == 'linux' }}
run: |
echo -n '${{ steps.artifact-upload-step.outputs.artifact-url }} ' > ${{ matrix.project }}-${{ matrix.os }}.${{ matrix.flavor }}.txt
stat -c%s src/${{ matrix.project }}/bin/Release/net10.0/linux-x64/native/${{ matrix.project }} >> ${{ matrix.project }}-${{ matrix.os }}.${{ matrix.flavor }}.txt
ls -la src/${{ matrix.project }}/bin/Release/net10.0/linux-x64/native/
- name: Log stats (Windows)
if: ${{ matrix.os == 'windows' }}
shell: cmd
run: |
FOR /F "usebackq" %%A IN ('src\${{ matrix.project }}\bin\Release\net10.0\win-x64\native\${{ matrix.project }}.exe') DO set SIZE=%%~zA
<nul set /p="${{ steps.artifact-upload-step.outputs.artifact-url }} %SIZE%" > ${{ matrix.project }}-${{ matrix.os }}.${{ matrix.flavor }}.txt
echo Size is %SIZE%
dir src\${{ matrix.project }}\bin\Release\net10.0\win-x64\native\
- uses: actions/upload-artifact@v4
with:
name: summary-${{ matrix.project }}-${{ matrix.os }}-${{ matrix.flavor }}
path: ${{ matrix.project }}-${{ matrix.os }}.${{ matrix.flavor }}.txt
- uses: actions/upload-artifact@v4
with:
retention-days: 5
name: binaries-${{ matrix.project }}-${{ matrix.os }}-${{ matrix.flavor }}
path: src/${{ matrix.project }}/bin/Release/net10.0/${{ matrix.osrid }}-x64/native/*
msbuild:
needs: build
strategy:
matrix:
flavor: [baseline, compare]
project: [
{ name: winrt-component-full, binary: winrt_component_full.dll },
{ name: winrt-component-minimal, binary: winrt_component_minimal.dll }
]
runs-on: windows-latest
steps:
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0"
dotnet-quality: daily
- name: Checkout repo
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.flavor }}-windows
- name: Publish
shell: cmd
run: |
cd src\${{ matrix.project.name }}
dotnet msbuild /restore -t:publish /p:Configuration=Release /p:Platform=x64 /p:RuntimeIdentifier=win-x64 -p:IlcToolsPath=%GITHUB_WORKSPACE%\coreclr\windows.x64.Release\ilc-published\ -p:IlcSdkPath=%GITHUB_WORKSPACE%\coreclr\windows.x64.Release\aotsdk\ -p:IlcFrameworkPath=%GITHUB_WORKSPACE%\microsoft.netcore.app.runtime.win-x64\Release\runtimes\win-x64\lib\net10.0\ -p:IlcFrameworkNativePath=%GITHUB_WORKSPACE%\microsoft.netcore.app.runtime.win-x64\Release\runtimes\win-x64\native\ -p:IlcGenerateMstatFile=true -p:IlcGenerateDgmlFile=true -p:IlcGenerateMapFile=true ${{ toJson(github.event.issue.labels) == '[]' && ' ' || format('-p:{0}', join(github.event.issue.labels.*.name, ' -p:')) }}
- uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
retention-days: 90
name: logs-${{ matrix.project.name }}-${{ matrix.flavor }}-windows
path: |
src/${{ matrix.project.name }}/obj/x64/Release/net10.0-windows10.0.22621.0/win-x64/native/${{ matrix.project.name }}.mstat
src/${{ matrix.project.name }}/obj/x64/Release/net10.0-windows10.0.22621.0/win-x64/native/${{ matrix.project.name }}.map.xml
src/${{ matrix.project.name }}/obj/x64/Release/net10.0-windows10.0.22621.0/win-x64/native/*.dgml.xml
- name: Log stats
shell: cmd
run: |
FOR /F "usebackq" %%A IN ('src\${{ matrix.project.name }}\bin\x64\Release\net10.0-windows10.0.22621.0\win-x64\native\${{ matrix.project.binary }}') DO set SIZE=%%~zA
<nul set /p="${{ steps.artifact-upload-step.outputs.artifact-url }} %SIZE%" > ${{ matrix.project.name }}-windows.${{ matrix.flavor }}.txt
echo Size is %SIZE%
dir src\${{ matrix.project.name }}\bin\x64\Release\net10.0-windows10.0.22621.0\win-x64\native\
- uses: actions/upload-artifact@v4
with:
name: summary-${{ matrix.project.name }}-windows-${{ matrix.flavor }}
path: ${{ matrix.project.name }}-windows.${{ matrix.flavor }}.txt
- uses: actions/upload-artifact@v4
with:
retention-days: 5
name: binaries-${{ matrix.project.name }}-windows-${{ matrix.flavor }}
path: src/${{ matrix.project.name }}/bin/x64/Release/net10.0-windows10.0.22621.0/win-x64/native/*
summarize:
needs: [dotnet, msbuild]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: summary-*
merge-multiple: true
- run: |
echo -n '{"body":"# Size statistics\n\n' > table.txt
echo -n "Pull request dotnet/runtime#${{ github.event.issue.title }}\n\n" >> table.txt
echo -n "| Project | Size before | Size after | Difference |\n" >> table.txt
echo -n "|---------|-------------|------------|------------|\n" >> table.txt
for file in *.baseline.txt; do
projectname=${file%.baseline.txt}
read -r url1 num1 < "$file" || true
read -r url2 num2 < "$projectname.compare.txt" || true
diff=$((num2 - num1))
echo -n "| $projectname | [ $num1 ]($url1) | [ $num2 ]($url2) | $diff |\n" >> table.txt
done
echo -n '"}' >> table.txt
cat table.txt
echo
curl \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments \
-d @table.txt
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} \
-d '{"state":"closed"}'