-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
63 lines (55 loc) · 1.39 KB
/
Makefile
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
54
55
56
57
58
59
60
61
62
63
cwd=$(shell pwd)
DOCKER=sudo docker
IMAGE_TAG=petzi/nginx-letsencrypt
COVERAGE_IMAGE=ragnaroek/kcov_head
COVERAGE_DIR=.coverage
.PHONY: default
default: build
.PHONY: build
build: submodule-init
$(DOCKER) build --tag ${IMAGE_TAG} .
.PHONY: clean
clean:
- sudo rm -rf ${COVERAGE_DIR}
- $(DOCKER) rmi ${IMAGE_TAG}
.PHONY: submodule-init
submodule-init:
git submodule update --init
.PHONY: test
test: build
$(DOCKER) run -it \
--volume="${PWD}:/source" \
--volume="${PWD}/.testlogs:/testlogs" \
--entrypoint="/bin/sh" \
--rm \
${IMAGE_TAG} \
/source/test/run-tests.sh
# --bash-handle-sh-invocation is required, so kcov follows all shell scripts executed
# in the for loop in the run-tests.sh wrapper script
.PHONY: coverage
coverage:
echo "WARNING: coverage support is experimental and does not produce valubale output yet."
$(DOCKER) run -it \
--volume="${PWD}:/source" \
--rm \
${COVERAGE_IMAGE} \
--bash-method=DEBUG \
--include-pattern=/source/lib/,/source/test/ \
/source/${COVERAGE_DIR} \
/source/test/run-tests.sh
# A minimal integration test
.PHONY: integration-test
integration-test: build
$(DOCKER) run -it \
--rm \
-e "PROXY_MODE=dev" \
-e "PROXY_DOMAIN=localhost" \
-e "PROXY_BACKENDS=localhost localhost" \
-e "ENTRYPOINT_LOGLEVEL=DEBUG" \
${IMAGE_TAG} nginx -t
.PHONY: shell
shell: build
$(DOCKER) run -it \
--rm \
--entrypoint="/bin/sh" \
${IMAGE_TAG}