Skip to content

Commit

Permalink
[CI] Adjust sdk size report on release PRs (#3346)
Browse files Browse the repository at this point in the history
  • Loading branch information
testableapple authored Jul 30, 2024
1 parent 5e54822 commit a5692e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/smoke-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ jobs:
INSTALL_YEETD: true
SKIP_MINT_BOOTSTRAP: true
SKIP_BREW_BOOTSTRAP: true
- name: Get branch name
id: get_branch_name
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
- name: Run UI Tests (Debug)
run: bundle exec fastlane test_e2e_mock device:"${{ env.IOS_SIMULATOR_DEVICE }}" batch:'${{ matrix.batch }}' test_without_building:true
timeout-minutes: 100
Expand All @@ -233,6 +236,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_NUM: ${{ github.event.number }}
MATRIX_SIZE: ${{ strategy.job-total }}
BRANCH_NAME: ${{ steps.get_branch_name.outputs.branch }}
STREAM_DEMO_APP_SECRET: ${{ secrets.STREAM_DEMO_APP_SECRET }}
- name: Allure TestOps Upload
if: env.LAUNCH_ID != '' && (success() || failure())
Expand Down
16 changes: 10 additions & 6 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -841,13 +841,16 @@ lane :show_frameworks_sizes do |options|
['metrics/'].each { |dir| FileUtils.remove_dir(dir, force: true) }

sh("git clone #{metrics_git} #{File.dirname(sdk_size_path)}")
develop_sizes = JSON.parse(File.read(sdk_size_path))
is_release = current_branch.include?('release/')
benchmark_config = JSON.parse(File.read(sdk_size_path))
benchmark_key = is_release ? 'release' : 'develop'
benchmark_sizes = benchmark_config[benchmark_key]
branch_sizes = options[:sizes] || frameworks_sizes

table_header = '## SDK Size'
markdown_table = "#{table_header}\n| `title` | `develop` | `branch` | `diff` | `status` |\n| - | - | - | - | - |\n"
markdown_table = "#{table_header}\n| `title` | `#{is_release ? 'previous release' : 'develop'}` | `#{is_release ? 'current release' : 'branch'}` | `diff` | `status` |\n| - | - | - | - | - |\n"
sdk_names.each do |title|
benchmark_value = develop_sizes[title]
benchmark_value = benchmark_sizes[title]
branch_value = branch_sizes[title.to_sym]
max_tolerance = 0.5 # Max Tolerance is 0.5MB
fine_tolerance = 0.25 # Fine Tolerance is 0.25MB
Expand All @@ -868,12 +871,13 @@ lane :show_frameworks_sizes do |options|
markdown_table << "|#{title}|#{benchmark_value}MB|#{branch_value}MB|#{diff}MB|#{status_emoji}|\n"
end

FastlaneCore::PrintTable.print_values(title: 'Benchmark', config: develop_sizes)
FastlaneCore::PrintTable.print_values(title: 'Benchmark', config: benchmark_sizes)
FastlaneCore::PrintTable.print_values(title: 'SDK Size', config: branch_sizes)

if is_ci
if ENV['GITHUB_EVENT_NAME'].to_s == 'push'
File.write(sdk_size_path, JSON.pretty_generate(branch_sizes))
if is_release || ENV['GITHUB_EVENT_NAME'].to_s == 'push'
benchmark_config[benchmark_key] = branch_sizes
File.write(sdk_size_path, JSON.pretty_generate(benchmark_config))
Dir.chdir(File.dirname(sdk_size_path)) do
if sh('git status -s', log: false).to_s.empty?
UI.important('No changes in SDK sizes benchmarks.')
Expand Down

0 comments on commit a5692e3

Please sign in to comment.