Travis CI fails to compile Pods - ios

I'm trying to set up Travis CI for my iOS project.
Here is my travis yml file
language: objective-c
env:
matrix:
- export LANG=en_US.UTF-8
script:
- xctool -workspace TravisExample.xcworkspace -scheme TravisExample -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO
- xctool test -workspace TravisExample.xcworkspace -scheme TravisExampleTests -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO
cache:
- bundler
- cocoapods
Travis failed with errors like this
Support Files/Bolts/Bolts-prefix.pch' file not found
Support Files/AFNetworking/AFNetworking-prefix.pch' file not found
I have AFNetworking and Bolts as dependencies in my project managed by cocoapods.
Any idea how to fix this problem?

Try using this lines before script:
before_install:
- rvm use system
- sudo gem install cocoapods -v '0.39.0'
It looks like some Travis Machines are using old Cocoapods versions. With this lines you force Travis to use the version you want.
Check which version are you using in your machine with this line in your Terminal:
pod --version
I wrote a blog post about Travis-CI, maybe it can help you.

Related

Github Actions for project with Swift Package Manager dependency

I'm trying to get Github Actions for project with Swift Package Manager dependency working.
I keep getting this error: xcodebuild: error: Could not resolve package dependencies:15 The server SSH fingerprint failed to verify.
... when Actions runs and Resolve Package Graph fetching the dependency in my project that uses Swift Package Manager.
My step it is failing on:
- name: Build and Test
run: |
xcodebuild clean test -project xyz.xcodeproj -scheme xyz -destination "platform=iOS Simulator,OS=13.3,name=iPhone 8" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO
I've tried adding for ip in $(dig #8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts per Xcode 11 resolving packages fails with SSH fingerprint but still can't get it to work, I might be putting it in the wrong place or doing it wrong.
Has anyone got this working that can help me?
I had the same problem and decided to use packages with https urls instead of ssh and it worked fine. If you don't need to access private repos then this is a viable solution.

How to determine the configuration during a AppVeyor/Travis CI build?

How to determine the configuration during a AppVeyor/Travis CI build?
I build my project for release and debug and on each build I would like to run my test.exe which will be in the Release folder for release build and Debug folder for debug build
Both of these attempts dont work.
It would be great to just be able to refer to the location where the build product is placed.
AppVeyor.yml
test_script:
- cd Build
- cd $env:CONFIGURATION
- UtilsTests.exe
Travis.yml
matrix:
include:
- os: osx
osx_image: xcode8.3
compiler: clang
script:
- brew update
- cmake . -G Xcode
- xcodebuild
- ./UtilsTests
Correct cd command should be:
- cd %CONFIGURATION%

xcodebuild: error: 'APP.xcworkspace' does not exist

I am trying to set up CI with gitlab. When I try to build locally, I get this error : xcodebuild: error: 'APP.xcworkspace' does not exist.
"APP" not being the real name. I am also using CocoaPods.
This happens after I run this command in terminal:
gitlab-ci-multi-runner exec shell build_project
I have checked and the file does exist in the same folder I call the command.
This is my .gitlab-ci.yml file:
stages:
- build
build_project:
stage: build
script:
- xcodebuild clean -workspace APP.xcworkspace -scheme APP | xcpretty
- xcodebuild test -workspace APP.xcworkspace -scheme APP -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.2' | xcpretty -s
tags:
- v0.0.1
Xcode version: 8.2.1
Cocoapods version: 1.2.0
Gitlab-runner version : 1.11.0
Alex
On React Native I've solved this issue by running command inside /ios folder.
I have solved this now!!
I just had to update the cocoapods repo, se this link:
https://github.com/CocoaPods/CocoaPods/issues/5077
Looks like your specs repo was edited at some point, and now git can't update it. I'd recommend deleting and re-creating your Specs repo: pod repo remove master and running pod setup
In my case i had project with same folder name("Project") ending with 1 , 2 ,3 ,4 (total 5 folders). when i was trying to install cocoapods in "Project 4" Directory it was getting installed in "Project" instead it should be for "Project 4".
I could find Xcworkspace in the folder "Project"
Hence i need to delete other folders with same name and then install pods in "Project" folder
To share a scheme in Xcode:
Choose Product > Scheme > Manage Schemes.
Share your scheme:
Click on the Close button.

