Skip to content

Commit

Permalink
Update calculation script
Browse files Browse the repository at this point in the history
  • Loading branch information
andremion committed Dec 31, 2024
1 parent 4f5c885 commit 0f74c62
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/sdk-size-checks.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: SDK size checks

on:
pull_request:
# pull_request:
workflow_dispatch:

env:
MODULES: "stream-chat-android-client stream-chat-android-offline stream-chat-android-ui-components stream-chat-android-compose"
Expand Down
28 changes: 16 additions & 12 deletions .github/workflows/sdk-size-updates.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: SDK size updates

on:
push:
branches:
- develop
# push:
# branches:
# - develop
pull_request:

workflow_dispatch:

Expand All @@ -12,8 +13,8 @@ concurrency:
cancel-in-progress: true

env:
MODULES: "stream-chat-android-client stream-chat-android-offline stream-chat-android-ui-components stream-chat-android-compose"
VARIANTS: "debug release"
MODULES: "stream-chat-android-compose"
VARIANTS: "debug release-unsigned"
METRICS_FILE: "metrics/size.json"
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

Expand All @@ -32,7 +33,7 @@ jobs:
- name: Assemble SDKs
run: |
for module in $MODULES; do
modules+=" :$module:assemble"
modules+=" :metrics:$module-baseline:assemble :metrics:$module-stream:assemble"
done
./gradlew $modules
Expand All @@ -44,13 +45,16 @@ jobs:
# Calculate sizes
for module in $MODULES; do
for variant in $VARIANTS; do
file="$module/build/outputs/aar/$module-$variant.aar"
# Ensure file exists
if [ -f "$file" ]; then
size=$(du -k "$file" | awk '{print $1}')
baselineFile="metrics/$module/build/outputs/apk/$variant/$module-baseline-$variant.apk"
streamFile="metrics/$module/build/outputs/apk/$variant/$module-stream-$variant.apk"
# Ensure files exist
if [[ -f "$baselineFile" && -f "$streamFile" ]]; then
baselineSize=$(du -k "$baselineFile" | awk '{print $1}')
streamSize=$(du -k "$streamFile" | awk '{print $1}')
size=$((streamSize - baselineSize))
else
echo "Warning: $file not found. Setting size to 0."
echo "Warning: $baselineFile or $streamFile not found. Setting size to 0."
size=0
fi
Expand Down

0 comments on commit 0f74c62

Please sign in to comment.