使用 `pod gen` 和 `xcodebuild build test` 为 Catalyst 设置 CI

Setting up CI for Catalyst with `pod gen` and `xcodebuild build test`

我想将 Catalyst 测试添加到我们的 CI 以测试 podspec 描述的库,但 运行 涉及签名问题:

git clone git@github.com:firebase/firebase-ios-sdk.git
pod gen FirebaseCore.podspec --local-sources=./ --platforms=ios
xcodebuild build test -configuration release -workspace /Users/paulbeusterien/gh8/firebase-ios-sdk/gen/FirebaseCore/FirebaseCore.xcworkspace  -scheme FirebaseCore-Unit-unit ARCHS=x86_64h VALID_ARCHS=x86_64h ONLY_ACTIVE_ARCH=NO  SUPPORTS_MACCATALYST=YES  -sdk macosx CODE_SIGN_IDENTITY=-

编译链接后,失败

Testing failed:
    FirebaseCore-Unit-unit:
        AppHost-FirebaseCore-Unit-Tests.app (88189) encountered an error (Failed to load the test bundle. (Underlying error: The bundle “FirebaseCore-Unit-unit” couldn’t be loaded because it is damaged or missing necessary resources. The bundle is damaged or missing necessary resources. dlopen_preflight(/Users/paulbeusterien/Library/Developer/Xcode/DerivedData/FirebaseCore-eyanoskvkatavqdrdwdwryhqqdsc/Build/Products/Release-maccatalyst/AppHost-FirebaseCore-Unit-Tests.app/Contents/PlugIns/FirebaseCore-Unit-unit.xctest/Contents/MacOS/FirebaseCore-Unit-unit): no suitable image found.  Did find:
    /Users/paulbeusterien/Library/Developer/Xcode/DerivedData/FirebaseCore-eyanoskvkatavqdrdwdwryhqqdsc/Build/Products/Release-maccatalyst/AppHost-FirebaseCore-Unit-Tests.app/Contents/PlugIns/FirebaseCore-Unit-unit.xctest/Contents/MacOS/FirebaseCore-Unit-unit: code signature in (/Users/paulbeusterien/Library/Developer/Xcode/DerivedData/FirebaseCore-eyanoskvkatavqdrdwdwryhqqdsc/Build/Products/Release-maccatalyst/AppHost-FirebaseCore-Unit-Tests.app/Contents/PlugIns/FirebaseCore-Unit-unit.xctest/Contents/MacOS/FirebaseCore-Unit-unit) not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)))

有什么建议吗?

我需要添加 CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO

以下命令构建并运行测试成功:

xcodebuild test -configuration Debug -workspace /Users/paulbeusterien/gh8/firebase-ios-sdk/gen/FirebaseCore/FirebaseCore.xcworkspace -scheme FirebaseCore-Unit-unit ARCHS=x86_64h VALID_ARCHS=x86_64h ONLY_ACTIVE_ARCH=NO SUPPORTS_MACCATALYST=YES -sdk macosx CODE_SIGN_IDENTITY=- SUPPORTS_UIKITFORMAC=YES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO

此解决方案在本地对我有效,但仅部分适用于 GitHub 操作。使用 GitHub 操作,包含 requires_app_host 的测试规范仍然未能通过 运行 测试。详情在此PR.