Continuous integration of an iOS project in a workspace with Jenkins and Fabric

I have a workspace with multiple projects in it. In one of the project I am using Fabric to distribute my build to beta testers. It works perfectly as expected.
Then I moved to continuous integration with Jenkins. Build is successful. However, Fabric doesn't upload the dSYM file.
I have the following script in Execute Shell of Jenkins
Note: Fabric.framework/run command is added in Build phase of the project
=====================================================
ARCHIVE_DEST_PATH="${WORKSPACE}/archive"
ARCHIVE_PACKAGE="${ARCHIVE_DEST_PATH}.xcarchive"
PROJECT=<project>
FRAMEWORK=<project-sdk>SharedSDK
cd ${WORKSPACE}
if [ -f "$ARCHIVE_PACKAGE/Info.plist" ]; then
rm -r "$ARCHIVE_PACKAGE"
fi
xcodebuild -workspace <project-ws>.xcworkspace -scheme ${FRAMEWORK}
xcodebuild -workspace <project-ws>.xcworkspace -scheme ${PROJECT} -archivePath ${ARCHIVE_DEST_PATH} archive
Mike from Fabric here.
If you're using Jenkins, then you want to add a script such as this:
/path/to/Crashlytics.framework/submit <API_KEY> <BUILD_SECRET> \
-ipaPath /path/to/my.ipa -emails TestEmail#fabric.io,AmazingTester#twitter.com \
-notesPath ~/Notes/ReleaseNotes.txt \
-groupAliases GroupAlias,GroupAlias2 \
-notifications YES
as mentioned in our documentation.

xcodebuild linker failing when custom output directory provided

I have a problem using xcodebuild to build the iOS app to custom directory.
Everything works well if I am building using command:
xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyAppScheme -sdk iphoneos -configuration Release ONLY_ACTIVE_ARCH=NO
...but I would like the .app and .dSYM files to be saved in a specific directory (./build for example). So, I tried adding:
CONFIGURATION_BUILD_DIR=./build
or
OBJROOT=./build SYMROOT=./build
as a xcodebuild parameters. Then I've got this error (output comes from xctool as it's more readable, but the same error occurs when using xcodebuild):
✗ Link MyApp
(...)
ld: library not found for -lPods-MyApp-SomePodName
clang: error: linker command failed with exit code 1 (use -v to see invocation)
As I am using Cocoapods, my workspace contains app's project and "Pods" project. I tried using xcodebuild on several other projects that uses Cocoapods and I am always getting this error (SomePodName differs depending on project's dependencies) when trying to provide custom output directory. Please note, that it works without an issue when CONFIGURATION_BUILD_DIR, OBJROOT and SYMROOT parameters are skipped.
I wonder if anything changed recently, because I am pretty sure that I was able to build to custom directory using xcodebuild in the past. Currently, Travis-CI is still able to do it without an issue, but I have no luck when trying on my local machines.
Perhaps providing CONFIGURATION_BUILD_DIR, OBJROOT or SYMROOT is not the perfect way for specifying custom output directory. I am not sure if the problem is connected directly to Cocoapods, but the errors are always connected with some pod library.
Any hints will be appreciated.
My environment:
OS X 10.10.3
Xcode 6.3
xctool 0.2.3
cocoapods 0.36.3
Update: Problem solved
It looks like xcodebuild requires absolute path for CONFIGURATION_BUILD_DIR, OBJROOT and SYMROOT parameters.
Providing absolute path solved the problem:
CONFIGURATION_BUILD_DIR=/Users/me/Dev/MyApp/build

Resources