diff --git a/.travis.yml b/.travis.yml index f6f2597..53153a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,5 @@ sudo: required services: - docker -before_script: | - cd example - make test-setup - script: | make test diff --git a/Makefile b/Makefile index 10d4b3e..3ff5f10 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,14 @@ -.PHONY: build - +.PHONY: build test build: docker build -t "tweekmonster/vim-testbed" . + +# test: build the base image and then the example image on top, running tests +# therein. +DOCKER_BASE_IMAGE:=vim-testbed-base +DOCKER_EXAMPLE_IMAGE:=vim-testbed-example +test: + docker build -t "$(DOCKER_BASE_IMAGE)" . \ + && cd example \ + && docker build -t "$(DOCKER_EXAMPLE_IMAGE)" . \ + && make test IMAGE=$(DOCKER_EXAMPLE_IMAGE) diff --git a/example/Dockerfile b/example/Dockerfile new file mode 100644 index 0000000..b4b2523 --- /dev/null +++ b/example/Dockerfile @@ -0,0 +1,7 @@ +FROM vim-testbed-base + +RUN install_vim -name vim-precise -tag v7.3.429 -build \ + -name vim-trusty -tag v7.4.052 -build \ + -name vim-vivid -tag v7.4.488 -build \ + -name vim-wily -tag v7.4.712 -build \ + -name vim-xenial -tag v7.4.963 -build \ diff --git a/example/Makefile b/example/Makefile index 9d8a1d6..964d61b 100644 --- a/example/Makefile +++ b/example/Makefile @@ -1,17 +1,17 @@ +IMAGE ?= tweekmonster/ubuntu-vims PLUGINS = test/plugins -IMAGE = tweekmonster/ubuntu-vims DOCKER = docker run -it --rm -v $(PWD):/testplugin -v $(PWD)/test:/home "$(IMAGE)" -test-setup: +$(PLUGINS)/vader.vim: mkdir -p $(PLUGINS) - docker pull tweekmonster/ubuntu-vims cd $(PLUGINS) && git clone https://github.com/junegunn/vader.vim.git -test: - $(DOCKER) vim-precise '+Vader! test/*' - $(DOCKER) vim-trusty '+Vader! test/*' - $(DOCKER) vim-vivid '+Vader! test/*' - $(DOCKER) vim-wily '+Vader! test/*' - $(DOCKER) vim-xenial '+Vader! test/*' +test-setup: $(PLUGINS)/vader.vim + docker images -q $(IMAGE) || docker pull $(IMAGE) + +test: test-setup + for vim in $$(docker run --rm $(IMAGE) ls /vim-build/bin | grep -E '^n?vim'); do \ + $(DOCKER) $$vim '+Vader! test/*'; \ + done .PHONY: test-setup test diff --git a/scripts/install_vim.sh b/scripts/install_vim.sh index b5c07cc..4637867 100644 --- a/scripts/install_vim.sh +++ b/scripts/install_vim.sh @@ -104,6 +104,7 @@ while [ $# -gt 0 ]; do # expects a -build flag to signal the start of a build. This way, # installing all Vim versions becomes one layer. # Side note: tried docker-squash and it didn't seem to do anything. + echo "=== building: NAME=$NAME, TAG=$TAG, PYTHON=$PYTHON, RUBY=$RUBY, LUA=$LUA ===" build NAME="" TAG="" @@ -116,6 +117,7 @@ while [ $# -gt 0 ]; do shift done +echo "Pruning packages and dirs.." apk del vim-build rm -rf /vim/* rm -rf /var/cache/apk/* /tmp/* /var/tmp/*