-
-
Notifications
You must be signed in to change notification settings - Fork 21
565 lines (507 loc) · 20.2 KB
/
examples.yaml
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
name: Size Comparison
on:
push:
paths-ignore:
- "**.md"
- "LICENSE"
jobs:
windows:
name: windows-size-comparison
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable"
# Create and build base project
- name: Create base project
run: |
mkdir size_comparison
cd size_comparison
flutter create base_project
cd base_project
flutter build windows --release
$baseSize = (Get-ChildItem -Recurse "build\windows\x64\runner\Release\" | Measure-Object -Property Length -Sum).Sum / 1KB
echo "BASE_SIZE=$baseSize" | Out-File -FilePath $env:GITHUB_ENV -Append
# Build and measure opencv_core
- name: opencv_core size
run: |
cd packages/opencv_core/example
flutter build windows --release
$coreSize = (Get-ChildItem -Recurse "build\windows\x64\runner\Release\" | Measure-Object -Property Length -Sum).Sum / 1KB
echo "CORE_SIZE=$coreSize" | Out-File -FilePath $env:GITHUB_ENV -Append
# Build and measure opencv_dart
- name: opencv_dart size
run: |
cd packages/opencv_dart/example
flutter build windows --release
$dartSize = (Get-ChildItem -Recurse "build\windows\x64\runner\Release\" | Measure-Object -Property Length -Sum).Sum / 1KB
echo "DART_SIZE=$dartSize" | Out-File -FilePath $env:GITHUB_ENV -Append
# Generate size comparison JSON
- name: Generate size report
run: |
$report = @{
'platform' = 'windows'
'base_size' = $env:BASE_SIZE
'opencv_core' = @{
'total_size' = $env:CORE_SIZE
'package_size' = [int]$env:CORE_SIZE - [int]$env:BASE_SIZE
}
'opencv_dart' = @{
'total_size' = $env:DART_SIZE
'package_size' = [int]$env:DART_SIZE - [int]$env:BASE_SIZE
}
}
$report | ConvertTo-Json | Out-File windows_size_report.json
- name: Upload size report
uses: actions/upload-artifact@v4
with:
name: windows-size-report
path: windows_size_report.json
android:
name: android-size-comparison
runs-on: ubuntu-latest
steps:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
# Create and build base project with split-per-abi
- name: Create base project (split-per-abi)
run: |
mkdir size_comparison
cd size_comparison
flutter create base_project
cd base_project
flutter build apk --release --target-platform android-arm64,android-arm,android-x64 --split-per-abi
BASE_SIZE_ARM64=$(($(stat -c%s "build/app/outputs/apk/release/app-arm64-v8a-release.apk" || echo "0") / 1024))
BASE_SIZE_ARMV7=$(($(stat -c%s "build/app/outputs/apk/release/app-armeabi-v7a-release.apk" || echo "0") / 1024))
BASE_SIZE_X64=$(($(stat -c%s "build/app/outputs/apk/release/app-x86_64-release.apk" || echo "0") / 1024))
echo "BASE_SIZE_ARM64=$BASE_SIZE_ARM64" >> $GITHUB_ENV
echo "BASE_SIZE_ARMV7=$BASE_SIZE_ARMV7" >> $GITHUB_ENV
echo "BASE_SIZE_X64=$BASE_SIZE_X64" >> $GITHUB_ENV
# Build full APK for base project (universal)
- name: Create base project (universal APK)
run: |
cd size_comparison/base_project
flutter build apk --release
BASE_FULL_SIZE=$(($(stat -c%s "build/app/outputs/apk/release/app-release.apk" || echo "0") / 1024))
echo "BASE_FULL_SIZE=$BASE_FULL_SIZE" >> $GITHUB_ENV
# Build and measure opencv_core with split-per-abi
- name: opencv_core size (split-per-abi)
run: |
cd packages/opencv_core/example
flutter build apk --release --target-platform android-arm64,android-arm,android-x64 --split-per-abi
CORE_SIZE_ARM64=$(($(stat -c%s "build/app/outputs/apk/release/app-arm64-v8a-release.apk" || echo "0") / 1024))
CORE_SIZE_ARMV7=$(($(stat -c%s "build/app/outputs/apk/release/app-armeabi-v7a-release.apk" || echo "0") / 1024))
CORE_SIZE_X64=$(($(stat -c%s "build/app/outputs/apk/release/app-x86_64-release.apk" || echo "0") / 1024))
echo "CORE_SIZE_ARM64=$CORE_SIZE_ARM64" >> $GITHUB_ENV
echo "CORE_SIZE_ARMV7=$CORE_SIZE_ARMV7" >> $GITHUB_ENV
echo "CORE_SIZE_X64=$CORE_SIZE_X64" >> $GITHUB_ENV
dir ${{ github.workspace}}/packages/opencv_core/android/.cxx
# Build full APK for opencv_core (universal)
- name: opencv_core full apk size
run: |
cd packages/opencv_core/example
flutter build apk --release
CORE_FULL_SIZE=$(($(stat -c%s "build/app/outputs/apk/release/app-release.apk" || echo "0") / 1024))
echo "CORE_FULL_SIZE=$CORE_FULL_SIZE" >> $GITHUB_ENV
# Build and measure opencv_dart with split-per-abi
- name: opencv_dart size (split-per-abi)
run: |
cd packages/opencv_dart/example
flutter build apk --release --target-platform android-arm64,android-arm,android-x64 --split-per-abi
DART_SIZE_ARM64=$(($(stat -c%s "build/app/outputs/apk/release/app-arm64-v8a-release.apk" || echo "0") / 1024))
DART_SIZE_ARMV7=$(($(stat -c%s "build/app/outputs/apk/release/app-armeabi-v7a-release.apk" || echo "0") / 1024))
DART_SIZE_X64=$(($(stat -c%s "build/app/outputs/apk/release/app-x86_64-release.apk" || echo "0") / 1024))
echo "DART_SIZE_ARM64=$DART_SIZE_ARM64" >> $GITHUB_ENV
echo "DART_SIZE_ARMV7=$DART_SIZE_ARMV7" >> $GITHUB_ENV
echo "DART_SIZE_X64=$DART_SIZE_X64" >> $GITHUB_ENV
dir ${{ github.workspace}}/packages/opencv_core/android/.cxx
# Build full APK for opencv_dart (universal)
- name: opencv_dart full apk size
run: |
cd packages/opencv_dart/example
flutter build apk --release
DART_FULL_SIZE=$(($(stat -c%s "build/app/outputs/apk/release/app-release.apk" || echo "0") / 1024))
echo "DART_FULL_SIZE=$DART_FULL_SIZE" >> $GITHUB_ENV
# Generate size comparison JSON
- name: Generate size report
run: |
cat > android_size_report.json << EOL
{
"platform": "android",
"base_size": {
"arm64-v8a": ${BASE_SIZE_ARM64:-0},
"armeabi-v7a": ${BASE_SIZE_ARMV7:-0},
"x86_64": ${BASE_SIZE_X64:-0},
"full_apk_size": ${BASE_FULL_SIZE:-0}
},
"opencv_core": {
"arm64-v8a": {
"total_size": ${CORE_SIZE_ARM64:-0},
"package_size": $(( ${CORE_SIZE_ARM64:-0} - ${BASE_SIZE_ARM64:-0} ))
},
"armeabi-v7a": {
"total_size": ${CORE_SIZE_ARMV7:-0},
"package_size": $(( ${CORE_SIZE_ARMV7:-0} - ${BASE_SIZE_ARMV7:-0} ))
},
"x86_64": {
"total_size": ${CORE_SIZE_X64:-0},
"package_size": $(( ${CORE_SIZE_X64:-0} - ${BASE_SIZE_X64:-0} ))
},
"full_apk_size": {
"total_size": ${CORE_FULL_SIZE:-0},
"package_size": $(( ${CORE_FULL_SIZE:-0} - ${BASE_FULL_SIZE:-0} ))
}
},
"opencv_dart": {
"arm64-v8a": {
"total_size": ${DART_SIZE_ARM64:-0},
"package_size": $(( ${DART_SIZE_ARM64:-0} - ${BASE_SIZE_ARM64:-0} ))
},
"armeabi-v7a": {
"total_size": ${DART_SIZE_ARMV7:-0},
"package_size": $(( ${DART_SIZE_ARMV7:-0} - ${BASE_SIZE_ARMV7:-0} ))
},
"x86_64": {
"total_size": ${DART_SIZE_X64:-0},
"package_size": $(( ${DART_SIZE_X64:-0} - ${BASE_SIZE_X64:-0} ))
},
"full_apk_size": {
"total_size": ${DART_FULL_SIZE:-0},
"package_size": $(( ${DART_FULL_SIZE:-0} - ${BASE_FULL_SIZE:-0} ))
}
}
}
EOL
- name: Upload size report
uses: actions/upload-artifact@v4
with:
name: android-size-report
path: android_size_report.json
- name: Upload apk
uses: actions/upload-artifact@v4
with:
name: opencv_core-arm64-v8a-release.apk
path: packages/opencv_core/example/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
linux:
name: linux-size-comparison
runs-on: ubuntu-latest
steps:
- name: Setup dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa
sudo apt-get install clang cmake git \
ninja-build pkg-config \
libgtk-3-dev liblzma-dev \
libstdc++-12-dev
- uses: subosito/flutter-action@v2
with:
channel: "stable"
- uses: actions/checkout@v4
# Create and build base project
- name: Create base project
run: |
mkdir size_comparison
cd size_comparison
flutter create base_project
cd base_project
flutter build linux --release
BASE_SIZE=$(du -sk "build/linux/x64/release/bundle" | cut -f1)
echo "BASE_SIZE=$BASE_SIZE" >> $GITHUB_ENV
# Build and measure opencv_core
- name: opencv_core size
run: |
cd packages/opencv_core/example
flutter build linux --release
CORE_SIZE=$(du -sk "build/linux/x64/release/bundle" | cut -f1)
echo "CORE_SIZE=$CORE_SIZE" >> $GITHUB_ENV
# Build and measure opencv_dart
- name: opencv_dart size
run: |
cd packages/opencv_dart/example
flutter build linux --release
DART_SIZE=$(du -sk "build/linux/x64/release/bundle" | cut -f1)
echo "DART_SIZE=$DART_SIZE" >> $GITHUB_ENV
# Generate size comparison JSON
- name: Generate size report
run: |
base_size=${BASE_SIZE:-0}
core_size=${CORE_SIZE:-0}
dart_size=${DART_SIZE:-0}
core_diff=$((core_size - base_size))
dart_diff=$((dart_size - base_size))
cat > linux_size_report.json << EOL
{
"platform": "linux",
"base_size": $base_size,
"opencv_core": {
"total_size": $core_size,
"package_size": $core_diff
},
"opencv_dart": {
"total_size": $dart_size,
"package_size": $dart_diff
}
}
EOL
- name: Upload size report
uses: actions/upload-artifact@v4
with:
name: linux-size-report
path: linux_size_report.json
ios:
name: ios-size-comparison
runs-on: macos-14
steps:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
- uses: actions/checkout@v4
# Create and build base project
- name: Create base project
run: |
mkdir size_comparison
cd size_comparison
flutter create base_project
cd base_project
flutter build ios --release --no-codesign
BASE_SIZE=$(du -sk "build/ios/iphoneos/Runner.app" | cut -f1)
echo "BASE_SIZE=$BASE_SIZE" >> $GITHUB_ENV
# Build and measure opencv_core
- name: opencv_core size
run: |
cd packages/opencv_core/example
flutter build ios --release --no-codesign
CORE_SIZE=$(du -sk "build/ios/iphoneos/Runner.app" | cut -f1)
echo "CORE_SIZE=$CORE_SIZE" >> $GITHUB_ENV
# Build and measure opencv_dart
- name: opencv_dart size
run: |
cd packages/opencv_dart/example
flutter build ios --release --no-codesign
DART_SIZE=$(du -sk "build/ios/iphoneos/Runner.app" | cut -f1)
echo "DART_SIZE=$DART_SIZE" >> $GITHUB_ENV
# Generate size comparison JSON
- name: Generate size report
run: |
base_size=${BASE_SIZE:-0}
core_size=${CORE_SIZE:-0}
dart_size=${DART_SIZE:-0}
core_diff=$((core_size - base_size))
dart_diff=$((dart_size - base_size))
cat > ios_size_report.json << EOL
{
"platform": "ios",
"base_size": $base_size,
"opencv_core": {
"total_size": $core_size,
"package_size": $core_diff
},
"opencv_dart": {
"total_size": $dart_size,
"package_size": $dart_diff
}
}
EOL
- name: Upload size report
uses: actions/upload-artifact@v4
with:
name: ios-size-report
path: ios_size_report.json
macos:
name: macos-size-comparison
runs-on: macos-13
steps:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
- uses: actions/checkout@v4
# Create and build base project
- name: Create base project
run: |
mkdir size_comparison
cd size_comparison
flutter create base_project
cd base_project
flutter build macos --release
BASE_SIZE=$(du -sk "build/macos/Build/Products/Release/base_project.app" | cut -f1)
echo "BASE_SIZE=$BASE_SIZE" >> $GITHUB_ENV
# Build and measure opencv_core
- name: opencv_core size
run: |
cd packages/opencv_core/example
flutter build macos --release
CORE_SIZE=$(du -sk "build/macos/Build/Products/Release/opencv_core_example.app" | cut -f1)
echo "CORE_SIZE=$CORE_SIZE" >> $GITHUB_ENV
# Build and measure opencv_dart
- name: opencv_dart size
run: |
cd packages/opencv_dart/example
flutter build macos --release
DART_SIZE=$(du -sk "build/macos/Build/Products/Release/opencv_dart_example.app" | cut -f1)
echo "DART_SIZE=$DART_SIZE" >> $GITHUB_ENV
# Generate size comparison JSON
- name: Generate size report
run: |
base_size=${BASE_SIZE:-0}
core_size=${CORE_SIZE:-0}
dart_size=${DART_SIZE:-0}
core_diff=$((core_size - base_size))
dart_diff=$((dart_size - base_size))
cat > macos_size_report.json << EOL
{
"platform": "macos",
"base_size": $base_size,
"opencv_core": {
"total_size": $core_size,
"package_size": $core_diff
},
"opencv_dart": {
"total_size": $dart_size,
"package_size": $dart_diff
}
}
EOL
- name: Upload size report
uses: actions/upload-artifact@v4
with:
name: macos-size-report
path: macos_size_report.json
macos-arm:
name: macos-arm-size-comparison
runs-on: macos-14
steps:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
- uses: actions/checkout@v4
# Create and build base project
- name: Create base project
run: |
mkdir size_comparison
cd size_comparison
flutter create base_project
cd base_project
flutter build macos --release
BASE_SIZE=$(du -sk "build/macos/Build/Products/Release/base_project.app" | cut -f1)
echo "BASE_SIZE=$BASE_SIZE" >> $GITHUB_ENV
# Build and measure opencv_core
- name: opencv_core size
run: |
cd packages/opencv_core/example
flutter build macos --release
CORE_SIZE=$(du -sk "build/macos/Build/Products/Release/opencv_core_example.app" | cut -f1)
echo "CORE_SIZE=$CORE_SIZE" >> $GITHUB_ENV
# Build and measure opencv_dart
- name: opencv_dart size
run: |
cd packages/opencv_dart/example
flutter build macos --release
DART_SIZE=$(du -sk "build/macos/Build/Products/Release/opencv_dart_example.app" | cut -f1)
echo "DART_SIZE=$DART_SIZE" >> $GITHUB_ENV
# Generate size comparison JSON
- name: Generate size report
run: |
base_size=${BASE_SIZE:-0}
core_size=${CORE_SIZE:-0}
dart_size=${DART_SIZE:-0}
core_diff=$((core_size - base_size))
dart_diff=$((dart_size - base_size))
cat > macos_arm_size_report.json << EOL
{
"platform": "macos-arm",
"base_size": $base_size,
"opencv_core": {
"total_size": $core_size,
"package_size": $core_diff
},
"opencv_dart": {
"total_size": $dart_size,
"package_size": $dart_diff
}
}
EOL
- name: Upload size report
uses: actions/upload-artifact@v4
with:
name: macos-arm-size-report
path: macos_arm_size_report.json
combine-reports:
name: Generate Combined Size Reports
needs: [windows, android, ios, linux, macos, macos-arm]
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- uses: actions/checkout@v4
with:
# Checkout the fork/head-repository and push changes to the fork.
# If you skip this, the base repository will be checked out and changes
# will be committed to the base repository!
repository: ${{ github.event.pull_request.head.repo.full_name }}
# Checkout the branch made in the fork. Will automatically push changes
# back to this branch.
ref: ${{ github.head_ref }}
token: ${{ secrets.COMMIT_PAT }}
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pandas numpy
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: size-reports
- name: Generate Combined Report
id: combine-reports
run: |
python scripts/generate_combined_report.py
- name: Generate SVG Reports
if: steps.combine-reports.outputs.status == 'success'
id: generate-svgs
run: |
python scripts/generate_svgs.py
- name: Create Report Summary
if: always()
run: |
echo "## Size Report Generation Summary" >> $GITHUB_STEP_SUMMARY
echo "### Status" >> $GITHUB_STEP_SUMMARY
if [[ "${{ steps.generate-svgs.outputs.status }}" == "success" ]]; then
echo "✅ Report generation completed successfully" >> $GITHUB_STEP_SUMMARY
else
echo "❌ Report generation failed" >> $GITHUB_STEP_SUMMARY
fi
echo "### Details" >> $GITHUB_STEP_SUMMARY
echo "- Reports processed: ${{ steps.combine-reports.outputs.report_count }}" >> $GITHUB_STEP_SUMMARY
echo "- Generated at: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
- name: Upload Combined JSON Report
if: steps.combine-reports.outputs.status == 'success'
uses: actions/upload-artifact@v4
with:
name: combined-size-report
path: combined_size_report.json
if-no-files-found: error
- name: Upload SVG Reports
if: steps.generate-svgs.outputs.status == 'success'
uses: actions/upload-artifact@v4
with:
name: svg-size-reports
path: images/*_size_report.svg
if-no-files-found: warn
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Commit SVG reports"
file_pattern: 'packages/*/images/*_size_report.svg'