getsentry / sentry-cocoa

The official Sentry SDK for iOS, tvOS, macOS, watchOS.
https://sentry.io/for/cocoa/
MIT License
807 stars 318 forks source link

Sentry Cocoa SDK (8.22+) makes GitHub Action stuck #4331

Closed WiesnerPeti closed 1 month ago

WiesnerPeti commented 1 month ago

Platform

iOS, macOS

Environment

Develop

Installed

Swift Package Manager

Version

8.35.0

Xcode Version

Xcode 16

Did it work on previous versions?

We used Xcode 15.4, there we used 8.21 (before the Package.swift update) and it worked. 8.35 can't be used with Xcode 15.4 anymore, so we only tried with Xcode 16 (GM and Beta 6 too). Update: 8.21 can't be used with Xcode 16 GM and we had to update to after 8.28)

Steps to Reproduce

  1. Add the Sentry Cocoa SDK 8.35.0 to an iOS/macCatalyst project.
  2. Create a Github action that builds the project with xcodebuild and before that it resolves Swift packages (also with xcodebuild).
  3. The package resolution will stuck.

Expected Result

The Swift package resolution is finishing, the job continues with building the application step.

Actual Result

The Swift package resolution is stuck, and the Github Action times out.

The Sentry private core is not anymore included (as of 8.22), but provided as a binaryTarget xcframework in the Package.swift. As I learned, Xcode can prompt for these types of dependencies even they are not private repository links. Github actions are non-interactive sessions, so we can't interact with this prompts.

We tried to insert a .netrc file to overcome this issues without result. Image

Any best practice, or advise from previous issues is much appreciated.

Thank you!

Are you willing to submit a PR?

Depending on the investigation, if it is only a Package.swift update, then yes :)

brustolin commented 1 month ago

Thanks for reaching out @WiesnerPeti Why can't you use Xcode 15.4 with Sentry 8.35?

We will investigate what is going on with Xcode 16 and CI

WiesnerPeti commented 1 month ago

We used Sentry 8.21, but we faced this issue when we wanted move over Xcode 16. The fix was available after 8.28 (so after the Package.swift change in 8.22), so we updated to latest and now we face this repo issue in the CI. We did not check if 8.35 can be used with Xcode 15.4 (I will remove that part from the description). In short, we wanted to upgrade to Xcode 16, and that brought a necessary version update in Sentry.

Sorry for the confusion, will fix the description.

brustolin commented 1 month ago

Thanks @WiesnerPeti for the clarification.

Would you mind sharing your xcodebuild command? I was unable to reproduce the problem in my own project.

WiesnerPeti commented 1 month ago

Yes sure.

  1. Create a project and add Sentry-Cocoa 8.35 to the Project file's Swift Dependency section
  2. Run this command on Github action CI xcodebuild -resolvePackageDependencies -scheme "APP_SCHEME" -workspace "PATH_TO_APP.xcworkspace" -derivedDataPath "~/Library/Developer/Xcode/DerivedData/GITHUB-CI"

I think it is important to run this in a clean environment, as already accepted, local machine keychain access can shadow the issue.

philipphofmann commented 1 month ago

This could be related to https://github.com/actions/runner-images/issues/1820#issuecomment-719549887

We fixed a similar problem when building our local sample app with Fastlane for uploading it to Testflight with https://github.com/getsentry/sentry-cocoa/blob/2be0dc5abbd750887d5993afe4a444d2b91eeff6/fastlane/Fastfile#L23-L35

but then we switched to using setup_ci in https://github.com/getsentry/sentry-cocoa/pull/1891

Maybe that will help fix your issue, @WiesnerPeti.

WiesnerPeti commented 1 month ago

Thank you, makes sense, we will try!

WiesnerPeti commented 1 month ago

Thank you @philipphofmann and @brustolin, this 5 lines solved the issue! #magic

philipphofmann commented 1 month ago

@WiesnerPeti, thanks for the update. I'm happy to hear your issue is solved. Which 5 lines solved the issue?