Skip to content

ci: parallelize xcframework slice builds #5218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 73 commits into
base: main
Choose a base branch
from

Conversation

armcknight
Copy link
Member

@armcknight armcknight commented May 9, 2025

The job to build the xcframework builds all the slices in serial, which takes upwards of 30 minutes. There are at least 6 slices, so if we parallelize these, we should be able to cut that time down to a small fraction.

Before: 30 minutes 52 seconds
After: 6 minutes 17 seconds

One thing I noticed but haven't yet addressed is that the SentrySwiftUI build actually produced Sentry.xcframework as well, because to archive the SentrySwiftUI target, Sentry target must be built as well as it's a dependency. So, we could avoid the duplicated tests with some tweaks to the workflow logic. I just haven't figured out how to do that yet.

Another future task could be caching individual slices and assembled variants, as not all will always need to be rebuilt (think, if uikit code is modified, then the UIKitless variant won't need to be rebuilt).

#skip-changelog

Fixes GH-4925

@philipphofmann
Copy link
Member

That would be super nice to get done. Thanks for starting this @armcknight.

@armcknight armcknight changed the title ref: extract xcframework-based jobs from build.yml into new build-xcframework.yml ref: parallelize xcframework slice builds May 12, 2025
@armcknight armcknight changed the title ref: parallelize xcframework slice builds ci: parallelize xcframework slice builds May 12, 2025
@armcknight
Copy link
Member Author

Got the slices all building in parallel, working on downloading the artifacts for assembly together. It's looking like the total job time will be around 5-6 minutes now based on https://github.com/getsentry/sentry-cocoa/actions/runs/15080146739

@armcknight
Copy link
Member Author

Fiiiiinally got all the things in the right path locations to get it all passing again. Final result: 6m17s.

@armcknight
Copy link
Member Author

armcknight commented May 23, 2025

The only CI checks I validated were in the workflow build-xcframework.yml. The failing tests are due to having removed the old build-xcframework.sh script but not yet updating benchmarking.yml or ui-tests.yml to use the new reusable workflows that parallelize the steps from it; #5277 fixes that and should be merged into this branch before merging this one to main.

@@ -1,6 +1,8 @@
name: Release
run-name: Release ${{ github.event.inputs.version }}

# TODO: change this to dispatch the build-xcframework.yml workflow, and then depend on it here with the workflow dependency setup described at https://stackoverflow.com/a/64733705
Copy link
Member Author

Choose a reason for hiding this comment

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

done and removed in #5277

Copy link
Contributor

github-actions bot commented May 23, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1207.55 ms 1228.81 ms 21.26 ms
Size 23.76 KiB 824.89 KiB 801.13 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
bfe863d 1223.19 ms 1236.23 ms 13.04 ms
d33f2c8 1233.67 ms 1246.92 ms 13.24 ms
ebfe678 1234.63 ms 1254.52 ms 19.89 ms
06548c0 1226.71 ms 1252.37 ms 25.66 ms
216bdf9 1193.69 ms 1217.90 ms 24.21 ms
154f795 1225.53 ms 1231.04 ms 5.51 ms
2095ae0 1238.20 ms 1251.37 ms 13.17 ms
27f970b 1234.21 ms 1243.98 ms 9.77 ms
bdd896e 1211.19 ms 1239.06 ms 27.87 ms
0589699 1233.49 ms 1249.09 ms 15.60 ms

App size

Revision Plain With Sentry Diff
bfe863d 21.58 KiB 414.57 KiB 392.99 KiB
d33f2c8 22.31 KiB 820.52 KiB 798.20 KiB
ebfe678 22.31 KiB 775.27 KiB 752.95 KiB
06548c0 20.76 KiB 427.36 KiB 406.59 KiB
216bdf9 21.58 KiB 418.13 KiB 396.54 KiB
154f795 20.76 KiB 435.25 KiB 414.49 KiB
2095ae0 21.90 KiB 709.06 KiB 687.16 KiB
27f970b 21.58 KiB 706.97 KiB 685.39 KiB
bdd896e 22.31 KiB 780.75 KiB 758.43 KiB
0589699 21.58 KiB 656.60 KiB 635.02 KiB

Previous results on branch: armcknight/ci/parallelize-xcframework-build

Startup times

Revision Plain With Sentry Diff
cd452df 1229.82 ms 1254.49 ms 24.67 ms
abb8f1a 1232.08 ms 1245.48 ms 13.40 ms

App size

Revision Plain With Sentry Diff
cd452df 23.76 KiB 824.89 KiB 801.13 KiB
abb8f1a 23.76 KiB 824.89 KiB 801.13 KiB

@armcknight armcknight force-pushed the armcknight/ci/parallelize-xcframework-build branch from fee2b24 to f928af0 Compare May 23, 2025 19:55
@armcknight armcknight changed the base branch from main to itaybre/use_dprint May 23, 2025 19:56
Base automatically changed from itaybre/use_dprint to main May 23, 2025 20:08
Copy link

codecov bot commented May 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.899%. Comparing base (25e00aa) to head (ab6cd13).

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #5218       +/-   ##
=============================================
- Coverage   92.900%   92.899%   -0.002%     
=============================================
  Files          688       688               
  Lines        86303     86299        -4     
  Branches     31201     31192        -9     
=============================================
- Hits         80176     80171        -5     
- Misses        6025      6028        +3     
+ Partials       102       100        -2     

see 9 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 25e00aa...ab6cd13. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@armcknight armcknight force-pushed the armcknight/ci/parallelize-xcframework-build branch from d76e93b to 517598f Compare May 23, 2025 20:27
@armcknight armcknight changed the base branch from main to armcknight/ci/remove-format-code-workflow May 23, 2025 20:27
Base automatically changed from armcknight/ci/remove-format-code-workflow to main May 23, 2025 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parallelize components of xcframework build
3 participants