Skip to content

Commit 296f028

Browse files
authored
Fix/improve tests: build and test against the base and example image (#13)
Fixes: #12
1 parent e1bc2a1 commit 296f028

File tree

5 files changed

+29
-15
lines changed

5 files changed

+29
-15
lines changed

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,5 @@ sudo: required
33
services:
44
- docker
55

6-
before_script: |
7-
cd example
8-
make test-setup
9-
106
script: |
117
make test

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
.PHONY: build
2-
1+
.PHONY: build test
32

43
build:
54
docker build -t "tweekmonster/vim-testbed" .
5+
6+
# test: build the base image and then the example image on top, running tests
7+
# therein.
8+
DOCKER_BASE_IMAGE:=vim-testbed-base
9+
DOCKER_EXAMPLE_IMAGE:=vim-testbed-example
10+
test:
11+
docker build -t "$(DOCKER_BASE_IMAGE)" . \
12+
&& cd example \
13+
&& docker build -t "$(DOCKER_EXAMPLE_IMAGE)" . \
14+
&& make test IMAGE=$(DOCKER_EXAMPLE_IMAGE)

example/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM vim-testbed-base
2+
3+
RUN install_vim -name vim-precise -tag v7.3.429 -build \
4+
-name vim-trusty -tag v7.4.052 -build \
5+
-name vim-vivid -tag v7.4.488 -build \
6+
-name vim-wily -tag v7.4.712 -build \
7+
-name vim-xenial -tag v7.4.963 -build \

example/Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1+
IMAGE ?= tweekmonster/ubuntu-vims
12
PLUGINS = test/plugins
2-
IMAGE = tweekmonster/ubuntu-vims
33
DOCKER = docker run -it --rm -v $(PWD):/testplugin -v $(PWD)/test:/home "$(IMAGE)"
44

5-
test-setup:
5+
$(PLUGINS)/vader.vim:
66
mkdir -p $(PLUGINS)
7-
docker pull tweekmonster/ubuntu-vims
87
cd $(PLUGINS) && git clone https://github.com/junegunn/vader.vim.git
98

10-
test:
11-
$(DOCKER) vim-precise '+Vader! test/*'
12-
$(DOCKER) vim-trusty '+Vader! test/*'
13-
$(DOCKER) vim-vivid '+Vader! test/*'
14-
$(DOCKER) vim-wily '+Vader! test/*'
15-
$(DOCKER) vim-xenial '+Vader! test/*'
9+
test-setup: $(PLUGINS)/vader.vim
10+
docker images -q $(IMAGE) || docker pull $(IMAGE)
11+
12+
test: test-setup
13+
for vim in $$(docker run --rm $(IMAGE) ls /vim-build/bin | grep -E '^n?vim'); do \
14+
$(DOCKER) $$vim '+Vader! test/*'; \
15+
done
1616

1717
.PHONY: test-setup test

scripts/install_vim.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ while [ $# -gt 0 ]; do
107107
# expects a -build flag to signal the start of a build. This way,
108108
# installing all Vim versions becomes one layer.
109109
# Side note: tried docker-squash and it didn't seem to do anything.
110+
echo "=== building: NAME=$NAME, TAG=$TAG, PYTHON=$PYTHON, RUBY=$RUBY, LUA=$LUA ==="
110111
build
111112
init_vars
112113
;;
@@ -115,6 +116,7 @@ while [ $# -gt 0 ]; do
115116
shift
116117
done
117118

119+
echo "Pruning packages and dirs.."
118120
apk del vim-build
119121
rm -rf /vim/*
120122
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*

0 commit comments

Comments
 (0)