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 187 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 tasks 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.

Copy link
Contributor

github-actions bot commented May 23, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1227.00 ms 1249.88 ms 22.88 ms
Size 23.75 KiB 844.03 KiB 820.28 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
e4cc043 1230.10 ms 1254.36 ms 24.26 ms
103d817 1211.55 ms 1213.35 ms 1.80 ms
983de17 1260.57 ms 1263.68 ms 3.11 ms
e070f8a 1236.47 ms 1250.50 ms 14.03 ms
afce5bf 1199.94 ms 1213.27 ms 13.33 ms
b9b0f0a 1257.22 ms 1262.57 ms 5.35 ms
60bfc91 1251.29 ms 1261.67 ms 10.39 ms
3fc6a6f 1241.96 ms 1254.13 ms 12.17 ms
6e625c5 1243.47 ms 1243.58 ms 0.11 ms
2deb275 1228.20 ms 1245.02 ms 16.82 ms

App size

Revision Plain With Sentry Diff
e4cc043 22.85 KiB 414.92 KiB 392.07 KiB
103d817 21.58 KiB 571.91 KiB 550.33 KiB
983de17 22.84 KiB 403.19 KiB 380.34 KiB
e070f8a 21.58 KiB 546.20 KiB 524.62 KiB
afce5bf 21.58 KiB 542.18 KiB 520.60 KiB
b9b0f0a 20.76 KiB 434.94 KiB 414.17 KiB
60bfc91 20.76 KiB 434.94 KiB 414.18 KiB
3fc6a6f 22.30 KiB 821.37 KiB 799.07 KiB
6e625c5 22.85 KiB 413.41 KiB 390.56 KiB
2deb275 21.58 KiB 681.72 KiB 660.14 KiB

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

Startup times

Revision Plain With Sentry Diff
df6b0fb 1228.02 ms 1262.15 ms 34.12 ms
561986c 1207.55 ms 1228.81 ms 21.26 ms
7865e6e 1233.12 ms 1255.29 ms 22.16 ms
ff09fb1 1222.22 ms 1251.30 ms 29.07 ms
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
df6b0fb 23.75 KiB 840.53 KiB 816.78 KiB
561986c 23.76 KiB 824.89 KiB 801.13 KiB
7865e6e 23.75 KiB 843.50 KiB 819.75 KiB
ff09fb1 23.75 KiB 844.04 KiB 820.29 KiB
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 86.031%. Comparing base (51de0c8) to head (9c616f0).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #5218       +/-   ##
=============================================
- Coverage   86.061%   86.031%   -0.031%     
=============================================
  Files          397       397               
  Lines        34588     34592        +4     
  Branches     14990     14988        -2     
=============================================
- Hits         29767     29760        -7     
- Misses        4777      4790       +13     
+ Partials        44        42        -2     

see 13 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 51de0c8...9c616f0. Read the comment docs.

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

@armcknight
Copy link
Member Author

We looked at the difference in the macosx slice's size and discovered that the upload artifact action zips up the files and in the process resolves symlinks, so was duplicating things. We are instead ditto-ing the files before uploading them.

@armcknight
Copy link
Member Author

Fixed the remaining symlink issues.

Manually tested Sentry-Dynamic, Sentry (static) and SentrySwiftUI in a test project for each platform, including mac catalyst.

@armcknight
Copy link
Member Author

Also I realized that now that release.yml would run most of its jobs in PRs, it would duplicate the build in build-xcframework.yml. Also, in releases, build-xcframework.yml would still run. So, I moved everything into release.yml in 45e2a9e

@armcknight
Copy link
Member Author

i've locally validated with the integration tests in #5384 that each kind of app and package manager can correctly link each type of SDK variant.

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
4 participants