From 02ecd81b6e89d7d8c4782c1108d014b682993d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Mion?= Date: Tue, 31 Dec 2024 10:10:30 +0000 Subject: [PATCH] Update checks script --- .github/workflows/sdk-size-checks.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sdk-size-checks.yml b/.github/workflows/sdk-size-checks.yml index a532420a59b..4f815ffb4eb 100644 --- a/.github/workflows/sdk-size-checks.yml +++ b/.github/workflows/sdk-size-checks.yml @@ -5,7 +5,7 @@ on: workflow_dispatch: env: - MODULES: "stream-chat-android-client stream-chat-android-offline stream-chat-android-ui-components stream-chat-android-compose" + MODULES: "stream-chat-android-compose" METRICS_FILE: "metrics/size.json" MAX_TOLERANCE: 500 FINE_TOLERANCE: 250 @@ -25,7 +25,7 @@ jobs: - name: Assemble SDKs run: | for module in $MODULES; do - modules+=" :$module:assembleDebug" + modules+=" :metrics:$module-baseline:assemble :metrics:$module-stream:assemble" done ./gradlew $modules @@ -41,10 +41,16 @@ jobs: run: | echo '{}' > pr_sdk_sizes.json - # Calculate sizes from the .aar files and save them into a temporary JSON file + # Calculate sizes from the .apk files and save them into a temporary JSON file # so it can be exported for the next job step for module in $MODULES; do - size=$(du -k $module/build/outputs/aar/*debug.aar | awk '{print $1}') + baselineFile="metrics/$module/build/outputs/apk/debug/$module-baseline-debug.apk" + streamFile="metrics/$module/build/outputs/apk/debug/$module-stream-debug.apk" + + baselineSize=$(du -k "$baselineFile" | awk '{print $1}') + streamSize=$(du -k "$streamFile" | awk '{print $1}') + size=$((streamSize - baselineSize)) + jq -c --arg sdk "$module" --arg size "$size" '. + {($sdk): ($size | tonumber)}' pr_sdk_sizes.json > temp.json && mv temp.json pr_sdk_sizes.json done