2016-02-19 08:00:59 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
2017-04-09 08:42:16 +00:00
|
|
|
# shellcheck source=/dev/null
|
2016-02-19 08:00:59 +00:00
|
|
|
source "${CI_DIR}/common.sh"
|
|
|
|
|
2017-04-11 09:23:42 +00:00
|
|
|
# print some useful info
|
|
|
|
echo "TRAVIS_BUILD_DIR: ${TRAVIS_BUILD_DIR}"
|
|
|
|
echo "pwd: $(pwd)"
|
|
|
|
ls
|
|
|
|
|
|
|
|
# toss submodules if there are any changes
|
|
|
|
if [ "$(git status --ignore-submodules=dirty --porcelain)" ]; then
|
|
|
|
# what changed?
|
|
|
|
git status
|
|
|
|
# purge and reinit submodules
|
|
|
|
git submodule deinit -f .
|
|
|
|
git submodule update --init
|
|
|
|
else
|
|
|
|
echo -e "${ANSI_GREEN}Using cached submodules."
|
|
|
|
fi
|
|
|
|
|
2016-02-19 08:00:59 +00:00
|
|
|
# install our own updated luarocks
|
2017-04-09 08:42:16 +00:00
|
|
|
if [ ! -f "${TRAVIS_BUILD_DIR}/install/bin/luarocks" ]; then
|
|
|
|
git clone https://github.com/torch/luajit-rocks.git
|
2017-04-11 09:28:01 +00:00
|
|
|
pushd luajit-rocks && {
|
2017-04-09 08:42:16 +00:00
|
|
|
git checkout 6529891
|
|
|
|
cmake . -DWITH_LUAJIT21=ON -DCMAKE_INSTALL_PREFIX="${TRAVIS_BUILD_DIR}/install"
|
|
|
|
make install
|
2017-04-11 09:28:01 +00:00
|
|
|
} || exit
|
2017-04-09 08:42:16 +00:00
|
|
|
popd
|
2017-04-11 09:23:42 +00:00
|
|
|
else
|
|
|
|
echo -e "${ANSI_GREEN}Using cached luarocks."
|
2017-04-09 08:42:16 +00:00
|
|
|
fi
|
2016-02-19 08:00:59 +00:00
|
|
|
|
2017-04-11 09:28:01 +00:00
|
|
|
if [ ! -d "${HOME}/.luarocks" ] || [ ! -f "${HOME}/.luarocks/$(md5sum <"${CI_DIR}/helper_luarocks.sh")" ]; then
|
2017-04-11 09:23:42 +00:00
|
|
|
echo -e "${ANSI_GREEN}Grabbing new .luarocks."
|
|
|
|
"${CI_DIR}/helper_luarocks.sh"
|
2017-04-11 09:28:01 +00:00
|
|
|
touch "${HOME}/.luarocks/$(md5sum <"${CI_DIR}/helper_luarocks.sh")"
|
2017-04-11 09:23:42 +00:00
|
|
|
else
|
|
|
|
echo -e "${ANSI_GREEN}Using cached .luarocks."
|
|
|
|
fi
|
2017-04-09 08:42:16 +00:00
|
|
|
|
|
|
|
#install our own updated shellcheck
|
|
|
|
SHELLCHECK_URL="https://s3.amazonaws.com/travis-blue-public/binaries/ubuntu/14.04/x86_64/shellcheck-0.4.5.tar.bz2"
|
2017-04-11 09:28:01 +00:00
|
|
|
if ! command -v shellcheck; then
|
|
|
|
curl -sSL "${SHELLCHECK_URL}" | tar --exclude 'SHA256SUMS' --strip-components=1 -C "${HOME}/bin" -xjf -
|
2017-04-09 08:42:16 +00:00
|
|
|
chmod +x "${HOME}/bin/shellcheck"
|
|
|
|
shellcheck --version
|
2017-04-11 09:23:42 +00:00
|
|
|
else
|
|
|
|
echo -e "${ANSI_GREEN}Using cached shellcheck."
|
2017-04-09 08:42:16 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# install shfmt
|
|
|
|
SHFMT_URL="https://github.com/mvdan/sh/releases/download/v1.2.0/shfmt_v1.2.0_linux_amd64"
|
2017-04-11 09:28:01 +00:00
|
|
|
if ! command -v shfmt; then
|
2017-04-09 08:42:16 +00:00
|
|
|
curl -sSL "${SHFMT_URL}" -o "${HOME}/bin/shfmt"
|
|
|
|
chmod +x "${HOME}/bin/shfmt"
|
2017-04-11 09:23:42 +00:00
|
|
|
else
|
|
|
|
echo -e "${ANSI_GREEN}Using cached shfmt."
|
2017-04-09 08:42:16 +00:00
|
|
|
fi
|