Finally I successfully integrated Travis CI with Swifternalization. I spent some time finding ready-to-go  solution how to configure my Swift 1.2 project to work with Travis and I couldn’t find it.

I tried many combination and of course my git history looks terrible now…

1776cb2 - Tomasz Szulc <mail@szulctomasz.com> - Update .travis.yml file.
5b979bb - Tomasz Szulc <mail@szulctomasz.com> - Update .travis.yml file.
8f3b9b3 - Tomasz Szulc <mail@szulctomasz.com> - Update .travis.yml file.
7c76e79 - Tomasz Szulc <mail@szulctomasz.com> - Change deployment target to 8.0
c594adf - Tomasz Szulc <mail@szulctomasz.com> - Update .travis.yml file.
7684071 - Tomasz Szulc <mail@szulctomasz.com> - Make schemes shared
346d5a1 - Tomasz Szulc <mail@szulctomasz.com> - Update .travis.yml file.
39a2c20 - Tomasz Szulc <mail@szulctomasz.com> - Update .travis.yml file.
d805f72 - Tomasz Szulc <mail@szulctomasz.com> - Add .travis.yml file.

But, I will be very nice colleague and will share a recipe :)

First thing is to make the test scheme shared. Go to Xcode > Product > Scheme > Manage Schemes… and check “Shared” next to your test target. This is necessary to make this scheme accessible outside of the project.

image-1

Next go to Travis and select your github repository to be enabled for continuous integration. You can enable your repo here if you’re signed in.

The next thing is to add .travis.yml file to your repo and configure it. The configuration may look like following:

language: objective-c

branches:
 only:
 - master

xcode_project: Swifternalization.xcodeproj
xcode_scheme: SwifternalizationTests
osx_image: beta-xcode6.3
xcode_sdk: iphonesimulator8.3

script:
- xcodebuild clean build test -project Swifternalization.xcodeproj -scheme SwifternalizationTests

As you can see there is objective-c set as the language but this is fine since the environment is the same both for Objective-C and Swift projects.

The .travis.yml file should be placed in project’s base directory.

Commit it. Push. Go to Travis CI site and wait for build. Hope it will pass :)

Additional resources: