summaryrefslogtreecommitdiff
path: root/Makefile
blob: 5e939c1e184e5f17963d83c7a411813f9bbe3d27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
SHELL := /usr/bin/env bash
IMAGE ?= w0rp/ale
CURRENT_IMAGE_ID = 107e4efc4267
DOCKER_FLAGS = --rm -v $(PWD):/testplugin -v $(PWD)/test:/home "$(IMAGE)"
tests = test/*

test-setup:
	docker images -q w0rp/ale | grep ^$(CURRENT_IMAGE_ID) > /dev/null || \
		docker pull $(IMAGE)

vader: 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 run -a stderr $(DOCKER_FLAGS) $$vim '+Vader! $(tests)'; \
	done

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 \
		echo; \
		echo '========================================'; \
		echo "Running tests for $$vim"; \
		echo '========================================'; \
		echo; \
		docker run -a stderr $(DOCKER_FLAGS) $$vim '+Vader! $(tests)' || EXIT=$$?; \
	done; \
	echo; \
	echo '========================================'; \
	echo 'Running Vint to lint our code'; \
	echo '========================================'; \
	echo 'Vint warnings/errors follow:'; \
	echo; \
	set -o pipefail; \
	docker run -a stdout $(DOCKER_FLAGS) vint -s /testplugin | sed s:^/testplugin/:: || EXIT=$$?; \
	set +o pipefail; \
	echo; \
	echo '========================================'; \
	echo 'Running custom checks'; \
	echo '========================================'; \
	echo 'Custom warnings/errors follow:'; \
	echo; \
	set -o pipefail; \
	docker run -a stdout $(DOCKER_FLAGS) /testplugin/custom-checks /testplugin | sed s:^/testplugin/:: || EXIT=$$?; \
	set +o pipefail; \
	echo; \
	exit $$EXIT;

.DEFAULT_GOAL := test