Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use vim-testbed to run Vader tests on Travis #88

Merged
merged 3 commits into from
Oct 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yaml-lint complains if there's no document start marker, so I'd put that back in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

sudo: required
services:
- docker
language: python
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

travis-yaml still requires a language so I left that there.

python: 2.7
cache: pip
install:
- "pip install vim-vint==0.3.9"
script:
- "vint -s ."
script: |
make test
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM tweekmonster/vim-testbed:latest

RUN install_vim -tag v8.0.0000 -build \
-tag v8.0.0027 -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
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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; \
EXIT=0; \
for vim in $$vims; do \
$(DOCKER) $$vim '+Vader! test/*' || EXIT=$$?; \
done; \
$(DOCKER) vint -s /testplugin || EXIT=$$?; \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this check all of the .vim files in the repo, outside of tests?

Copy link
Contributor Author

@prashcr prashcr Oct 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It checks the entire repo, because of this line

DOCKER = docker run -a stderr --rm -v $(PWD):/testplugin -v $(PWD)/test:/home "$(IMAGE)"

This part in particular mounts pwd, which is this repo, into the /testplugin directory of the container.

-v $(PWD):/testplugin

I did this because that's how the vim-testbed scripts seemed to work.

exit $$EXIT;

.PHONY: test-setup test
Copy link
Member

@w0rp w0rp Oct 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a make clean rule in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makefile doesn't create files anymore. We could still add a make clean for docker containers but that would undermine caching and people could just do that manually if they happened to be running Docker on their own machine. And we don't need clean for Travis anyway.

9 changes: 9 additions & 0 deletions test/example.vader
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Given (Hello):
Hello

Do (yyp):
yyp

Expect (Hello\nHello):
Hello
Hello
21 changes: 21 additions & 0 deletions test/vimrc
Original file line number Diff line number Diff line change
@@ -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=','