Skip to content

Commit 8812be4

Browse files
feat: Implement SDK Size analysis on CI (#2612)
1 parent 190be2f commit 8812be4

22 files changed

+451
-336
lines changed

.github/actions/install-and-build-sdk/action.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ runs:
2222
yarn
2323
shell: bash
2424
- name: Install & Build the Sample App
25-
run: |
26-
cd examples/SampleApp/
27-
yarn
25+
working-directory: examples/SampleApp
26+
run: yarn
2827
shell: bash

.github/actions/ruby-cache/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: 'Ruby Cache'
2+
description: 'Cache Ruby dependencies'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- uses: ruby/setup-ruby@v1
7+
with:
8+
ruby-version: 3.1
9+
bundler-cache: true
10+
working-directory: examples/SampleApp

.github/workflows/legacy-sample-distribution.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

.github/workflows/sample-distribution.yml

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ jobs:
1616
name: Build SampleApp iOS and Deploy-${{ github.ref == 'refs/heads/develop' }}
1717
runs-on: [macos-14]
1818
steps:
19-
- uses: actions/checkout@v2
20-
with:
21-
token: ${{ secrets.DOCUSAURUS_GH_TOKEN }}
22-
- name: Install Ruby and Gems
23-
uses: ruby/setup-ruby@v1
19+
- name: Connect Bot
20+
uses: webfactory/ssh-agent@v0.7.0
2421
with:
25-
working-directory: examples/SampleApp
26-
bundler-cache: true
22+
ssh-private-key: ${{ secrets.BOT_SSH_PRIVATE_KEY }}
23+
- uses: actions/checkout@v2
24+
- uses: ./.github/actions/ruby-cache
2725
- name: Install && Build - SDK and Sample App
2826
uses: ./.github/actions/install-and-build-sdk
2927
- name: Cache iOS pods
@@ -34,24 +32,15 @@ jobs:
3432
restore-keys: |
3533
${{ runner.os }}-pods-
3634
- name: iOS Pods setup
37-
uses: nick-invision/retry@v2
38-
with:
39-
timeout_minutes: 30
40-
max_attempts: 3
41-
command: |
42-
cd examples/SampleApp
43-
cd ios
44-
bundle exec pod install
35+
working-directory: examples/SampleApp/ios
36+
run: bundle exec pod install
4537
- name: Build and release Testflight QA
38+
working-directory: examples/SampleApp
39+
run: bundle exec fastlane deploy_to_testflight_qa deploy:${{ github.ref == 'refs/heads/develop' }};
4640
env:
4741
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
4842
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
49-
APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_ID }}
50-
APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
51-
APP_STORE_CONNECT_API_KEY_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY }}
52-
run: |
53-
cd examples/SampleApp
54-
bundle exec fastlane deploy_to_testflight_qa deploy:${{ github.ref == 'refs/heads/develop' }};
43+
APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }}
5544

