travis(optimize): use build-cache for lua folder deps. (#551)

This commit is contained in:
YuanSheng Wang 2019-09-22 06:48:05 +08:00 committed by GitHub
parent de3c95da21
commit 70ea8f612c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,15 @@ export_or_prefix() {
export OPENRESTY_PREFIX="/usr/local/openresty-debug"
}
create_lua_deps() {
sudo luarocks make --lua-dir=${OPENRESTY_PREFIX}/luajit rockspec/apisix-dev-1.0-0.rockspec --tree=deps --only-deps --local
sudo luarocks install --lua-dir=${OPENRESTY_PREFIX}/luajit lua-resty-libr3 --tree=deps --local
echo "Create lua deps cache"
sudo rm -rf build-cache/deps
sudo cp -r deps build-cache/
sudo cp rockspec/apisix-dev-1.0-0.rockspec build-cache/
}
before_install() {
sudo cpanm --notest Test::Nginx >build.log 2>&1 || (cat build.log && exit 1)
}
@ -36,8 +45,17 @@ do_install() {
export_or_prefix
sudo luarocks make --lua-dir=${OPENRESTY_PREFIX}/luajit rockspec/apisix-dev-1.0-0.rockspec --tree=deps --only-deps --local
sudo luarocks install --lua-dir=${OPENRESTY_PREFIX}/luajit lua-resty-libr3 --tree=deps --local
if [ ! -f "build-cache/apisix-dev-1.0-0.rockspec" ]; then
create_lua_deps
else
diff rockspec/apisix-dev-1.0-0.rockspec build-cache/apisix-dev-1.0-0.rockspec > /dev/null
if [ $0 == 0 ]; then
echo "Use lua deps cache"
sudo cp -r build-cache/deps ./
else
create_lua_deps
fi
fi
git clone https://github.com/iresty/test-nginx.git test-nginx