-
Create a before_install in your travis configuration that installs cocoapods, updates brew and installs the latest version of xctool. This will help to make sure you do not run into snags with an updated version of xcode that can break old versions of xctool.
-
Since your open source project probably won't have an iOS or OS X app target you have to do a little extra work with xctool and your xcode configuration so it properly runs your Tests target. Create an xcode project and remove the app target leaving just the test target. If you want to move the files out of default project you need to make sure you update your "Info.plist File" and "Prefix Header" to reflect the new locations. I usually move them to a Tests directory. Once those are updated you may to close xcode to update your project.pbxproj file.
-
We now need to update our Scheme to be shared so it will create a file that xctool can use to build the project. To do this go to Product-->Scheme-->Manage Schemes. Then select the Shared checkbox on your scheme (Most likely the name of your project).
-
Copy the files below into your repo and your done! You should now be able to build your project tests on travis-ci! Any questions feel free to contact me or comment on this gist. If you need an example check out https://github.com/daltoniam/UICustomizeKit
Last active
July 25, 2017 17:45
-
-
Save acmacalister/8426909 to your computer and use it in GitHub Desktop.
Travis configuration for building an open source Objective-C project.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Xcode | |
.DS_Store | |
build/ | |
*.pbxuser | |
!default.pbxuser | |
*.mode1v3 | |
!default.mode1v3 | |
*.mode2v3 | |
!default.mode2v3 | |
*.perspectivev3 | |
!default.perspectivev3 | |
*.xcworkspace | |
!default.xcworkspace | |
xcuserdata | |
profile | |
*.moved-aside | |
DerivedData | |
.idea/ | |
#CocoaPods | |
Pods | |
Podfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: objective-c | |
before_install: | |
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet | |
- brew update | |
- brew uninstall xctool && brew install xctool --HEAD | |
script: xctool -workspace <PROJECT_NAME>.xcworkspace -scheme <SCHEME_NAME> -sdk iphonesimulator -configuration Release test -test-sdk iphonesimulator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :test do | |
desc "It's time to test..." | |
task :test do | |
end | |
task :default => 'test' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment