mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-13 02:05:40 +08:00
Update travis setting (#981)
* Update travis setting * Update after failure script * Fix lint * Update comment * Test bot * Update ci script * Update ci * Test lint * Update ci * Check var * Use log file * Fix lint * Check -f * Lint * Fix json * Use vim script instead * Fixup * quit afte comment * Update lint * Fix lint * Install gvim * Remove file * Install vim before test * Fix lint * Fix github api * Use neovim report error * Update travis * Fix unkonwn command * Use origin/dev * Update lint * Fix unkown command * Fix lint * Update config * Fix lint * Fix cache * Fix cache * Fix neovim install * Fix neovim install * Fix install * Use dockerfile * Fix lint * Update install script * Fix lint * Fix type * Fix alow faile * Fix jobs * Fix docker * Fix docker * Fix makefile * Update commenter vim script
This commit is contained in:
parent
729d17a56e
commit
a830a3e2a4
35
.ci/after_failure.sh
Executable file
35
.ci/after_failure.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
|
||||
if [ "$LINT" = "vimlint-errors" ] ; then
|
||||
if [[ -f build_log ]]; then
|
||||
if [[ -d build/GitHub.vim ]]; then
|
||||
rm -rf build/GitHub.vim
|
||||
fi
|
||||
VIMLINT_LOG=`cat build_log`
|
||||
echo "$VIMLINT_LOG"
|
||||
git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim
|
||||
docker run -it --rm \
|
||||
-v $PWD/.ci:/.ci \
|
||||
-v $PWD/build:/build \
|
||||
spacevim/vims neovim-stable -u .ci/common/github_commenter.vim
|
||||
rm build_log
|
||||
fi
|
||||
elif [ "$LINT" = "vint-errors" ] ; then
|
||||
if [[ -f build_log ]]; then
|
||||
if [[ -d build/GitHub.vim ]]; then
|
||||
rm -rf build/GitHub.vim
|
||||
fi
|
||||
VIMLINT_LOG=`cat build_log`
|
||||
echo "$VIMLINT_LOG"
|
||||
git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim
|
||||
docker run -it --rm \
|
||||
-v $PWD/.ci:/.ci \
|
||||
-v $PWD/build:/build \
|
||||
spacevim/vims neovim-stable -u .ci/common/github_commenter.vim
|
||||
rm build_log
|
||||
fi
|
||||
elif [ "$LINT" = "vader" ] ; then
|
||||
echo ""
|
||||
fi
|
||||
fi
|
0
.ci/after_success.sh
Executable file
0
.ci/after_success.sh
Executable file
48
.ci/common/github_commenter.vim
Normal file
48
.ci/common/github_commenter.vim
Normal file
@ -0,0 +1,48 @@
|
||||
exe 'set nocp'
|
||||
set rtp+=build/GitHub.vim
|
||||
so build/GitHub.vim/plugin/github.vim
|
||||
so build/GitHub.vim/autoload/github/api/issues.vim
|
||||
so build/GitHub.vim/autoload/github/api/util.vim
|
||||
let s:log = filereadable('build_log') ? system('cat build_log') : ''
|
||||
function! s:update_log(log, summary, new_log) abort
|
||||
let log = split(a:log, "\n")
|
||||
let begin = -1
|
||||
let end = -1
|
||||
for i in range(len(log))
|
||||
if log[i] =~ a:summary
|
||||
let begin = i
|
||||
endif
|
||||
if begin != -1 && log[i] ==# '</details>'
|
||||
let end = i
|
||||
endif
|
||||
endfor
|
||||
return a:log . "\n" . a:new_log
|
||||
|
||||
endfunction
|
||||
if !empty(s:log)
|
||||
if $LINT == 'vader'
|
||||
let s:summary = $VIM . ' ' . $LINT . ' build log'
|
||||
else
|
||||
let s:summary = $LINT . ' build log'
|
||||
endif
|
||||
let s:log = '<details><summary>' . s:summary . "</summary>\n" . s:log . "\n</details>"
|
||||
let s:comments = github#api#issues#List_comments('SpaceVim', 'SpaceVim',$TRAVIS_PULL_REQUEST ,'')
|
||||
if empty(s:comments)
|
||||
call github#api#issues#Create_comment('SpaceVim','SpaceVim', $TRAVIS_PULL_REQUEST, {'body': s:log}, 'SpaceVimBot', $BOTSECRET)
|
||||
else
|
||||
let s:nr = 0
|
||||
for s:comment in s:comments
|
||||
if s:comment.user.login ==# 'SpaceVimBot'
|
||||
let s:nr = s:comment.id
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
if s:nr == 0
|
||||
call github#api#issues#Create_comment('SpaceVim','SpaceVim', $TRAVIS_PULL_REQUEST, {'body': s:log}, 'SpaceVimBot', $BOTSECRET)
|
||||
else
|
||||
call github#api#issues#Edit_comment('SpaceVim','SpaceVim', s:nr,
|
||||
\ {'body': s:update_log(s:comment.body, s:summary, s:log)}, 'SpaceVimBot', $BOTSECRET)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
quit
|
0
.ci/install.ps1
Normal file → Executable file
0
.ci/install.ps1
Normal file → Executable file
20
.ci/install.sh
Executable file
20
.ci/install.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Fail on unset variables and command errors
|
||||
set -ue -o pipefail
|
||||
|
||||
# Prevent commands misbehaving due to locale differences
|
||||
export LC_ALL=C
|
||||
|
||||
docker pull spacevim/vims
|
||||
|
||||
git fetch origin dev:dev
|
||||
|
||||
if [ "${LINT#vimlint}" != "$LINT" ]; then
|
||||
git clone --depth=1 https://github.com/syngan/vim-vimlint /tmp/vimlint
|
||||
git clone --depth=1 https://github.com/ynkdir/vim-vimlparser /tmp/vimlparser
|
||||
elif [ "${LINT#vint}" != "$LINT" ]; then
|
||||
pip install vim-vint
|
||||
elif [ "${LINT#vader}" != "$LINT" ]; then
|
||||
git clone --depth=1 https://github.com/Shougo/dein.vim.git ~/.cache/vimfiles/repos/github.com/Shougo/dein.vim
|
||||
fi
|
55
.ci/install/linux.sh
Normal file
55
.ci/install/linux.sh
Normal file
@ -0,0 +1,55 @@
|
||||
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
|
||||
}
|
||||
|
||||
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() {
|
||||
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
|
||||
}
|
32
.ci/script.sh
Executable file
32
.ci/script.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
if [ "$LINT" = "vimlint" ]; then
|
||||
for file in $(git diff --name-only HEAD dev | grep .vim$);
|
||||
do
|
||||
sh /tmp/vimlint/bin/vimlint.sh -l /tmp/vimlint -p /tmp/vimlparser $file;
|
||||
done
|
||||
elif [ "$LINT" = "vimlint-errors" ]; then
|
||||
if [[ -f build_log ]]; then
|
||||
rm build_log
|
||||
fi
|
||||
for file in $(git diff --name-only HEAD dev | grep .vim$);
|
||||
do
|
||||
/tmp/vimlint/bin/vimlint.sh -E -l /tmp/vimlint -p /tmp/vimlparser $file >> build_log;
|
||||
done
|
||||
if [[ -f build_log ]]; then
|
||||
cat build_log
|
||||
exit 2
|
||||
fi
|
||||
elif [ "$LINT" = "vint" ]; then
|
||||
vint .
|
||||
elif [ "$LINT" = "vint-errors" ]; then
|
||||
vint --error .
|
||||
elif [ "$LINT" = "vader" ]; then
|
||||
pip install covimerage
|
||||
make test_coverage
|
||||
covimerage -vv xml --omit 'build/*'
|
||||
pip install codecov
|
||||
codecov -X search gcov pycov -f coverage.xml
|
||||
fi
|
||||
set +x
|
78
.travis.yml
78
.travis.yml
@ -1,6 +1,13 @@
|
||||
language: python
|
||||
dist: trusty
|
||||
sudo: false
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
git:
|
||||
depth: 3
|
||||
|
||||
notifications:
|
||||
slack:
|
||||
on_success: never
|
||||
@ -9,62 +16,27 @@ notifications:
|
||||
on_success: never # default: change
|
||||
on_failure: never # default: always
|
||||
cache:
|
||||
pip: true
|
||||
- directories:
|
||||
- $HOME/cache/
|
||||
|
||||
env:
|
||||
global:
|
||||
- DEPS=$HOME/deps
|
||||
- PATH=$DEPS/bin:$PATH
|
||||
matrix:
|
||||
- LINT=vimlint-errors
|
||||
- LINT=vimlint
|
||||
- LINT=vint-errors
|
||||
- LINT=vint
|
||||
- LINT=vader
|
||||
- PATH=$HOME/vim/bin:$PATH
|
||||
|
||||
matrix:
|
||||
jobs:
|
||||
include:
|
||||
- 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 VIM=vim VIM_VERSION=v8.0.0027
|
||||
- env: LINT=vader VIM=nvim VIM_VERSION=v0.2.0
|
||||
allow_failures:
|
||||
- env: LINT=vimlint
|
||||
- env: LINT=vint
|
||||
- env: LINT=vimlint VIM=nvim VIM_VERSION=v0.2.0
|
||||
- env: LINT=vint VIM=nvim VIM_VERSION=v0.2.0
|
||||
|
||||
install:
|
||||
- |
|
||||
set -e
|
||||
if [ "${LINT#vimlint}" != "$LINT" ]; then
|
||||
git clone --depth=1 https://github.com/syngan/vim-vimlint /tmp/vimlint
|
||||
git clone --depth=1 https://github.com/ynkdir/vim-vimlparser /tmp/vimlparser
|
||||
elif [ "${LINT#vint}" != "$LINT" ]; then
|
||||
virtualenv /tmp/vint && source /tmp/vint/bin/activate && pip install vim-vint
|
||||
elif [ "${LINT#vader}" != "$LINT" ]; then
|
||||
git clone --depth=1 https://github.com/Shougo/dein.vim.git ~/.cache/vimfiles/repos/github.com/Shougo/dein.vim
|
||||
C_OPTS="--prefix=$DEPS --with-features=huge --disable-gui --enable-pythoninterp"
|
||||
(git clone --depth 1 https://github.com/vim/vim /tmp/vim &&
|
||||
cd /tmp/vim &&
|
||||
./configure $C_OPTS &&
|
||||
make install)
|
||||
fi
|
||||
script:
|
||||
- |
|
||||
set -ex
|
||||
if [ "$LINT" = "vimlint" ]; then
|
||||
for file in $(git diff --name-only HEAD dev | grep .vim$);
|
||||
do
|
||||
sh /tmp/vimlint/bin/vimlint.sh -l /tmp/vimlint -p /tmp/vimlparser $file;
|
||||
done
|
||||
elif [ "$LINT" = "vimlint-errors" ]; then
|
||||
for file in $(git diff --name-only HEAD dev | grep .vim$);
|
||||
do
|
||||
sh /tmp/vimlint/bin/vimlint.sh -E -l /tmp/vimlint -p /tmp/vimlparser $file;
|
||||
done
|
||||
elif [ "$LINT" = "vint" ]; then
|
||||
vint .
|
||||
elif [ "$LINT" = "vint-errors" ]; then
|
||||
vint --error .
|
||||
elif [ "$LINT" = "vader" ]; then
|
||||
pip install covimerage
|
||||
make test_coverage
|
||||
covimerage -vv xml --omit 'build/*'
|
||||
pip install codecov
|
||||
codecov -X search gcov pycov -f coverage.xml
|
||||
fi
|
||||
set +x
|
||||
|
||||
install: .ci/install.sh
|
||||
script: .ci/script.sh
|
||||
after_success: .ci/after_success.sh
|
||||
after_failure: .ci/after_failure.sh
|
||||
|
12
Makefile
12
Makefile
@ -1,10 +1,18 @@
|
||||
DOCKER = docker run -it --rm -v $(PWD):/testplugin -v $(PWD)/test:/test -v $(PWD)/build:/build "spacevim/vims"
|
||||
|
||||
ifeq ($(VIM),nvim)
|
||||
DEFAULT_VIM:=$(DOCKER) neovim-stable
|
||||
else
|
||||
DEFAULT_VIM:=$(DOCKER) vim8
|
||||
endif
|
||||
|
||||
test: build/vader | build
|
||||
vim -Nu test/vimrc -c 'Vader! test/**'
|
||||
$(DEFAULT_VIM) -Nu test/vimrc -c 'Vader! test/**'
|
||||
|
||||
COVIMERAGE=$(shell command -v ccovimerage 2>/dev/null || echo build/covimerage/bin/covimerage)
|
||||
|
||||
test_coverage: $(COVIMERAGE) build/vader | build
|
||||
$(COVIMERAGE) run vim -Nu test/vimrc -c 'Vader! test/**'
|
||||
$(COVIMERAGE) run $(DEFAULT_VIM) -Nu test/vimrc -c 'Vader! test/**'
|
||||
|
||||
build/covimerage:
|
||||
virtualenv $@
|
||||
|
@ -204,3 +204,11 @@ fu! UpdateStarredRepos()
|
||||
endfor
|
||||
return 1
|
||||
endf
|
||||
|
||||
|
||||
function! TestBot(argv) abort
|
||||
endfunction
|
||||
|
||||
function! TestBot(argv) abort
|
||||
|
||||
endfunction
|
||||
|
Loading…
x
Reference in New Issue
Block a user