Using Travis-CI to test Homebrew tap

homebrew, travis-ci

Solution

fYou need to use `objective-c` as the language to get an OS X VM. This is admittedly not very obvious.

To build multiple packages, you can use an environment variable matrix. (Or you could write a shell script with a big loop over all packages.)

Here is a `.travis.yml` template you can use:

language: objective-c
before_install:
  - brew update
install:
  - mkdir -p $(brew --repo)/Library/Taps/travis
  - ln -s $PWD $(brew --repo)/Library/Taps/travis/homebrew-testtap
  - brew tap --repair
env:
  - PACKAGE=first_package
  - PACKAGE=second_package
  ...
script:
  - brew audit $PACKAGE
  - brew install -v $PACKAGE
  - brew test $PACKAGE

Problem

I've just discovered Travis-CI, and it seems very useful for testing whether Homebrew formulae build correctly on different systems, especially since Homebrew is already installed on their VMs. In short, I have a Homebrew tap and would like to use Travis-CI to test the formulae on different systems. The way I see this working would be to have a test script something like: ``` brew update brew tap <my/tap> brew install <package> brew test <package> ``` But some problems I could see arising are: - what would be the language in this case? I'm letting Homebrew deal with the build - Travis-CI only seems to allow a single test script per repository, so it would be difficult to separate the testing of each formula Can anyone help with some advice about these two points?

Original source