From 9bcc58d39909aaccd0fb80e6e33dd4ca15d1f28d Mon Sep 17 00:00:00 2001 From: Justin Israel Date: Thu, 11 Jan 2018 09:33:08 +1300 Subject: [PATCH] add travis support for testing ImageMagick7 --- .travis.yml | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..bfe4416 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,50 @@ +language: go +sudo: required + +go: + - 1.9.x + +cache: + directories: + - "$HOME/opt" + +env: + global: + - GOARCH=amd64 + - IMAGEMAGICK_VERSION=7.0.7-21 + +before_install: + # Update PATH so that travis can find newer imagemagick + - export PATH=$HOME/opt/bin:$PATH + + # Build ImageMagick from source + - convert -version | grep $IMAGEMAGICK_VERSION || { + export CORES=$(nproc) && + echo "Using $CORES cores for compiling..." && + cd /tmp && + sudo apt-get install build-essential -y && + sudo apt-get build-dep imagemagick -y && + wget "https://www.imagemagick.org/download/releases/ImageMagick-${IMAGEMAGICK_VERSION}.tar.gz" && + tar -xvf "ImageMagick-${IMAGEMAGICK_VERSION}.tar.gz" && + cd "ImageMagick-${IMAGEMAGICK_VERSION}" && + ./configure --prefix=$HOME/opt --without-magick-plus-plus --without-perl --disable-openmp --with-gvc=no && + make -j$CORES && sudo make install && sudo ldconfig && + $HOME/opt/bin/convert -version | grep $IMAGEMAGICK_VERSION && + cd $TRAVIS_BUILD_DIR; } + + # Update library paths for programs + - export LD_FLAGS=-L$HOME/opt/lib + - export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:$HOME/opt/lib + - export CPATH=$CPATH:$HOME/opt/include + - export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:$HOME/opt/lib + - export PKG_CONFIG_PATH=$HOME/opt/lib/pkgconfig + + # Set the import path for the particular branch of imagick bindings + - export IMAGICK_IMPORT_PATH=$(grep gopkg.in/gographics/imagick.v imagick/imagick.go | cut -d\" -f2) + +install: + - pkg-config --cflags --libs MagickWand + - go get $IMAGICK_IMPORT_PATH + +script: + - go test -v $IMAGICK_IMPORT_PATH diff --git a/README.md b/README.md index 31f87ef..e94b4a4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Go Imagick -[![GoDoc](https://godoc.org/gopkg.in/gographics/imagick.v2/imagick?status.svg)](https://gopkg.in/gographics/imagick.v2/imagick) +[![GoDoc](https://godoc.org/gopkg.in/gographics/imagick.v2/imagick?status.svg)](https://gopkg.in/gographics/imagick.v2/imagick) [![Travis Build Status](https://api.travis-ci.org/gographics/imagick.svg)](https://travis-ci.org/gographics/imagick) Go Imagick is a Go bind to ImageMagick's MagickWand C API.