1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 03:00:06 +08:00
SpaceVim/.ci/script.sh

90 lines
2.6 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -ex
2019-01-28 22:12:37 +08:00
export TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST}
if [ "$LINT" = "vimlint" ]; then
2020-09-02 22:56:53 +08:00
if [[ -f build_log ]]; then
rm build_log
fi
2020-09-02 12:28:33 +08:00
for file in $(git ls-files | grep SpaceVim.*.vim);
2018-08-18 16:41:50 +08:00
do
2020-09-02 22:56:53 +08:00
/tmp/vimlint/bin/vimlint.sh -l /tmp/vimlint -p /tmp/vimlparser $file >> build_log 2>&1;
2018-08-18 16:41:50 +08:00
done
2020-09-02 22:56:53 +08:00
if [[ -s build_log ]]; then
exit 2
fi
elif [ "$LINT" = "vimlint-errors" ]; then
2018-08-18 16:41:50 +08:00
if [[ -f build_log ]]; then
rm build_log
fi
2020-09-02 12:28:33 +08:00
for file in $(git ls-files | grep SpaceVim.*.vim);
2018-08-18 16:41:50 +08:00
do
/tmp/vimlint/bin/vimlint.sh -E -l /tmp/vimlint -p /tmp/vimlparser $file >> build_log 2>&1;
done
if [[ -s build_log ]]; then
exit 2
fi
2019-07-18 22:36:59 +08:00
elif [ "$LINT" = "file-encoding" ]; then
2020-09-02 22:56:53 +08:00
if [[ -f build_log ]]; then
rm build_log
2019-07-18 22:36:59 +08:00
fi
2020-08-30 23:31:09 +08:00
for file in $(git diff --name-only HEAD master);
2019-07-18 22:36:59 +08:00
do
2020-08-30 23:31:09 +08:00
# get the encoding of a file, based on:
# https://superuser.com/a/351658/618193
# It should be -b instead of -bi
encoding=`file -b --mime-encoding $file`
if [ $encoding != "utf-8" ] && [ $encoding != "us-ascii" ];
then
2020-09-02 22:56:53 +08:00
echo $file " " $encoding >> build_log
2020-08-30 23:31:09 +08:00
fi
2019-07-18 22:36:59 +08:00
done
2020-09-02 22:56:53 +08:00
if [[ -s build_log ]]; then
2019-07-18 22:36:59 +08:00
exit 2
fi
elif [ "$LINT" = "vint" ]; then
2020-09-02 12:28:33 +08:00
if [[ -f build_log ]]; then
rm build_log
fi
for file in $(git ls-files | grep SpaceVim.*.vim);
do
vint --enable-neovim $file >> build_log 2>&1;
done
if [[ -s build_log ]]; then
exit 2
fi
elif [ "$LINT" = "vint-errors" ]; then
2020-09-02 12:28:33 +08:00
if [[ -f build_log ]]; then
rm build_log
fi
for file in $(git ls-files | grep SpaceVim.*.vim);
do
vint --enable-neovim --error $file >> build_log 2>&1;
done
if [[ -s build_log ]]; then
exit 2
fi
elif [ "$LINT" = "vader" ]; then
2019-10-09 22:57:03 +08:00
if [ "$VIM_BIN" = "nvim" ]; then
export PATH="${DEPS}/_neovim/${VIM_TAG}/bin:${PATH}"
export VIM="${DEPS}/_neovim/${VIM_TAG}/share/nvim/runtime"
else
export PATH="${DEPS}/_vim/${VIM_TAG}/bin:${PATH}"
export VIM="${DEPS}/_vim/${VIM_TAG}/share/vim"
fi
2018-08-18 16:41:50 +08:00
2019-10-09 22:57:03 +08:00
echo "\$PATH: \"${PATH}\""
2018-08-18 16:41:50 +08:00
echo "\$VIM: \"${VIM}\""
2019-10-09 22:57:03 +08:00
echo "================= ${VIM_BIN} version ======================"
$VIM_BIN --version
2021-02-16 20:03:53 +08:00
pip install covimerage
pip install codecov
python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);'
make test_coverage
covimerage -vv xml --omit 'build/*'
codecov -X search gcov pycov -f coverage.xml
2018-01-20 22:40:48 +08:00
elif [ "$LINT" = "jekyll" ]; then
2018-08-18 16:41:50 +08:00
.ci/build-production
fi
set +x