-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (51 loc) · 1.79 KB
/
Makefile
File metadata and controls
65 lines (51 loc) · 1.79 KB
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
64
65
VERSION=$(shell git describe --tags --dirty)
REPO ?= planetlabs
REPO_PATH ?= datalake
IMAGE="$(REPO)/$(REPO_PATH):$(VERSION)"
.PHONY: docker # build the docker container
docker: version
docker build --build-arg VERSION=$(VERSION) -t $(IMAGE) .
.PHONY: dev # Open a developer shell in the docker env
dev: docker
docker run --rm -it -v $$PWD:/opt --entrypoint /bin/bash $(IMAGE)
test-client: docker
docker run --rm -t --entrypoint tox $(IMAGE) -c /opt/client/tox.ini
test-ingester: docker
docker run --rm -t --entrypoint pytest $(IMAGE) /opt/ingester -svvx
test-api: docker
docker run --rm -t --entrypoint pytest $(IMAGE) /opt/api -svvx
testp-client: docker
docker run --rm -t --entrypoint /bin/bash $(IMAGE) -c "cd /opt/client && pytest -svvx -n auto"
testp-ingester: docker
docker run --rm -t --entrypoint pytest $(IMAGE) /opt/ingester -svvx -n auto
testp-api: docker
docker run --rm -t --entrypoint pytest $(IMAGE) /opt/api -svvx -n auto
.PHONY: test # Run the tests
test:
echo VERSION=$(VERSION)
$(MAKE) test-client
$(MAKE) test-ingester
$(MAKE) test-api
.PHONY: testp # Run all tests in parallel with pytest-xdist
testp: docker
docker run --rm -t --entrypoint /bin/bash $(IMAGE) -c "\
set -e && \
echo '==> Running client tests...' && \
cd /opt/client && pytest -svvx -n auto && \
echo '==> Running ingester tests...' && \
cd /opt/ingester && pytest -svvx -n auto && \
echo '==> Running API tests...' && \
cd /opt/api && pytest -svvx -n auto && \
echo '==> All tests passed!'"
.PHONY: push
push:
docker push $(IMAGE)
clean:
rm -rf version.txt
.PHONY: version
version:
@test -f version.txt \
|| echo $(VERSION) | tee version.txt
.PHONY: help # Generate list of targets with descriptions
help:
@grep '^.PHONY: .* #' Makefile | sed 's/\.PHONY: \(.*\) # \(.*\)/ \1: \2/' | expand -t20