@@ -495,13 +495,16 @@ lane :show_frameworks_sizes do |options|
495
495
[ 'metrics/' ] . each { |dir | FileUtils . remove_dir ( dir , force : true ) }
496
496
497
497
sh ( "git clone #{ metrics_git } #{ File . dirname ( sdk_size_path ) } " )
498
- develop_sizes = JSON . parse ( File . read ( sdk_size_path ) )
498
+ is_release = current_branch . include? ( 'release/' )
499
+ benchmark_config = JSON . parse ( File . read ( sdk_size_path ) )
500
+ benchmark_key = is_release ? 'release' : 'develop'
501
+ benchmark_sizes = benchmark_config [ benchmark_key ]
499
502
branch_sizes = options [ :sizes ] || frameworks_sizes
500
503
501
504
table_header = '## SDK Size'
502
- markdown_table = "#{ table_header } \n | `title` | `develop` | `branch` | `diff` | `status` |\n | - | - | - | - | - |\n "
505
+ markdown_table = "#{ table_header } \n | `title` | `#{ is_release ? 'previous release' : ' develop' } ` | `#{ is_release ? 'current release' : ' branch' } ` | `diff` | `status` |\n | - | - | - | - | - |\n "
503
506
sdk_names . each do |title |
504
- benchmark_value = develop_sizes [ title ]
507
+ benchmark_value = benchmark_sizes [ title ]
505
508
branch_value = branch_sizes [ title . to_sym ]
506
509
max_tolerance = 0.5 # Max Tolerance is 0.5MB
507
510
fine_tolerance = 0.25 # Fine Tolerance is 0.25MB
@@ -522,12 +525,13 @@ lane :show_frameworks_sizes do |options|
522
525
markdown_table << "|#{ title } |#{ benchmark_value } MB|#{ branch_value } MB|#{ diff } MB|#{ status_emoji } |\n "
523
526
end
524
527
525
- FastlaneCore ::PrintTable . print_values ( title : 'Benchmark' , config : develop_sizes )
528
+ FastlaneCore ::PrintTable . print_values ( title : 'Benchmark' , config : benchmark_sizes )
526
529
FastlaneCore ::PrintTable . print_values ( title : 'SDK Size' , config : branch_sizes )
527
530
528
531
if is_ci
529
- if ENV [ 'GITHUB_EVENT_NAME' ] . to_s == 'push'
530
- File . write ( sdk_size_path , JSON . pretty_generate ( branch_sizes ) )
532
+ if is_release || ENV [ 'GITHUB_EVENT_NAME' ] . to_s == 'push'
533
+ benchmark_config [ benchmark_key ] = branch_sizes
534
+ File . write ( sdk_size_path , JSON . pretty_generate ( benchmark_config ) )
531
535
Dir . chdir ( File . dirname ( sdk_size_path ) ) do
532
536
if sh ( 'git status -s' , log : false ) . to_s . empty?
533
537
UI . important ( 'No changes in SDK sizes benchmarks.' )
0 commit comments