Update ImageMagick on Travis-CI

I have an open source software project called Imbo that I have hooked up to Travis-CI for testing of pull requests and pushes on GitHub. I recently came across an issue that made some tests fail on Travis-CI that passed on all other machines I run tests on. The issue seemed to be because of an old version of ImageMagick (6.6.9-7). Travis-CI use this version since they base their VM’s on Ubuntu-12.04-LTS, and that version of ImageMagick is the one currently available on 12.04.

I solved it by compiling my own version of ImageMagick via the .travis.yml file:

before_install:
  - wget http://www.imagemagick.org/download/ImageMagick.tar.gz
  - tar xf ImageMagick.tar.gz
  - cd ImageMagick*
  - ./configure --prefix=/usr
  - make
  - sudo make install
  - cd ..
  - printf "\n" | pecl install imagick-beta

This made the tests pass, but the build went from taking about 2 minutes to 10, so it was not really a good fix. After asking around on the #travis-ci channel on IRC (freenode) @henrikhodne said that they might upgrade the package if they found a decent PPA. I looked around myself and found a PPA for Ubuntu-12.04 that had a newer version of ImageMagick available, so I decided to try and use that instead of compiling my own to see if that might speed up the build. I replaced the above snippet with the following in the .travis.yml file:

before_install:
  - sudo add-apt-repository -y ppa:moti-p/cc
  - sudo apt-get update
  - sudo apt-get -y --reinstall install imagemagick
  - printf "\n" | pecl install imagick-beta

This reduced the build time to around 3 minutes, and all tests are passing! Travis-CI, I LOVE YOU!

About these ads
This entry was posted in PHP, Technology and tagged , , , , , , , , . Bookmark the permalink.

3 Responses to Update ImageMagick on Travis-CI

  1. beherca says:

    Imbo is a great project and thank you very much.
    May I ask that is it possible to use imbo as a file storage server mainly serves files like docs, excels etc only? I see its potential to do that and would like to know if there is a easy way to do that?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s