From 210d464442eb16c4450816307b5f52c7c6994913 Mon Sep 17 00:00:00 2001 From: Prashanth Chandra Date: Tue, 11 Oct 2016 10:28:25 +0800 Subject: [PATCH 1/3] Use vim-testbed to run Vader tests on Travis --- .travis.yml | 14 ++++++++++---- Dockerfile | 13 +++++++++++++ Makefile | 14 ++++++++++++++ test/example.vader | 9 +++++++++ test/vimrc | 21 +++++++++++++++++++++ 5 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 test/example.vader create mode 100644 test/vimrc diff --git a/.travis.yml b/.travis.yml index 03ad0177..11adf95d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,14 @@ --- +sudo: required +services: + - docker language: python python: 2.7 cache: pip -install: - - "pip install vim-vint==0.3.9" -script: - - "vint -s ." +install: | + pip install vim-vint==0.3.9 +script: | + EXIT=0 + vint -s || EXIT=$? + make test || EXIT=$? + exit $EXIT diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..2944bbad --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM tweekmonster/vim-testbed:latest + +RUN install_vim -tag v8.0.0000 -build \ + -tag v8.0.0027 -build + +ENV PACKAGES="\ + git \ +" +RUN apk --update add $PACKAGES && \ + rm -rf /var/cache/apk/* /tmp/* /var/tmp/* + +RUN git clone https://github.com/junegunn/vader.vim vader && \ + cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..292f20bd --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +IMAGE ?= w0rp/ale +DOCKER = docker run -a stderr --rm -v $(PWD):/testplugin -v $(PWD)/test:/home "$(IMAGE)" + +test-setup: + docker images -q $(IMAGE) || docker pull $(IMAGE) + +test: test-setup + vims=$$(docker run --rm $(IMAGE) ls /vim-build/bin | grep -E '^n?vim'); \ + if [ -z "$$vims" ]; then echo "No Vims found!"; exit 1; fi; \ + for vim in $$vims; do \ + $(DOCKER) $$vim '+Vader! test/*'; \ + done + +.PHONY: test-setup test diff --git a/test/example.vader b/test/example.vader new file mode 100644 index 00000000..24aa2f0b --- /dev/null +++ b/test/example.vader @@ -0,0 +1,9 @@ +Given (Hello): + Hello + +Do (yyp): + yyp + +Expect (Hello\nHello): + Hello + Hello diff --git a/test/vimrc b/test/vimrc new file mode 100644 index 00000000..043f75b9 --- /dev/null +++ b/test/vimrc @@ -0,0 +1,21 @@ +" Load builtin plugins +" We need this because run_vim.sh sets -i NONE +set rtp=/home/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,/home/vim/after +set rtp+=/vader + +" The following is just an example +filetype plugin indent on +syntax on +set nocompatible +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set expandtab +set backspace=2 +set nofoldenable +set foldmethod=syntax +set foldlevelstart=10 +set foldnestmax=10 +set ttimeoutlen=0 + +let mapleader=',' From 9a0a663dc15c1926cefe582c2dfc7e519b33fc1a Mon Sep 17 00:00:00 2001 From: Prashanth Chandra Date: Wed, 12 Oct 2016 19:25:53 +0800 Subject: [PATCH 2/3] Move vint to Docker --- .travis.yml | 5 +---- Dockerfile | 4 ++++ Makefile | 7 +++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 11adf95d..0426ead1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,4 @@ cache: pip install: | pip install vim-vint==0.3.9 script: | - EXIT=0 - vint -s || EXIT=$? - make test || EXIT=$? - exit $EXIT + make test diff --git a/Dockerfile b/Dockerfile index 2944bbad..7ef5e77c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,9 +5,13 @@ RUN install_vim -tag v8.0.0000 -build \ ENV PACKAGES="\ git \ + python=2.7.12-r0 \ + py-pip=8.1.2-r0 \ " RUN apk --update add $PACKAGES && \ rm -rf /var/cache/apk/* /tmp/* /var/tmp/* +RUN pip install vim-vint==0.3.9 + RUN git clone https://github.com/junegunn/vader.vim vader && \ cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af diff --git a/Makefile b/Makefile index 292f20bd..b0bbf3ee 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,11 @@ test-setup: test: test-setup vims=$$(docker run --rm $(IMAGE) ls /vim-build/bin | grep -E '^n?vim'); \ if [ -z "$$vims" ]; then echo "No Vims found!"; exit 1; fi; \ + EXIT=0; \ for vim in $$vims; do \ - $(DOCKER) $$vim '+Vader! test/*'; \ - done + $(DOCKER) $$vim '+Vader! test/*' || EXIT=$$?; \ + done; \ + $(DOCKER) vint -s /testplugin || EXIT=$$?; \ + exit $$EXIT; .PHONY: test-setup test From 51b4efd7074b2aa32a31de5a7f37a9b3507bc0a9 Mon Sep 17 00:00:00 2001 From: Prashanth Chandra Date: Wed, 12 Oct 2016 20:17:13 +0800 Subject: [PATCH 3/3] Remove vint from Travis --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0426ead1..d6da2530 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,5 @@ sudo: required services: - docker language: python -python: 2.7 -cache: pip -install: | - pip install vim-vint==0.3.9 script: | make test