5645
build_and_deploy_android_s3:
5746
name: Build SampleApp Android and Deploy-${{ github.ref == 'refs/heads/develop' }}
@@ -66,14 +55,13 @@ jobs:
6655
- name: Install && Build - SDK and Sample App
6756
uses: ./.github/actions/install-and-build-sdk
6857
- name: Build
58+
working-directory: examples/SampleApp
6959
run: |
70-
cd examples/SampleApp
7160
mkdir android/app/src/main/assets
7261
mkdir tmp
7362
yarn react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest tmp
7463
cd android
7564
rm -rf $HOME/.gradle/caches/ && ./gradlew assembleRelease
76-
7765
- name: Configure AWS credentials
7866
uses: aws-actions/configure-aws-credentials@v1
7967
if: ${{ github.ref == 'refs/heads/develop' }}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: SDK Size
2+
3+
on:
4+
pull_request:
5+
6+
workflow_dispatch:
7+
8+
push:
9+
branches:
10+
- develop
11+
- main
12+
13+
env:
14+
HOMEBREW_NO_INSTALL_CLEANUP: 1 # Disable cleanup for homebrew, we don't need it on CI
15+
16+
jobs:
17+
sdk_size:
18+
name: Metrics
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Connect Bot
22+
uses: webfactory/ssh-agent@v0.7.0
23+
with:
24+
ssh-private-key: ${{ secrets.BOT_SSH_PRIVATE_KEY }}
25+
26+
- uses: actions/checkout@v3.1.0
27+
28+
- uses: ./.github/actions/ruby-cache
29+
30+
- uses: actions/setup-node@v3
31+
with:
32+
node-version: 18.x
33+
cache: 'yarn'
34+
35+
- name: Run SDK Size Metrics
36+
run: bundle exec fastlane show_frameworks_sizes update_readme:$UPDATE_README open_pr:$UPDATE_README
37+
working-directory: examples/SampleApp
38+
timeout-minutes: 60
39+
env:
40+
GITHUB_PR_NUM: ${{ github.event.pull_request.number }}
41+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
42+
APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }}
43+
GITHUB_TOKEN: ${{ secrets.CI_BOT_GITHUB_TOKEN }}
44+
UPDATE_README: ${{ github.ref == 'refs/heads/main' }}

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,13 @@ e2e/.env
1313
.DS_STORE
1414
*.db
1515
.idea
16+
17+
# Testing
18+
examples/SampleApp/fastlane/fastlane.log
19+
examples/SampleApp/fastlane/report.xml
20+
examples/SampleApp/fastlane/metrics/
21+
examples/SampleApp/tmp/
22+
index.android.bundle
23+
*.app
24+
*.DSYM.zip
25+
**/metrics/

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
[![NPM](https://img.shields.io/npm/v/stream-chat-react-native.svg)](https://www.npmjs.com/package/stream-chat-react-native)
1212
[![Build Status](https://github.com/GetStream/stream-chat-react-native/actions/workflows/release.yml/badge.svg)](https://github.com/GetStream/stream-chat-react-native/actions)
1313
[![Component Reference](https://img.shields.io/badge/docs-component%20reference-blue.svg)](https://getstream.io/chat/docs/sdk/reactnative)
14+
![JS Bundle Size](https://img.shields.io/badge/js_bundle_size-439%20KB-blue)
1415

1516
<img align="right" src="https://getstream.imgix.net/images/ios-chat-tutorial/iphone_chat_art@3x.png?auto=format,enhance" width="50%" />
1617

examples/SampleApp/.ruby-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/SampleApp/Gemfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
source 'https://rubygems.org'
22

3-
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4-
ruby ">= 2.6.10"
3+
# You may use http://rbenv.org to install and use this version
4+
ruby '>= 3.1'
55

66
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
77
# bound in the template on Cocoapods with next React Native release.
8-
gem 'cocoapods', '>= 1.13', '< 1.15'
98
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
9+
gem 'cocoapods', '>= 1.13', '< 1.15'
10+
gem 'fastlane'
11+
gem 'rubocop-performance'
12+
gem 'rubocop-require_tools'
1013

11-
gem "fastlane"
1214
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
1315
eval_gemfile(plugins_path) if File.exist?(plugins_path)

examples/SampleApp/Gemfile.lock

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ GEM
55
base64
66
nkf
77
rexml
8-
activesupport (7.0.8.1)
8+
activesupport (7.0.8.4)
99
concurrent-ruby (~> 1.0, >= 1.0.2)
1010
i18n (>= 1.6, < 2)
1111
minitest (>= 5.1)
@@ -16,18 +16,19 @@ GEM
1616
httpclient (~> 2.8, >= 2.8.3)
1717
json (>= 1.5.1)
1818
artifactory (3.0.17)
19+
ast (2.4.2)
1920
atomos (0.1.3)
2021
aws-eventstream (1.3.0)
21-
aws-partitions (1.962.0)
22-
aws-sdk-core (3.201.3)
22+
aws-partitions (1.966.0)
23+
aws-sdk-core (3.201.5)
2324
aws-eventstream (~> 1, >= 1.3.0)
2425
aws-partitions (~> 1, >= 1.651.0)
25-
aws-sigv4 (~> 1.8)
26+
aws-sigv4 (~> 1.9)
2627
jmespath (~> 1, >= 1.6.1)
2728
aws-sdk-kms (1.88.0)
2829
aws-sdk-core (~> 3, >= 3.201.0)
2930
aws-sigv4 (~> 1.5)
30-
aws-sdk-s3 (1.157.0)
31+
aws-sdk-s3 (1.158.0)
3132
aws-sdk-core (~> 3, >= 3.201.0)
3233
aws-sdk-kms (~> 1)
3334
aws-sigv4 (~> 1.5)
@@ -77,7 +78,7 @@ GEM
7778
colored2 (3.1.2)
7879
commander (4.6.0)
7980
highline (~> 2.0.0)
80-
concurrent-ruby (1.2.3)
81+
concurrent-ruby (1.3.4)
8182
declarative (0.0.20)
8283
digest-crc (0.6.5)
8384
rake (>= 12.0.0, < 14.0.0)
@@ -158,11 +159,13 @@ GEM
158159
xcodeproj (>= 1.13.0, < 2.0.0)
159160
xcpretty (~> 0.3.0)
160161
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
161-
fastlane-plugin-firebase_app_distribution (0.9.0)
162+
fastlane-plugin-firebase_app_distribution (0.9.1)
162163
google-apis-firebaseappdistribution_v1 (~> 0.3.0)
163164
google-apis-firebaseappdistribution_v1alpha (~> 0.2.0)
164165
fastlane-plugin-load_json (0.0.1)
165-
ffi (1.16.3)
166+
fastlane-plugin-stream_actions (0.3.65)
167+
xctest_list (= 1.2.1)
168+
ffi (1.17.0)
166169
fourflusher (2.3.1)
167170
fuzzy_match (2.0.4)
168171
gh_inspector (1.1.3)
@@ -207,18 +210,19 @@ GEM
207210
os (>= 0.9, < 2.0)
208211
signet (>= 0.16, < 2.a)
209212
highline (2.0.3)
210-
http-cookie (1.0.6)
213+
http-cookie (1.0.7)
211214
domain_name (~> 0.5)
212215
httpclient (2.8.3)
213-
i18n (1.14.1)
216+
i18n (1.14.5)
214217
concurrent-ruby (~> 1.0)
215218
jmespath (1.6.2)
216219
json (2.7.2)
217220
jwt (2.8.2)
218221
base64
222+
language_server-protocol (3.17.0.3)
219223
mini_magick (4.13.2)
220224
mini_mime (1.1.5)
221-
minitest (5.22.2)
225+
minitest (5.25.1)
222226
molinillo (0.8.0)
223227
multi_json (1.15.0)
224228
multipart-post (2.4.1)
@@ -229,18 +233,44 @@ GEM
229233
nkf (0.2.0)
230234
optparse (0.5.0)
231235
os (1.1.4)
236+
parallel (1.26.3)
237+
parser (3.3.4.2)
238+
ast (~> 2.4.1)
239+
racc
232240
plist (3.7.1)
233241
public_suffix (4.0.7)
242+
racc (1.8.1)
243+
rainbow (3.1.1)
234244
rake (13.2.1)
245+
regexp_parser (2.9.2)
235246
representable (3.2.0)
236247
declarative (< 0.1.0)
237248
trailblazer-option (>= 0.1.1, < 0.2.0)
238249
uber (< 0.2.0)
239250
retriable (3.1.2)
240-
rexml (3.3.4)
251+
rexml (3.3.5)
241252
strscan
242253
rouge (2.0.7)
254+
rubocop (1.65.1)
255+
json (~> 2.3)
256+
language_server-protocol (>= 3.17.0)
257+
parallel (~> 1.10)
258+
parser (>= 3.3.0.2)
259+
rainbow (>= 2.2.2, < 4.0)
260+
regexp_parser (>= 2.4, < 3.0)
261+
rexml (>= 3.2.5, < 4.0)
262+
rubocop-ast (>= 1.31.1, < 2.0)
263+
ruby-progressbar (~> 1.7)
264+
unicode-display_width (>= 2.4.0, < 3.0)
265+
rubocop-ast (1.32.1)
266+
parser (>= 3.3.1.0)
267+
rubocop-performance (1.21.1)
268+
rubocop (>= 1.48.1, < 2.0)
269+
rubocop-ast (>= 1.31.1, < 2.0)
270+
rubocop-require_tools (0.1.2)
271+
rubocop (>= 0.49.1)
243272
ruby-macho (2.5.1)
273+
ruby-progressbar (1.13.0)
244274
ruby2_keywords (0.0.5)
245275
rubyzip (2.3.2)
246276
security (0.1.5)
@@ -279,6 +309,7 @@ GEM
279309
rouge (~> 2.0.7)
280310
xcpretty-travis-formatter (1.0.1)
281311
xcpretty (~> 0.2, >= 0.0.7)
312+
xctest_list (1.2.1)
282313

283314
PLATFORMS
284315
ruby
@@ -289,9 +320,12 @@ DEPENDENCIES
289320
fastlane
290321
fastlane-plugin-firebase_app_distribution
291322
fastlane-plugin-load_json
323+
fastlane-plugin-stream_actions (= 0.3.65)
324+
rubocop-performance
325+
rubocop-require_tools
292326

293327
RUBY VERSION
294-
ruby 2.7.5p203
328+
ruby 3.3.4p94
295329

296330
BUNDLED WITH
297-
2.3.21
331+
2.5.17

0 commit comments

Comments
 (0)