iOS Build fails randomly on code signing issues

ios
code-signing
xcodebuild

#1

Hi there,
I’m having a lot of build failing on code signing issues, but it happens quite randomly so I’m not sure exactly why it happens. Here’s the build log:

▸ Running script '[CP] Embed Pods Frameworks’
▸ Running script '[CP] Copy Pods Resources’
▸ Touching MyProjectTests.xctest
▸ Signing /Users/distiller/Library/Developer/Xcode/DerivedData/MyProject-btcyaebulkbstyctxegozcfdzwbl/Build/Intermediates/CodeCoverage/Products/Debug-iphonesimulator/MyProject.app/PlugIns/MyProjectTests.xctest
▸ Building MyProject/MyProjectModelTests [Debug]
▸ Check Dependencies
▸ Processing Info.plist
▸ Running script '[CP] Check Pods Manifest.lock’
▸ Compiling MyProjectModelTests.swift
▸ Compiling NetworkSpec.swift
▸ Compiling MyProjectModelTests_vers.c
▸ Linking MyProjectModelTests
▸ Running script '[CP] Embed Pods Frameworks’
▸ Running script '[CP] Copy Pods Resources’
▸ Touching MyProjectModelTests.xctest
▸ Signing /Users/distiller/Library/Developer/Xcode/DerivedData/MyProject-btcyaebulkbstyctxegozcfdzwbl/Build/Intermediates/CodeCoverage/Products/Debug-iphonesimulator/MyProject.app/PlugIns/MyProjectModelTests.xctest
** TEST FAILED **

export LC_CTYPE="en_US.UTF-8"
set -o pipefail && xcodebuild -workspace ‘MyProject.xcworkspace’ -scheme ‘MyProject’ clean build test -sdk iphonesimulator -destination ‘platform=iOS Simulator,name=iPhone 6,OS=latest’ CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= PROVISIONING_PROFILE= | tee $CIRCLE_ARTIFACTS/xcode_raw.log | xcpretty --color --report junit --output $CIRCLE_TEST_REPORTS/xcode/results.xml
returned exit code 65

Any suggestions? Thanks


#2

I see this issue all the time and it’s really quite annoying. @yotamo did you ever find a cause?


#3

This is related to code signing the .xctest bundle (which is unnecessary btw.). I’m working on a comprehensive example app that will be open source which allows you to look at it.

You can route around these issues by basically splitting up the xcodebuild . clean build and test actions into two calls to xcodebuild.

Once you’ve done that you can pass CODE_SIGNING_ALLOWED=NO to the test call which disallows any kind of code signing taking place.

My current example is not building because of some reason but I hadn’t yet had the time to fully work out all the kinks and release it to you.

Example:

test:
  override:
    - set -o pipefail && xcodebuild ... clean build | xcpretty etc...
    - set -o pipefail && xcodebuild ... test CODE_SIGNING_ALLOWED=NO | xcpretty etc...

#4