How to get Travis CI to build and test xcode projects hosted on Github?


I have some open source code hosted on github for adding a block based category to UITextField. I have added a .travis.yml file to get travis CI to build and run the code on every push. Link to The Travis CI warning . It successfully builds the project. The warning i get when running the .travis.yml script is:

WARNING: Using Objective-C testing without specifying a scheme and either
a workspace or a project is deprecated.

The example project that i want to run is located in the folder /UITextView Blocks Example/ How can i add to the .travis.yml file to run this project? My travis.yml file now consists of

language: objective-c

Update 2017

skypecakes mentions in the comments:

For anyone using XCode 8 and higher: xctool is no longer supported, and does not work.
Use xcodebuild instead.

Original answer (2013)

You can check this tutorial, which explains:

xctool is an excellent choice for running your tests under a continuous integration server such as Travis CI or Jenkins.
In order to your run your tests within a continuous integration environment, you must create Shared Schemes for your application target and ensure that all dependencies (such as CocoaPods) are added explicitly to the Scheme.
To do so:

  1. Open up the Manage Schemes sheet by selecting the Product menu > Schemes > Manage Schemes...
  2. Locate your application target in the list. Ensure that the Shared checkbox in far right hand column of the sheet is checked.
  3. If your application or test targets include cross-project dependencies such as CocoaPods, then you will need to ensure that they have been configured as explicit dependencies. To do so:
    • Highlight your application target and hit the Edit... button to open the Scheme editing sheet.
    • Click the Build tab in the left-hand panel of the Scheme editor.
    • Click the + button and add each dependency to the project. CocoaPods will appears as static library named Pods.
    • Drag the dependency above your application target so that it is built first.

You will now have a new file in the xcshareddata/xcschemes directory underneath your Xcode project.
This is the shared Scheme that you just configured.
Check this file into your repository and xctool will be able to find and execute your tests on the next CI build.

For more flexibility, you can also control how Travis installs and invokes xctool:

language: objective-c
    - brew update
    - brew install xctool
script: xctool -workspace MyApp.xcworkspace -scheme MyApp test

That last configuration is similar to the approach illustrated in this other tutorial:

Once you have linked your repo the next step would be to add a .travis.yml file to the root of the repo.

  language: objective-c

  before_script: travis/
  script: travis/
  • First I’m telling Travis that this is an objective-c project.
  • Next I tell Travis how I’d like it to do CI against this repo by giving it instructions on what scripts it should run in order to actually perform a build.

I also give some extra instructions on what to do just prior to running a build.
It’s quite common to put all the build steps inline right in the .travis.yml file, but I prefer to actually create bash scripts in my repo inside a travis directory in my git repo and then just refer to those scripts from my .travis.yml.
This keeps the .yml file nice and small, and also makes it easy for me to test the travis build scripts locally.

We gave Travis a before_script in the .yml file above. This is intended to be used by the Travis agent to download tools needed as part of the build. Here’s what it looks like:


set -e

brew update
brew install xctool

Very simple. We just use homebrew to install xctool on the build agent.
All travis build agents come with homebrew pre-installed, but sometimes the formula aren’t up to date, so it’s best to run a brew update before attempting a brew install.
That’s all we need to do to prepare our agent for the build.

Next let’s look at the build script itself:


set -e

xctool -workspace MyWorkspace -scheme MyScheme build test

Again, this is really simple.
We first do a basic sanity check by asking xctool to build our app, specifying a workspace and scheme.
This just checks that we don’t have any compilation errors.
Assuming that succeeds xctool will then build and run the unit testing target for our app, launching the Simulator on the Travis agent if needed.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at


Login to comment


How can I build Visual Studio 2019 projects on Travis CI?

How to get the current split index of test in Travis-CI?

Getting the Travis CI build status of a GitHub commit

How to setup Travis CI for a Django project hosted on Heroku?

How to build MacOSX executables on Travis CI?

How to build on travis-ci with gradle and cobertura

How to test Jupyter notebooks on Travis CI?

How to test github CI locally?

Show Travis-CI build status on Github Pull Request Page

exclude files from triggering a travis ci build on github

Travis-CI Auto-Tag Build for GitHub Release

Test travis-ci script without commit on github

Spring Boot Application test build fails on Travis CI

Break Travis-CI build on dotnet test failure

How can I ignore test projects in the build?

Build webpack on travis ci

How to build and run unit test Visual Studio 2017 .NETCoreApp Version 1.1 on linux using travis-ci

Kotlin Build on travis-CI passes but no tests get run

Why would `go get` start to fail in Travis CI build?

Travis CI C++ Build succeed but travis exited with 1 and doesn't passes the test

How to build Flutter in GitHub Actions CI/CD

How to make sure Travis-CI is correctly synced with GitHub repo?

How to set github token on Travis CI in a secure way?

How to publish Travis CI artifacts to GitHub Release from several jobs

How to configure Travis CI to build Node.js without tests?

How can I run a script as part of a Travis CI build?

How do I build Python 3.8 on Travis CI?

How to setup webdriverio related tests to be build in travis-ci

How to deploy a successful build using Travis CI and Scalr

TOP Ranking