Started learning how to integrate continuous integration (CI) using Travis platform for a personal project "Building a simple framework for iOS Development on Xcode". And, after a successful run creating a .travis.yml file with a set of configurations somehow I got caught up with a bunch of errors that I'm not quite familiar with.
Here's a snapshot of the travis.yml file
language: swift
os: osx
osx_image: xcode10.2
script:
- set -o pipefail && xcodebuild -project SWToaster.xcodeproj -scheme SWToaster -configuration Debug -destination 'platform=iOS Simulator,OS=12.0,name=iPhone XR' ONLY_ACTIVE_ARCH=YES
- set -o pipefail && xcodebuild test-without-building -enableCodeCoverage YES -scheme SWToasterTests -destination 'platform=iOS Simulator,OS=12.0,name=iPhone XR' ONLY_ACTIVE_ARCH=YES
And here is a snapshot of error messages:
Anyone sort of help will be appreciated
Resolved the issue by making sure the following requirements are met
Listed supported iOS Simulator SDK on Travis
Checked supported Xcode version on Travis
Then updated a .travis.yml config file as follows.
language: swift
os: osx
osx_image: xcode10.2
env:
matrix:
- TEST_SDK=iphonesimulator12.2 OS=12.2 NAME='iPhone 7'
script:
- set -o pipefail && xcodebuild -version
- set -o pipefail && xcodebuild -showsdks
- set -o pipefail && xcodebuild -project SWToaster.xcodeproj -scheme SWToaster -configuration Debug -destination "platform=iOS Simulator,OS=12.0,name=iPhone XR" ONLY_ACTIVE_ARCH=YES
- set -o pipefail && xcodebuild test -enableCodeCoverage YES -project SWToaster.xcodeproj -scheme SWToaster -sdk $TEST_SDK -destination "platform=iOS Simulator,OS=$OS,name=$NAME" ONLY_ACTIVE_ARCH=YES
Related
I am trying to emulate our flutter app on Mac and I Get this error:
ProcessException: Process timed out:
Command:
/usr/bin/env xcrun xcodebuild -configuration Debug -quiet -workspace Runner.xcworkspace -scheme Runner BUILD_DIR=/Users/samcromer/Desktop/LightBridge-2/build/ios -sdk iphonesimulator -arch x86_64 FLUTTER_SUPPRESS_ANALYTICS=true COMPILER_INDEX_STORE_ENABLE=NO -showBuildSettings
Is there a way to fix this? I am a windows dev so this doesn't make a lot of sense to me.
I have a simple iOS app that I want to use in Travis CI. I use a matrix with TEST_SDK and TEST_DESTINATION. However, the destination doesn't seem to work properly.
This is my .travis.yml:
language: objective-c
osx_image: xcode9.2
cache: cocoapods
before_install:
- pod repo update
- pod update
env:
matrix:
- TEST_SDK=iphonesimulator11.1 TEST_DESTINATION="platform=iOS Simulator,name=iPhone 7 Plus,OS=11.1"
- TEST_SDK=iphonesimulator11.2 TEST_DESTINATION="platform=iOS Simulator,name=iPhone 7 Plus,OS=11.2"
script:
- xcodebuild test -workspace iOSApp.xcworkspace -scheme iOSApp -sdk $TEST_SDK -destination $TEST_DESTINATION | xcpretty
The problem is that when I run the script locally, I get this output: xcodebuild: error: Unknown build action '7'.
When I run xcodebuild test -workspace iOS.xcworkspace -scheme iOS -sdk $TEST_SDK -destination platform="iOS Simulator",name="iPhone 7 Plus",OS=11.2 | xcpretty it works fine.
Therefore, I replaced the .travis.yml with : - TEST_SDK=iphonesimulator11.2 TEST_DESTINATION=platform="iOS Simulator",name="iPhone 7 Plus",OS=11.2 for example. However, this errors again with xcodebuild: error: Unknown build action '7'.
How can I get this to work correctly?
I got it working with this:
export TEST_DESTINATION="platform=iOS Simulator,name=iPhone 7 Plus,OS=11.1"
and for the build use TEST_DESTINATION in double quotes like
xcodebuild test -workspace iOSApp.xcworkspace -scheme iOSApp -sdk $TEST_SDK -destination "$TEST_DESTINATION" | xcpretty
I am currently want to create a debug simulator build using xcodebuild command rather than xcode IDE.
however, I always see a "debug-iphoneos" folder is generated, which is for the real device. I expected the simulator output folder "Debug-iphonesimulator"
Can anyone take a look at my script and suggest why the script is not working for simulator?
xcodebuild -scheme "TestApp" -configuration "Debug" -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' -workspace TestApp.xcworkspace clean archive -archivePath build/TestApp PROVISIONING_PROFILE="$provisioningUUID" CODE_SIGN_IDENTITY="$codeSignIdentity"
now I can run successfully as below:
xcodebuild -arch i386 -sdk iphonesimulator9.3 -workspace "$app.xcworkspace" -scheme "$scheme" -configuration "Debug"
You should run the following instead:
xcodebuild -arch i386 -sdk iphonesimulator9.1 -workspace [name].xcworkspace -scheme [targetName or ProjectName] ONLY_ACTIVE_ARCH=NO VALID_ARCHS="i386 x86_64"
where iphonesimulator9.1 depends on which iPhone Simulator you installed.
i want to get my project's code coverage (which is managed by cocoapods), i run the following cmd :
xcodebuild -scheme KVODemo -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 6' -enableCodeCoverage YES -workspace KVODemo.xcworkspace test
but i can not find the Coverage.profdata file (for normal project which is not managed by cocoapods is under the $PROJECT_TEMP_ROOT/CodeCoverage/$PROJECT_NAME/Coverage.profdata)
i just want to know how to get the code coverage for cocoa pods project.
ok , after a detail look at the cmd xcodebuild , i noticed something.
here is some info in the "man xcodebuild":
xcodebuild -showBuildSettings
[-project name.xcodeproj |
[-workspace name.xcworkspace -scheme schemename]]
the $PROJECT_TEMP_ROOT i mentioned in my question is the result of
xcodebuild -showBuildSettings |grep PROJECT_TEMP_ROOT
and this should the same as the xcodebuild -showBuildSettings -project xxx.xcodeproj
because my project is managed by cocoa pods, so i should get the $PROJECT_TEMP_ROOT in this way :
xcodebuild -showBuildSettings -workspace xxx.xcworkspace -scheme xxx
and finally , find the Coverage.profdata in the $PROJECT_TEMP_ROOT/CodeCoverage/$PROJECT_NAME/Coverage.profdata
I'm having some trouble with my cocoapods running Travis CI. Everything seems to install correctly, but the xcodebuild script fails
$ set -o pipefail && xcodebuild test -workspace Example/UIKitPlus.xcworkspace -scheme UIKitPlus-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c
xcodebuild: error: Failed to build workspace UIKitPlus with scheme UIKitPlus-Example.
Reason: The run destination iPad 2 is not valid for Testing the scheme 'UIKitPlus-Example'.
The command "set -o pipefail && xcodebuild test -workspace Example/UIKitPlus.xcworkspace -scheme UIKitPlus-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c" exited with 70.
https://travis-ci.org/JamieREvans/UIKitPlus/builds/54649639
I'm not sure why this is failing, because I can run my tests on the iPad 2 simulator, using that scheme, without any issues.
Is this a Travis issue or is my Travis script wrong?
I've managed to get it build by adding a destination to the xcodebuild command line, e.g. -destination "platform=iOS Simulator,name=iPhone 6"