mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 10:30:05 +08:00
Add test for api (#3135)
This commit is contained in:
parent
e934f6e21d
commit
5ae3c415a5
@ -6,7 +6,6 @@ set -ue -o pipefail
|
||||
# Prevent commands misbehaving due to locale differences
|
||||
export LC_ALL=C
|
||||
|
||||
docker pull spacevim/vims
|
||||
git fetch origin master:master
|
||||
|
||||
if [ "${LINT#vimlint}" != "$LINT" ]; then
|
||||
@ -15,22 +14,22 @@ if [ "${LINT#vimlint}" != "$LINT" ]; then
|
||||
elif [ "${LINT#vint}" != "$LINT" ]; then
|
||||
pip install vim-vint pathlib enum34 typing
|
||||
elif [ "${LINT#vader}" != "$LINT" ]; then
|
||||
git clone --depth=1 https://github.com/Shougo/dein.vim.git ~/.cache/vimfiles/repos/github.com/Shougo/dein.vim
|
||||
if [[ ! -d "${DEPS}/_neovim_${NVIM_TAG}" ]]; then
|
||||
mkdir -p "${DEPS}/_neovim_${NVIM_TAG}"
|
||||
wget -q -O - https://github.com/neovim/neovim/releases/download/${NVIM_TAG}/nvim-${TRAVIS_OS_NAME}64.tar.gz \
|
||||
| tar xzf - --strip-components=1 -C "${DEPS}/_neovim_${NVIM_TAG}"
|
||||
|
||||
if [[ ! -d "$HOME/.cache/vimfiles/repos/github.com/Shougo/dein.vim" ]]; then
|
||||
git clone --depth=1 https://github.com/Shougo/dein.vim.git ~/.cache/vimfiles/repos/github.com/Shougo/dein.vim
|
||||
fi
|
||||
.ci/install/linux.sh $VIM_BIN $VIM_TAG
|
||||
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
|
||||
export PATH="${DEPS}/_neovim_${NVIM_TAG}/bin:${PATH}"
|
||||
echo "\$PATH: \"${PATH}\""
|
||||
|
||||
export VIM="${DEPS}/_neovim_${NVIM_TAG}/share/nvim/runtime"
|
||||
echo "\$PATH: \"${PATH}\""
|
||||
echo "\$VIM: \"${VIM}\""
|
||||
echo "================= nvim version ======================"
|
||||
nvim --version
|
||||
echo "================= lua version ======================"
|
||||
lua -v
|
||||
$VIM_BIN --version
|
||||
elif [ "$LINT" = "jekyll" ]; then
|
||||
.ci/bootstrap
|
||||
fi
|
||||
|
101
.ci/install/linux.sh
Normal file → Executable file
101
.ci/install/linux.sh
Normal file → Executable file
@ -1,55 +1,54 @@
|
||||
install_vim() {
|
||||
local URL=https://github.com/vim/vim
|
||||
local tag=$1
|
||||
local ext=$([[ $tag == "HEAD" ]] && echo "" || echo "-b $tag")
|
||||
local tmp="$(mktemp -d)"
|
||||
local out="$HOME/cache/vim-$tag"
|
||||
local ncpu=$(awk '/^processor/{n+=1}END{print n}' /proc/cpuinfo)
|
||||
git clone --depth 1 --single-branch $ext $URL $tmp
|
||||
cd $tmp
|
||||
./configure --prefix=$out \
|
||||
--enable-fail-if-missing \
|
||||
--with-features=huge \
|
||||
--enable-pythoninterp \
|
||||
--enable-python3interp \
|
||||
--enable-luainterp
|
||||
make -j$ncpu
|
||||
make install
|
||||
ln -s $out $HOME/vim
|
||||
}
|
||||
local URL=https://github.com/vim/vim
|
||||
local tag=$1
|
||||
local ext=$([[ $tag == "HEAD" ]] && echo "" || echo "-b $tag")
|
||||
local tmp="$(mktemp -d)"
|
||||
local out="${DEPS}/_vim/$tag"
|
||||
local ncpu=$(awk '/^processor/{n+=1}END{print n}' /proc/cpuinfo)
|
||||
git clone --depth 1 --single-branch $ext $URL $tmp
|
||||
cd $tmp
|
||||
./configure --prefix=$out \
|
||||
--enable-fail-if-missing \
|
||||
--with-features=huge \
|
||||
--enable-pythoninterp \
|
||||
--enable-python3interp \
|
||||
--enable-luainterp
|
||||
make -j$ncpu
|
||||
make install
|
||||
}
|
||||
|
||||
install_nvim() {
|
||||
local URL=https://github.com/neovim/neovim
|
||||
local tag=$1
|
||||
local ext=$([[ $tag == "HEAD" ]] && echo "" || echo "-b $tag")
|
||||
local tmp="$(mktemp -d)"
|
||||
local out="$HOME/cache/nvim-$tag"
|
||||
local ncpu=$(awk '/^processor/{n+=1}END{print n}' /proc/cpuinfo)
|
||||
git clone --depth 1 --single-branch $ext $URL $tmp
|
||||
cd $tmp
|
||||
make deps
|
||||
make -j$ncpu \
|
||||
CMAKE_BUILD_TYPE=Release \
|
||||
CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DCMAKE_INSTALL_PREFIX:PATH=$out"
|
||||
make install
|
||||
python -m pip install --user neovim
|
||||
python3 -m pip install --user neovim
|
||||
ln -sf $out $HOME/vim
|
||||
}
|
||||
install_nvim() {
|
||||
local URL=https://github.com/neovim/neovim
|
||||
local tag=$1
|
||||
local ext=$([[ $tag == "HEAD" ]] && echo "" || echo "-b $tag")
|
||||
local tmp="$(mktemp -d)"
|
||||
local out="${DEPS}/_neovim/$tag"
|
||||
local ncpu=$(awk '/^processor/{n+=1}END{print n}' /proc/cpuinfo)
|
||||
git clone --depth 1 --single-branch $ext $URL $tmp
|
||||
cd $tmp
|
||||
make deps
|
||||
make -j$ncpu \
|
||||
CMAKE_BUILD_TYPE=Release \
|
||||
CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DCMAKE_INSTALL_PREFIX:PATH=$out"
|
||||
make install
|
||||
python -m pip install pynvim
|
||||
python3 -m pip install pynvim
|
||||
}
|
||||
|
||||
install() {
|
||||
local vim=$1
|
||||
local tag=$2
|
||||
install() {
|
||||
local vim=$1
|
||||
local tag=$2
|
||||
|
||||
[[ -d $HOME/vim ]] && rm -f $HOME/vim
|
||||
if [[ $tag != "HEAD" ]] && [[ -d "$HOME/cache/$vim-$tag" ]]; then
|
||||
echo "Use a cached version '$HOME/cache/$vim-$tag'."
|
||||
ln -sf $HOME/cache/$vim-$tag $HOME/vim
|
||||
return
|
||||
fi
|
||||
if [[ $vim == "nvim" ]]; then
|
||||
install_nvim $tag
|
||||
else
|
||||
install_vim $tag
|
||||
fi
|
||||
}
|
||||
if [[ -d "${DEPS}/_$vim/$tag" ]]; then
|
||||
echo "Use a cached version '$HOME/_$vim/$tag'."
|
||||
return
|
||||
fi
|
||||
if [[ $vim == "nvim" ]]; then
|
||||
install_nvim $tag
|
||||
else
|
||||
install_vim $tag
|
||||
fi
|
||||
tree "${DEPS}/_$vim/$tag"
|
||||
}
|
||||
|
||||
install $@
|
||||
|
@ -53,12 +53,18 @@ elif [ "$LINT" = "vint" ]; then
|
||||
elif [ "$LINT" = "vint-errors" ]; then
|
||||
vint --error .
|
||||
elif [ "$LINT" = "vader" ]; then
|
||||
export PATH="${DEPS}/_neovim_${NVIM_TAG}/bin:${PATH}"
|
||||
echo "\$PATH: \"${PATH}\""
|
||||
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
|
||||
|
||||
export VIM="${DEPS}/_neovim_${NVIM_TAG}/share/nvim/runtime"
|
||||
echo "\$PATH: \"${PATH}\""
|
||||
echo "\$VIM: \"${VIM}\""
|
||||
nvim --version
|
||||
echo "================= ${VIM_BIN} version ======================"
|
||||
$VIM_BIN --version
|
||||
pip install covimerage
|
||||
make test_coverage
|
||||
covimerage -vv xml --omit 'build/*'
|
||||
|
23
.travis.yml
23
.travis.yml
@ -1,6 +1,7 @@
|
||||
language: python
|
||||
dist: trusty
|
||||
sudo: false
|
||||
python: 2.7
|
||||
|
||||
services:
|
||||
- docker
|
||||
@ -30,18 +31,22 @@ jobs:
|
||||
include:
|
||||
- env: LINT=jekyll
|
||||
- env: LINT=file-encoding
|
||||
- env: LINT=vimlint-errors VIM=nvim VIM_VERSION=v0.2.0
|
||||
- env: LINT=vimlint VIM=nvim VIM_VERSION=v0.2.0
|
||||
- env: LINT=vint-errors VIM=nvim VIM_VERSION=v0.2.0
|
||||
- env: LINT=vint VIM=nvim VIM_VERSION=v0.2.0
|
||||
- env: LINT=vader NVIM_TAG=nightly
|
||||
- env: LINT=vimlint-errors VIM_BIN=nvim VIM_TAG=v0.2.0
|
||||
- env: LINT=vimlint VIM_BIN=nvim VIM_TAG=v0.2.0
|
||||
- env: LINT=vint-errors VIM_BIN=nvim VIM_TAG=v0.2.0
|
||||
- env: LINT=vint VIM_BIN=nvim VIM_TAG=v0.2.0
|
||||
- env: LINT=vader VIM_BIN=nvim VIM_TAG=nightly
|
||||
addons: { apt: { packages: [python2.7-dev, lua5.2] } }
|
||||
- env: LINT=vader NVIM_TAG=v0.3.7
|
||||
- env: LINT=vader VIM_BIN=nvim VIM_TAG=v0.3.7
|
||||
addons: { apt: { packages: [python2.7-dev, lua5.2] } }
|
||||
- env: LINT=vader VIM_BIN=vim VIM_TAG=v7.4.052 #ubuntu 14.04
|
||||
- env: LINT=vader VIM_BIN=vim VIM_TAG=v7.4.1689 #ubuntu 16.04
|
||||
- env: LINT=vader VIM_BIN=vim VIM_TAG=v8.0.1453 #ubuntu 18.04
|
||||
- env: LINT=vader VIM_BIN=vim VIM_TAG=v8.1.0320 #ubuntu 19.04
|
||||
allow_failures:
|
||||
- env: LINT=vimlint VIM=nvim VIM_VERSION=v0.2.0
|
||||
- env: LINT=vint VIM=nvim VIM_VERSION=v0.2.0
|
||||
- env: LINT=vader NVIM_TAG=nightly
|
||||
- env: LINT=vimlint VIM_BIN=nvim VIM_TAG=v0.2.0
|
||||
- env: LINT=vint VIM_BIN=nvim VIM_TAG=v0.2.0
|
||||
- env: LINT=vader VIM_BIN=nvim VIM_TAG=nightly
|
||||
addons: { apt: { packages: [python2.7-dev, lua5.2] } }
|
||||
|
||||
|
||||
|
4
Makefile
4
Makefile
@ -1,10 +1,10 @@
|
||||
test: build/vader | build
|
||||
nvim -Nu test/vimrc -c 'Vader! test/**'
|
||||
$(VIM_BIN) -Nu test/vimrc -c 'Vader! test/**'
|
||||
|
||||
COVIMERAGE=$(shell command -v covimerage 2>/dev/null || echo build/covimerage/bin/covimerage)
|
||||
|
||||
test_coverage: $(COVIMERAGE) build/vader | build
|
||||
$(COVIMERAGE) run nvim -Nu test/vimrc -c 'Vader! test/**'
|
||||
$(COVIMERAGE) run $(VIM_BIN) -Nu test/vimrc -c 'Vader! test/**'
|
||||
|
||||
build/covimerage:
|
||||
virtualenv $@
|
||||
|
Loading…
Reference in New Issue
Block a user