Skip to content

Commit

Permalink
chore(ci) re-enable dependencies caching
Browse files Browse the repository at this point in the history
Env variables used in caches directories need to be defined in the
global attribute to be taken into consideration.

With Kong we can cache:
- LUA_DIR, since we always use the same version (LuaJIT 2.1-beta)
- SERF_DIR
- OPENRESTY_DIR, assuming we suffix with its version number for
  occasions when we bump its version
- DNSMASQ_DIR
  • Loading branch information
thibaultcha committed Feb 4, 2016
1 parent df123de commit ba66a2c
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 99 deletions.
15 changes: 0 additions & 15 deletions .ci/platform.sh

This file was deleted.

4 changes: 0 additions & 4 deletions .ci/setenv_kong.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
export LUA_DIR=$HOME/lua
export LUAROCKS_DIR=$HOME/luarocks
export OPENRESTY_DIR=$HOME/openresty-$OPENRESTY
export DNSMASQ_DIR=$HOME/dnsmasq
export SERF_DIR=$HOME/serf

export PATH=$LUA_DIR/bin:$LUAROCKS_DIR/bin:$OPENRESTY_DIR/nginx/sbin:$SERF_DIR:$DNSMASQ_DIR/usr/local/sbin:$PATH

Expand Down
108 changes: 30 additions & 78 deletions .ci/setup_lua.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,101 +2,53 @@

set -e

mkdir -p $LUA_DIR
if [ "$(ls -A $LUA_DIR)" ]; then
echo "Lua found from cache at $LUA_DIR"
exit
fi

LUAJIT="no"
LUAJIT_BASE="LuaJIT"

source .ci/platform.sh

############
# Lua/LuaJIT
############

if [ "$LUA" == "luajit" ]; then
LUAJIT="yes"
LUA="luajit-2.0"
elif [ "$LUA" == "luajit-2.0" ]; then
LUAJIT="yes"
elif [ "$LUA" == "luajit-2.1" ]; then
LUAJIT="yes"
fi
########
# LuaJIT
########

if [ "$LUAJIT" == "yes" ]; then
mkdir -p $LUA_DIR
if [ ! "$(ls -A $LUA_DIR)" ]; then
LUAJIT_BASE="LuaJIT"
git clone https://github.com/luajit/luajit $LUAJIT_BASE
pushd $LUAJIT_BASE

if [ "$LUA" == "luajit-2.0" ]; then
git checkout v2.0.4
elif [ "$LUA" == "luajit-2.1" ]; then
pushd $LUAJIT_BASE
if [ "$LUAJIT" == "2.1" ]; then
git checkout v2.1
perl -i -pe 's/INSTALL_TNAME=.+/INSTALL_TNAME= luajit/' Makefile
else
git checkout v2.0.4
fi

make
make install PREFIX=$LUA_DIR
popd

ln -sf $LUA_DIR/bin/luajit $LUA_DIR/bin/lua
else
if [ "$LUA" == "lua5.1" ]; then
curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz
pushd lua-5.1.5
elif [ "$LUA" == "lua5.2" ]; then
curl http://www.lua.org/ftp/lua-5.2.4.tar.gz | tar xz
pushd lua-5.2.4
elif [ "$LUA" == "lua5.3" ]; then
curl http://www.lua.org/ftp/lua-5.3.2.tar.gz | tar xz
pushd lua-5.3.2
fi

make $PLATFORM
make install INSTALL_TOP=$LUA_DIR
popd
rm -rf $LUAJIT_BASE
else
echo "Lua found from cache at $LUA_DIR"
fi

##########
# Luarocks
##########

LUAROCKS_BASE=luarocks-$LUAROCKS

git clone https://github.com/keplerproject/luarocks.git $LUAROCKS_BASE
pushd $LUAROCKS_BASE

git checkout v$LUAROCKS

if [ "$LUAJIT" == "yes" ]; then
CONFIGURE_FLAGS="--with-lua-include=$LUA_DIR/include/$LUA"
elif [ "$LUA" == "lua5.1" ]; then
CONFIGURE_FLAGS="--lua-version=5.1 --with-lua-include=$LUA_DIR/include"
elif [ "$LUA" == "lua5.2" ]; then
CONFIGURE_FLAGS="--lua-version=5.2 --with-lua-include=$LUA_DIR/include"
elif [ "$LUA" == "lua5.3" ]; then
CONFIGURE_FLAGS="--lua-version=5.3 --with-lua-include=$LUA_DIR/include"
fi

./configure \
--prefix=$LUAROCKS_DIR \
--with-lua-bin=$LUA_DIR/bin \
$CONFIGURE_FLAGS

make build
make install
popd

rm -rf $LUAROCKS_BASE
mkdir -p $LUAROCKS_DIR
if [ ! "$(ls -A $LUAROCKS_DIR)" ]; then
LUAROCKS_BASE=luarocks-$LUAROCKS
git clone https://github.com/keplerproject/luarocks.git $LUAROCKS_BASE

pushd $LUAROCKS_BASE
git checkout v$LUAROCKS
./configure \
--prefix=$LUAROCKS_DIR \
--with-lua-bin=$LUA_DIR/bin \
--with-lua-include=$LUA_DIR/include/luajit-$LUAJIT
make build
make install
popd

if [ "$LUAJIT" == "yes" ]; then
rm -rf $LUAJIT_BASE;
elif [ "$LUA" == "lua5.1" ]; then
rm -rf lua-5.1.5;
elif [ "$LUA" == "lua5.2" ]; then
rm -rf lua-5.2.4;
elif [ "$LUA" == "lua5.3" ]; then
rm -rf lua-5.3.2;
rm -rf $LUAROCKS_BASE
else
echo "Luarocks found from cache at $LUAROCKS_DIR"
fi
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ addons:
- build-essential
env:
global:
- LUA=luajit-2.1
- LUAJIT=2.1
- LUAROCKS=2.3.0
- OPENRESTY=1.9.3.1
- CASSANDRA=2.2.4
- OPENSSL=1.0.2f
- SERF=0.7.0
- DNSMASQ=2.75
- CASSANDRA_HOSTS=127.0.0.1
- OPENRESTY_DIR=$HOME/openresty-$OPENRESTY
- SERF_DIR=$HOME/serf
- DNSMASQ_DIR=$HOME/dnsmasq
- LUA_DIR=$HOME/lua
- LUAROCKS_DIR=$HOME/luarocks
matrix:
- TEST_SUITE=unit
- TEST_SUITE=integration
Expand All @@ -40,8 +45,8 @@ cache:
pip: true
directories:
- $LUA_DIR
- $LUAROCKS_DIR
- $SERF_DIR
- $DNSMASQ_DIR
- $LUAROCKS_DIR
- $OPENRESTY_DIR
- $HOME/.ccm/repository

0 comments on commit ba66a2c

Please sign in to comment.