krzyzanowskim / OpenSSL

OpenSSL package for SwiftPM, CocoaPod, and Carthage, multiplatform
https://swift.best
Other
907 stars 334 forks source link

"No such module 'OpenSSL'" using SPM on CI #132

Closed pauphi closed 2 years ago

pauphi commented 2 years ago

Hi!

We have a Swift Package B, which has this repository as a dependency for its main target. We have added B in our main iOS app A as a dependency through Swift Package Manager. Building A locally works fine, but around 50% of the time our A build on Github Actions fails when compiling source files in B with the error "No such module 'OpenSSL'". Does anyone know what causes this and how to fix it?

krzyzanowskim commented 2 years ago

Do you happen to use Xcode? then may be just that.

pauphi commented 2 years ago

Wow, that was a fast reply, thanks! We do have a step in our pipeline which sets up Xcode 12.5. The next step runs fastlane scan to run unit tests, and this is where it fails 50% of the time with the aforementioned error.

krzyzanowskim commented 2 years ago

I found Xcode SPM deps resolution failable. Usually, it needs to restart Xcode twice before it will fetch and build Xcode schemes properly. Xcode 13 is not better at that (unfortunately). I don't have a solution to that. This is especially visible in CI setup where there's no DerivedData, nor cached resolution for subsequent builds.

pauphi commented 2 years ago

For anyone else having a similar problem:

Fixed this issue by setting build order to Manual Order in every scheme using the scheme editor in Xcode. Build times on CI server increased by ~30%, but I'd rather live with that for a while than having failing builds :)

If anyone knows if this can be supplied to xcodebuild CLI using an argument that'd be helpful

Screenshot 2021-11-22 at 14 07 54

.

pauphi commented 2 years ago

Just noticed that Xcode hangs on CI on the following step when archiving:

Copying /Users/runner/Library/Developer/Xcode/DerivedData/Redacted-dvcchodkzubywxbdxanaiasgktni/SourcePackages/checkouts/OpenSSL/Frameworks/OpenSSL.xcframework/ios-arm64_armv7/OpenSSL.framework

On MacOS 11.6.1, Xcode 13.1.0. Will try Xcode 12.5 later today.

Update: same happens on Xcode 12.5.

pauphi commented 2 years ago

Solved it. It was just that a keychain access prompt was «shown» on the CI server when the OpenSSL framework was to be signed, and therefore it hung. Adding the fastlane setup_ci action as a preliminary step fixed it.