Skip to content

Commit

Permalink
Travis CI integration
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed Aug 12, 2018
1 parent b0648df commit 2d6f974
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 1 deletion.
31 changes: 31 additions & 0 deletions .ci/install-luarocks.sh
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

version=${LUAROCKS_VERSION}
luarocks_tarball=https://luarocks.github.io/luarocks/releases/luarocks-${version}.tar.gz

set -e

# Do we already have the correct LuaRocks built?
if [ -d "$HOME/luarocks/bin" ]; then
installed_version=$($HOME/luarocks/bin/luarocks --version | head -1 | awk '{print $2}')
echo "Need LuaRocks $version"
echo "Found LuaRocks $installed_version"

if [ "$installed_version" == "$version" ]; then
echo "Using cached LuaRocks directory"
exit 0
fi
fi

echo "Installing LuaRocks $version"

rm -rf $HOME/luarocks
mkdir $HOME/luarocks

curl -L ${luarocks_tarball} | tar xz
cd luarocks-${version}
./configure --prefix="$HOME/luarocks" $*
make build -j${JOBS} && make install

cd ../
rm -rf luarocks-${version}
33 changes: 33 additions & 0 deletions .ci/install-vips.sh
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

version=${VIPS_VERSION}
pre_version=${VIPS_PRE_VERSION}
tar_version=${VIPS_TAR_VERSION}
vips_tarball=https://github.com/jcupitt/libvips/releases/download/v${version}${pre_version:+-$pre_version}/vips-${tar_version}.tar.gz

set -e

# Do we already have the correct vips built?
if [ -d "$HOME/vips/bin" ]; then
installed_version=$($HOME/vips/bin/vips --version | awk -F- '{print $2}')
echo "Need vips $version"
echo "Found vips $installed_version"

if [[ "$installed_version" == "$version" ]]; then
echo "Using cached vips directory"
exit 0
fi
fi

echo "Installing vips $version"

rm -rf $HOME/vips
mkdir $HOME/vips

curl -L ${vips_tarball} | tar xz
cd vips-${version}
CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 ./configure --prefix="$HOME/vips" $*
make -j${JOBS} && make install

cd ../
rm -rf vips-${version}
64 changes: 64 additions & 0 deletions .travis.yml
@@ -0,0 +1,64 @@
sudo: false

language: generic

dist: trusty

env:
global:
- LUAROCKS_VERSION=3.0.0
- VIPS_VERSION=8.7.0
- VIPS_PRE_VERSION=rc1
- VIPS_TAR_VERSION=$VIPS_VERSION
- VIPS_WARNING=0
- JOBS=2
- LD_LIBRARY_PATH=$HOME/vips/lib:$LD_LIBRARY_PATH
- PKG_CONFIG_PATH=$HOME/vips/lib/pkgconfig:$PKG_CONFIG_PATH
- PATH=$HOME/vips/bin:$HOME/luarocks/bin:/usr/local/openresty/luajit/bin:$PATH

cache:
directories:
- $HOME/vips
- $HOME/luarocks

addons:
apt:
sources:
# Use the official APT repositories from OpenResty (which includes LuaJIT 2.1.0-beta3),
# because LuaJIT on trusty is quite old.
- sourceline: 'deb http://openresty.org/package/ubuntu trusty main'
key_url: 'https://openresty.org/package/pubkey.gpg'
packages:
- openresty
- libexpat1-dev
- gettext
- libglib2.0-dev
- liborc-0.4-dev
- libfftw3-dev
- liblcms2-dev
- libmagickwand-dev
- libopenexr-dev
- libcfitsio3-dev
- libgif-dev
- libgsf-1-dev
- libmatio-dev
- libopenslide-dev
- libpango1.0-dev
- libpoppler-glib-dev
- librsvg2-dev
- libwebp-dev

before_install:
- bash .ci/install-vips.sh
- bash .ci/install-luarocks.sh
--with-lua=/usr/local/openresty/luajit/
--lua-suffix=jit-2.1.0-beta3
--with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1
- eval `luarocks path`

install:
- make dev

script:
- make lint
- make test
21 changes: 21 additions & 0 deletions Makefile
@@ -0,0 +1,21 @@
DEV_ROCKS = "busted 2.0.rc12" "luacheck 0.22.1"
BUSTED_ARGS ?= -o gtest -v
TEST_CMD ?= busted $(BUSTED_ARGS)

.PHONY: dev lint test

dev:
@for rock in $(DEV_ROCKS) ; do \
if luarocks list --porcelain $$rock | grep -q "installed" ; then \
echo $$rock already installed, skipping ; \
else \
echo $$rock not found, installing via luarocks... ; \
luarocks install $$rock ; \
fi \
done;

lint:
@luacheck -q .

test:
@$(TEST_CMD) spec/
2 changes: 1 addition & 1 deletion example/soak.lua
Expand Up @@ -22,7 +22,7 @@ for i = 0, tonumber(arg[2]) do
-- local buf = im:write_to_buffer(".jpg")
-- im:write_to_file("x.jpg")
im:write_to_file("x.v")
im = nil
im = nil -- luacheck: ignore

collectgarbage()
end

0 comments on commit 2d6f974

Please sign in to comment.