mirror of https://github.com/koreader/koreader
Travis: speed up by caching base and running luacheck earlier (#2741)
* Travis: speed up by caching base and running luacheck earlier * ignore bin and install for git status change detection * skip coverage except on official master branch. It adds 3 whole minutes and does nothing to prevent regressions * also cache ~/.luarocks. It evens out but would generally prevent remote timeout shenenigans * remove base cache dir before caching with verbose remove to see what's going on * more inclusive shell code quality analysis * fixed more shellcheck issues * better shellcheck/shfmt debugging infopull/2754/head
parent
5bc19fa084
commit
9d39f11f59
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=/dev/null
|
||||
source "${CI_DIR}/common.sh"
|
||||
|
||||
rm -rf "${HOME}/.luarocks"
|
||||
mkdir "${HOME}/.luarocks"
|
||||
cp "${TRAVIS_BUILD_DIR}/install/etc/luarocks/config.lua" "${HOME}/.luarocks/config.lua"
|
||||
echo "wrap_bin_scripts = false" >> "$HOME/.luarocks/config.lua"
|
||||
travis_retry luarocks --local install luafilesystem
|
||||
# for verbose_print module
|
||||
travis_retry luarocks --local install ansicolors
|
||||
travis_retry luarocks --local install busted 2.0.rc12-1
|
||||
#- mv -f $HOME/.luarocks/bin/busted_bootstrap $HOME/.luarocks/bin/busted
|
||||
travis_retry luarocks --local install luacov
|
||||
# luasec doesn't automatically detect 64-bit libs
|
||||
travis_retry luarocks --local install luasec OPENSSL_LIBDIR=/usr/lib/x86_64-linux-gnu
|
||||
travis_retry luarocks --local install luacov-coveralls --server=http://rocks.moonscript.org/dev
|
||||
travis_retry luarocks --local install luacheck
|
||||
travis_retry luarocks --local install lanes # for parallel luacheck
|
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=/dev/null
|
||||
source "${CI_DIR}/common.sh"
|
||||
|
||||
# shellcheck disable=2016
|
||||
mapfile -t shellscript_locations < <( { git grep -lE '^#!(/usr)?/bin/(env )?(bash|sh)' && git submodule --quiet foreach '[ "$path" = "base" ] || git grep -lE "^#!(/usr)?/bin/(env )?(bash|sh)" | sed "s|^|$path/|"' && git ls-files ./*.sh ; } | sort | uniq )
|
||||
|
||||
SHELLSCRIPT_ERROR=0
|
||||
|
||||
for shellscript in "${shellscript_locations[@]}"; do
|
||||
echo -e "${ANSI_GREEN}Running shellcheck on ${shellscript}"
|
||||
shellcheck "${shellscript}" || SHELLSCRIPT_ERROR=1
|
||||
echo -e "${ANSI_GREEN}Running shfmt on ${shellscript}"
|
||||
[ "$(cat "${shellscript}" )" != "$(shfmt -i 4 "${shellscript}")" ] && echo -e "${ANSI_RED}Warning: ${shellscript} does not abide by coding style"
|
||||
# @TODO add error handling with something like && shfmt -i 4 "${shellscript}" | diff "${shellscript}"
|
||||
done
|
||||
|
||||
exit "${SHELLSCRIPT_ERROR}"
|
Loading…
Reference in New Issue