Terrible Blog

Because Terrible Labs loves you.

Setting Up a RubyMotion Project on Travis CI

| Comments

It’s pretty easy to set up Travis CI to run tests for RubyMotion projects, but there are few gotchas we encountered the first time we did it.

Here’s what the generic .travis.yml file we start out with looks like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# setting the language to objective-c tells Travis to use an OS X server
language: objective-c
install:
  # we use motion-config-vars (https://github.com/jamescallmebrent/motion-config-vars)
  # to manage our app's environment settings (API key, server addresses, etc) and it's a
  # good idea to have a bare bones copy of this for Travis, so you don't have any actual
  # sensitive keys in your git history
  - cp resources/app.travis.yml resources/app.yml
  - cd /usr/local
  # we wrote motion-juxtapose (https://github.com/terriblelabs/motion-juxtapose) for
  # screenshot-driven tests, but found that we needed a specific version of imagemagick
  # for it to work well on travis machines, so we'll use homebrew to install that version
  - git checkout 870d5e9 Library/Formula/imagemagick.rb
  - brew install imagemagick
  - cd -
  # RubyMotion is installed on Travis images, but the version is usally not the same as
  # what your app is doing. so, we'll update the RubyMotion install and need to ensure
  # the directories it's installing to are writeable by the travis user.
  - sudo chown -R travis ~/Library/RubyMotion
  - mkdir -p ~/Library/RubyMotion/build
  - sudo motion update --cache-version=2.30
  # install the app's dependencies
  - bundle install
  # if you're using cocoapods, we'll install them now. cocoapods generates *very* verbose
  # output, which can actually put your Travis build over the output limit and cause the
  # build to stop. we'll redirect standard out to a file to avoid that.
  - bundle exec rake pod:install > pod_log.txt
script:
  # finally, run our tests!
  - bundle exec rake spec

Comments