Skip to content

Conversation

@testableapple
Copy link
Contributor

@testableapple testableapple commented Oct 10, 2025

Resolve https://linear.app/stream/issue/IOS-1195

Screenshot 2025-10-10 at 4 17 14 PM

Summary by CodeRabbit

  • CI
    • Split SDK size metrics into general and detailed analyses; introduced a PR-number environment variable.
  • Build
    • Enabled generation of linker map files across build configurations for improved size visibility.
    • Added a lane to run detailed SDK size analysis.
  • Chores
    • Updated size-analysis tooling plugins.
    • Added ignore rule for LinkMap files to reduce VCS noise.

@testableapple testableapple requested a review from a team as a code owner October 10, 2025 17:03
@testableapple testableapple added the 🤖 CI/CD Any work related to CI/CD label Oct 10, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 10, 2025

Walkthrough

Adds CI steps and Fastlane support for a detailed SDK size analysis: workflow runs general and detailed size metrics; Fastlane gains a size_analyze lane and xcsize plugin; Xcode configs now emit LinkMap files; LinkMap files are ignored in git.

Changes

Cohort / File(s) Summary
CI workflow: SDK size metrics
.github/workflows/sdk-size-metrics.yml
Adds job-level GITHUB_PR_NUM; renames existing step to "Run General SDK Size Metrics" (uses show_frameworks_sizes); adds new "Run Detailed SDK Size Metrics" step that calls size_analyze for expanded analysis.
Git ignore updates
.gitignore
Adds ignore rule for *LinkMap.txt.
Xcode build settings for Link Maps
Project file(s)
StreamChat.xcodeproj/.../project.pbxproj
Adds LD_GENERATE_MAP_FILE = YES; and LD_MAP_FILE_PATH = "linkmaps/$(PRODUCT_NAME)-$(CURRENT_ARCH)-LinkMap.txt"; to Debug/Release/Profile build configurations to emit LinkMap files.
Fastlane: lanes and usages
fastlane/Fastfile
Converts frameworks_sizes to a private lane, passes additional paths (derived_data_path, cloned_source_packages_path), and adds new size_analyze lane that builds Release (skipping archive/package/codesign) and invokes show_detailed_sdk_size (threshold=42).
Fastlane: plugins
fastlane/Pluginfile
Bumps fastlane-plugin-stream_actions to 0.3.100 and adds fastlane-plugin-xcsize 1.1.0.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant GH as GitHub Actions (sdk_size job)
  participant FL as Fastlane
  participant XC as Xcode Build
  participant PL as Plugins (stream_actions, xcsize)

  GH->>FL: Run General SDK Size Metrics\n(show_frameworks_sizes)
  FL->>PL: invoke show_frameworks_sizes
  PL-->>GH: General framework size summary

  GH->>FL: Run Detailed SDK Size Metrics\n(size_analyze)
  FL->>XC: gym build (Release, skip archive/package/codesign)
  rect rgb(221,235,247)
    note right of XC: Build configs set\nLD_GENERATE_MAP_FILE=YES\nLD_MAP_FILE_PATH -> linkmaps/...
  end
  XC-->>FL: Build artifacts + LinkMap files
  FL->>PL: invoke show_detailed_sdk_size (xcsize)
  PL-->>GH: Detailed size report (threshold-aware)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • [CI] Update Ruby gems #3760 — updates fastlane/Pluginfile (same dependency family and stream_actions version bump), likely related to plugin/version changes.

Suggested reviewers

  • laevandus
  • nuno-vieira

Poem

I nibble bytes beneath the moon,
LinkMaps stacked in tidy tune,
Fastlane hops, the builds align,
Reports unfold with threshold fine,
A rabbit tallies every line. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “[CI] Implement detailed size metrics” clearly and concisely reflects the main change of adding detailed size measurement steps to the CI pipeline, matching the updates in workflow files, Fastfile lanes, and build settings.
Linked Issues Check ✅ Passed The PR implements detailed size analysis by generating linker map files in Xcode configurations, adding a new size_analyze lane and CI workflow step, and updating Fastfile calls, directly fulfilling the coding requirements of IOS-1195 for detailed size metrics.
Out of Scope Changes Check ✅ Passed All changes—including CI workflow modifications, linker map generation settings, Fastfile enhancements, and .gitignore updates—are directly related to implementing detailed size metrics, with no unrelated or out-of-scope code introduced.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci/xcsize-poc

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
fastlane/Fastfile (1)

935-946: LGTM! The size analysis lane is well-structured.

The new size_analyze lane correctly builds DemoApp for size analysis without unnecessary packaging or signing steps. The use of show_detailed_sdk_size with the sdk_names and threshold aligns with the PR's goal of implementing detailed size metrics.

Optional: Consider adding derived_data_path for consistency.

For consistency with other lanes in this file (e.g., lines 315-332, 614-627), you might consider specifying derived_data_path and cloned_source_packages_path in the gym call:

 lane :size_analyze do
   gym(
     scheme: 'DemoApp',
     configuration: 'Release',
+    derived_data_path: derived_data_path,
+    cloned_source_packages_path: source_packages_path,
     skip_archive: true,
     skip_package_ipa: true,
     skip_package_pkg: true,
     skip_codesigning: true
   )

   show_detailed_sdk_size(sdk_names: sdk_names, threshold: 1)
 end

This would provide consistent build artifact locations across all lanes, though the current implementation should work correctly without them.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 51e5ada and 226103c.

⛔ Files ignored due to path filters (1)
  • Gemfile.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/sdk-size-metrics.yml (2 hunks)
  • .gitignore (1 hunks)
  • StreamChat.xcodeproj/project.pbxproj (6 hunks)
  • fastlane/Fastfile (1 hunks)
  • fastlane/Pluginfile (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build LLC + UI (Xcode 15)
  • GitHub Check: Metrics
  • GitHub Check: Metrics
🔇 Additional comments (2)
fastlane/Pluginfile (1)

8-9: LGTM! Plugin additions support the new size analysis.

The version bump for fastlane-plugin-stream_actions and the addition of fastlane-plugin-xcsize appropriately support the detailed SDK size metrics feature introduced in this PR.

.gitignore (1)

102-102: LGTM! Appropriate exclusion of LinkMap build artifacts.

The *LinkMap.txt pattern correctly ignores linker map files that are generated as part of the detailed size analysis workflow.

Comment on lines +39 to +41
- name: Run Detailed SDK Size Metrics
run: bundle exec fastlane size_analyze
timeout-minutes: 30
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Restore secrets for the detailed lane.

size_analyze is expected to hit the same signing/App Store flows as show_frameworks_sizes. Without MATCH_PASSWORD and APPSTORE_API_KEY in this step’s env, the lane will fail in CI. Please mirror the secrets block from the general metrics step here.

🤖 Prompt for AI Agents
.github/workflows/sdk-size-metrics.yml around lines 39 to 41: the "Run Detailed
SDK Size Metrics" step runs fastlane size_analyze but does not restore the
required signing/App Store secrets, so CI will fail; copy/mirror the same
secrets/env block used by the general metrics step (add the MATCH_PASSWORD and
APPSTORE_API_KEY entries — or the entire env: secrets: block from that step)
into this step so size_analyze has the necessary credentials in CI.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
fastlane/Fastfile (2)

935-946: Consider adding cleanup before building.

The frameworks_sizes method (line 905) cleans up the build directory before starting. This lane may benefit from similar cleanup to ensure size metrics aren't affected by stale build artifacts, especially in CI environments where builds might be cached.

If cleanup is needed, add this before the gym call:

lane :size_analyze do
  # Cleanup previous builds
  FileUtils.rm_rf("../#{derived_data_path}/")
  
  gym(
    # ... existing options
  )
  
  show_detailed_sdk_size(sdk_names: sdk_names, threshold: 42)
end

Alternatively, if reusing the build directory is intentional for performance, consider adding a comment documenting this behavior.


945-945: Document or make the threshold value configurable.

The threshold value of 42 appears to be a magic number without explanation. Consider either:

  • Making it configurable via options[:threshold] with a default value
  • Adding a comment explaining what the threshold represents and why 42 was chosen
  • Moving it to a constant at the top of the file

Option 1 - Make it configurable:

-lane :size_analyze do
+lane :size_analyze do |options|
   gym(
     scheme: 'DemoApp',
     configuration: 'Release',
     skip_archive: true,
     skip_package_ipa: true,
     skip_package_pkg: true,
     skip_codesigning: true
   )
 
-  show_detailed_sdk_size(sdk_names: sdk_names, threshold: 42)
+  show_detailed_sdk_size(sdk_names: sdk_names, threshold: options[:threshold] || 42)
 end

Option 2 - Add a comment:

+  # Threshold in bytes: report objects with size changes >= 42 bytes
   show_detailed_sdk_size(sdk_names: sdk_names, threshold: 42)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 226103c and 9d29af7.

📒 Files selected for processing (1)
  • fastlane/Fastfile (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Automated Code Review
  • GitHub Check: Metrics

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
fastlane/Fastfile (1)

947-948: Previous review feedback addressed.

The derived_data_path parameter requested in the previous review has been successfully added, ensuring consistent build cache behavior with other lanes.

🧹 Nitpick comments (1)
fastlane/Fastfile (1)

951-951: Consider documenting the threshold value.

The threshold value of 42 lacks context. Adding a comment explaining the unit (bytes? KB?) and purpose would improve maintainability.

For example:

-  show_detailed_sdk_size(sdk_names: sdk_names, threshold: 42)
+  # Report size changes >= 42 bytes
+  show_detailed_sdk_size(sdk_names: sdk_names, threshold: 42)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9d29af7 and a9342f3.

📒 Files selected for processing (1)
  • fastlane/Fastfile (3 hunks)
🔇 Additional comments (1)
fastlane/Fastfile (1)

900-935: LGTM! Improved consistency and encapsulation.

The changes enhance this lane in two ways:

  • Changing from def to private_lane better encapsulates the internal implementation.
  • Adding derived_data_path and cloned_source_packages_path ensures consistent build caching with other lanes (e.g., lines 736, 758, 911).

@Stream-SDK-Bot
Copy link
Collaborator

SDK Size

title develop branch diff status
StreamChat 8.26 MB 8.26 MB 0 KB 🟢
StreamChatUI 4.89 MB 4.89 MB 0 KB 🟢

@Stream-SDK-Bot
Copy link
Collaborator

StreamChat XCSize

No changes in SDK size.

@Stream-SDK-Bot
Copy link
Collaborator

StreamChatUI XCSize

No changes in SDK size.

@sonarqubecloud
Copy link

@testableapple testableapple enabled auto-merge (squash) October 11, 2025 19:11
Copy link
Contributor

@laevandus laevandus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Nice addition

@testableapple testableapple merged commit 8017e1e into develop Oct 13, 2025
23 of 24 checks passed
@testableapple testableapple deleted the ci/xcsize-poc branch October 13, 2025 05:59
@coderabbitai coderabbitai bot mentioned this pull request Oct 20, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 CI/CD Any work related to CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants