Fastlane scan compilation fails sporadically (when caching is enabled)

Bitrise Build Issue Report template

Description of the issue

When DerivedData folder caching is enabled (as per https://blog.bitrise.io/60-percent-faster-builds-force-xcode-use-caching), fastlane scan step might fail to compile the source code.

In this particular case (see log), I’ve changed an initializer of a struct in main project (EventInfo), and added a unit test for that struct (EventInfoTests). Due to existing cache EventInfo.swift wasn’t re-compiled, hence EventInfoTests.swift failed to compile.

Environment:

Xcode 9.1.x, on macOS 10.12 (Sierra)

Which build Step causes the issue and which version of the step?

fastlane@2.3.9

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : YES
  • Does the issue happen sporadically, or every time? : SPORADICALLY
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? :

Local reproduction

Does not reproduce locally (likely due to correct usage of ‘DerivedData’ folder).

Build log

[05:52:42]: ------------------
[05:52:42]: --- Step: scan ---
[05:52:42]: ------------------
[05:52:42]: $ xcodebuild -list -workspace ./lebara-wallet.xcworkspace
[05:52:48]: $ xcodebuild -showBuildSettings -workspace ./lebara-wallet.xcworkspace -scheme WalletAPIKit
[05:52:54]: Found simulator "iPhone 5s (11.1)"
[05:52:55]: $ xcodebuild -list -workspace ./lebara-wallet.xcworkspace
[05:52:58]: $ xcodebuild -showBuildSettings -workspace ./lebara-wallet.xcworkspace -scheme WalletAPIKit
[05:53:02]: Found simulator "iPhone 5s (11.1)"
+------------------------+-----------------------------------------------------------------------------------------------+
|                                                Summary for scan 2.66.2                                                 |
+------------------------+-----------------------------------------------------------------------------------------------+
| scheme                 | WalletAPIKit                                                                                  |
| workspace              | ./lebara-wallet.xcworkspace                                                                   |
| derived_data_path      | /Users/vagrant/Library/Developer/Xcode/DerivedData/lebara-wallet-batbhxpuwtihiogxgiuyztuhdifu |
| clean                  | false                                                                                         |
| skip_build             | false                                                                                         |
| output_directory       | ./fastlane/test_output                                                                        |
| output_types           | html,junit                                                                                    |
| buildlog_path          | /var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/fastlane_logs319506467/scan                  |
| include_simulator_logs | false                                                                                         |
| open_report            | false                                                                                         |
| skip_slack             | false                                                                                         |
| slack_only_on_failure  | false                                                                                         |
| use_clang_report_name  | false                                                                                         |
| fail_build             | true                                                                                          |
| xcode_path             | /Applications/Xcode.app                                                                       |
+------------------------+-----------------------------------------------------------------------------------------------+
[05:53:02]: $ set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace ./lebara-wallet.xcworkspace -scheme WalletAPIKit -destination 'platform=iOS Simulator,id=900C6123-B42F-4626-B720-E707C8471479' -derivedDataPath '/Users/vagrant/Library/Developer/Xcode/DerivedData/lebara-wallet-batbhxpuwtihiogxgiuyztuhdifu' build test | tee '/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/fastlane_logs319506467/scan/WalletAPIKit-WalletAPIKit.log' | xcpretty  --report html --output '/Users/vagrant/git/fastlane/test_output/report.html' --report junit --output '/Users/vagrant/git/fastlane/test_output/report.junit' --report junit --output '/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/junit_report20171129-2445-mpua1d'
[05:53:02]: ▸ Loading...
[05:53:07]: ▸ Building Pods/AdyenCSE [Debug]
[05:53:07]: ▸ Check Dependencies
[05:53:08]: ▸ Building Pods/LebaraUI [Debug]
[05:53:08]: ▸ Check Dependencies
[05:53:08]: ▸ Building Pods/LebaraCaishen [Debug]
[05:53:08]: ▸ Check Dependencies
[05:53:08]: ▸ Building Pods/PSOperations [Debug]
[05:53:08]: ▸ Check Dependencies
[05:53:08]: ▸ Building Pods/SwiftKeychainWrapper [Debug]
[05:53:08]: ▸ Check Dependencies
[05:53:08]: ▸ Building Pods/Pods-WalletAPIKit [Debug]
[05:53:08]: ▸ Check Dependencies
[05:53:08]: ▸ Building lebara-wallet/WalletAPIKit [Debug]
[05:53:08]: ▸ Check Dependencies
[05:53:08]: ▸ Running script '[CP] Check Pods Manifest.lock'
[05:53:12]: ▸ Running script '[CP] Copy Pods Resources'
[05:53:15]: ▸ Build Succeeded
[05:53:16]: ▸ 2017-11-29 05:53:16.408 xcodebuild[2520:13777]  IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
[05:53:16]: ▸ /var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/com.apple.dt.XCTest/IDETestRunSession-BCC1AB0E-8222-48F9-BC74-7D6647CBDF8D/WalletAPIKitTests-D3FA2EC0-AFEF-4DC0-9194-E2DB0211731E/Session-WalletAPIKitTests-2017-11-29_055316-faSjSy.log
[05:53:16]: ▸ 2017-11-29 05:53:16.410 xcodebuild[2520:13773] [MT] IDETestOperationsObserverDebug: (34A60721-8533-4E1C-A8BA-35385CBDE01D) Beginning test session WalletAPIKitTests-34A60721-8533-4E1C-A8BA-35385CBDE01D at 2017-11-29 05:53:16.409 with Xcode 9B55 on target <DVTiPhoneSimulator: 0x7f864c9e4230> {
[05:53:16]: ▸ SimDevice: iPhone 5s (900C6123-B42F-4626-B720-E707C8471479, iOS 11.1, Booted)
[05:53:16]: ▸ } (11.1 (15B87))
[05:53:19]: ▸ Building Pods/AdyenCSE [Debug]
[05:53:19]: ▸ Check Dependencies
[05:53:33]: ▸ Building Pods/LebaraUI [Debug]
[05:53:33]: ▸ Check Dependencies
[05:53:33]: ▸ Building Pods/LebaraCaishen [Debug]
[05:53:33]: ▸ Check Dependencies
[05:53:33]: ▸ Building Pods/PSOperations [Debug]
[05:53:33]: ▸ Check Dependencies
[05:53:33]: ▸ Building Pods/SwiftKeychainWrapper [Debug]
[05:53:33]: ▸ Check Dependencies
[05:53:33]: ▸ Building Pods/Nimble [Debug]
[05:53:33]: ▸ Check Dependencies
[05:53:33]: ▸ Building Pods/Pods-WalletAPIKit [Debug]
[05:53:33]: ▸ Check Dependencies
[05:53:33]: ▸ Building lebara-wallet/WalletAPIKit [Debug]
[05:53:33]: ▸ Check Dependencies
[05:53:33]: ▸ Running script '[CP] Copy Pods Resources'
[05:53:33]: ▸ Building Pods/Pods-WalletAPIKitTests [Debug]
[05:53:33]: ▸ Check Dependencies
[05:53:33]: ▸ Processing Info.plist
[05:53:33]: ▸ Compiling Pods-WalletAPIKitTests-dummy.m
[05:53:35]: ▸ Compiling Pods_WalletAPIKitTests_vers.c
[05:53:35]: ▸ Copying Pods-WalletAPIKitTests-umbrella.h
[05:53:35]: Running Tests: ▸ Touching Pods_WalletAPIKitTests.framework
[05:53:35]: ▸ Signing /Users/vagrant/Library/Developer/Xcode/DerivedData/lebara-wallet-batbhxpuwtihiogxgiuyztuhdifu/Build/Products/Debug-iphonesimulator/Pods_WalletAPIKitTests.framework
[05:53:35]: ▸ Building lebara-wallet/WalletAPIKitTests [Debug]
[05:53:35]: ▸ Check Dependencies
[05:53:35]: ▸ Processing Info.plist
[05:53:35]: ▸ Running script '[CP] Check Pods Manifest.lock'
[05:53:36]: ▸ Compiling EventInfoTests.swift
[05:53:43]: ▸ ❌  /Users/vagrant/git/WalletAPIKitTests/Sources/Model/Activity/EventInfoTests.swift:26:16: cannot invoke initializer for type 'EventInfo' with an argument list of type '(dict: [String : Any])'
[05:53:43]: ▸ let info = EventInfo(dict: dict)
[05:53:43]: ▸                ^
[05:53:43]: ▸ ❌  /Users/vagrant/git/WalletAPIKitTests/Sources/Model/Activity/EventInfoTests.swift:45:16: cannot invoke initializer for type 'EventInfo' with an argument list of type '(dict: [String : Any])'
[05:53:43]: ▸ let info = EventInfo(dict: dict)
[05:53:43]: ▸                ^
[05:53:43]: ▸ ❌  /Users/vagrant/git/WalletAPIKitTests/Sources/Model/Activity/EventInfoTests.swift:64:16: cannot invoke initializer for type 'EventInfo' with an argument list of type '(dict: [String : Any])'
[05:53:43]: ▸ let info = EventInfo(dict: dict)
[05:53:43]: ▸                ^
[05:53:44]: ▸ ❌  /Users/vagrant/git/WalletAPIKitTests/Sources/Model/Activity/EventInfoTests.swift:82:16: cannot invoke initializer for type 'EventInfo' with an argument list of type '(dict: [String : Any])'
[05:53:44]: ▸ let info = EventInfo(dict: dict)
[05:53:44]: ▸                ^
[05:53:44]: ▸ 2017-11-29 05:53:44.151 xcodebuild[2520:13773] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/com.apple.dt.XCTest/IDETestRunSession-BCC1AB0E-8222-48F9-BC74-7D6647CBDF8D/WalletAPIKitTests-D3FA2EC0-AFEF-4DC0-9194-E2DB0211731E/Session-WalletAPIKitTests-2017-11-29_055316-faSjSy.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/com.apple.dt.XCTest/IDETestRunSession-BCC1AB0E-8222-48F9-BC74-7D6647CBDF8D/WalletAPIKitTests-D3FA2EC0-AFEF-4DC0-9194-E2DB0211731E/Session-WalletAPIKitTests-2017-11-29_055316-faSjSy.log}
[05:53:44]: ▸ Testing failed:
[05:53:44]: ▸ Cannot invoke initializer for type 'EventInfo' with an argument list of type '(dict: [String : Any])'
[05:53:44]: ▸ Cannot invoke initializer for type 'EventInfo' with an argument list of type '(dict: [String : Any])'
[05:53:44]: ▸ Cannot invoke initializer for type 'EventInfo' with an argument list of type '(dict: [String : Any])'
[05:53:44]: ▸ Cannot invoke initializer for type 'EventInfo' with an argument list of type '(dict: [String : Any])'
[05:53:44]: ▸ Cannot invoke initializer for type 'EventInfo' with an argument list of type '(dict: [String : Any])'
[05:53:44]: ▸ Cannot invoke initializer for type 'EventInfo' with an argument list of type '(dict: [String : Any])'
[05:53:44]: ▸ Cannot invoke initializer for type 'EventInfo' with an argument list of type '(dict: [String : Any])'
[05:53:44]: ▸ Cannot invoke initializer for type 'EventInfo' with an argument list of type '(dict: [String : Any])'
[05:53:44]: ▸ ** TEST FAILED **
1 Like

Hi @mylebara-ios,

Thanks for filling out the #issues:build-issues report! We’ll check the logs and try to debug & fix it ASAP! :slight_smile:

Hey @mylebara-ios!

We’ve been working on the issue in the past, and we keep working on it actually. May I ask if the issue is still persists?

If yes, could you please send 2-3 more builds that failed with the same issue?

2 Likes

Hi Tamas,
I actually haven’t used caching ever since.
I’m going to enable it now and report back later on.

Thank you!

2 Likes

Let us know how it goes @mylebara-ios! :wink: