-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
75 lines (55 loc) · 1.47 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
64
65
66
67
68
69
70
71
72
73
74
VERBOSE ?= 0
VERSION = $(shell grep VERSION lp/init.lua \
|awk '{print $$3}' \
|sed "s/[,']//g" \
)
SPEC_NAME = lp-$(VERSION).rockspec
DOCKER_VERSIONS = \
2.8.3 \
2.8
DOCKER_LATEST = 2.8.3
GITVERSION = $(shell git describe)
all:
@echo usage: 'make test'
test:
@echo '# Run tests for version: $(VERSION)'
prove -r$(shell if test "$(VERBOSE)" -gt 0; then echo v; fi) t
update-spec: $(SPEC_NAME)
$(SPEC_NAME): $(lp/init.lua) lp.rockspec.in
rm -fr lp-*.rockspec
cp -v lp.rockspec.in $@.prepare
sed -Ei 's/@@VERSION@@/$(VERSION)/g' $@.prepare
mv -v $@.prepare $@
git add $@
upload: update-spec
rm -f lp-*.src.rock
luarocks upload $(SPEC_NAME)
dockers:
@set -e; \
cd docker; \
for version in $(DOCKER_VERSIONS); do \
TAGS="-t unera/tarantool-lp:$$version-$(GITVERSION)"; \
test $$version = $(DOCKER_LATEST) && TAGS="-t unera/tarantool-lp:latest $$TAGS"; \
echo "\\nDockers creating: $$TAGS..."; \
sed -E "s/@@VERSION@@/$$version/g" Dockerfile.in > Dockerfile \
| docker build . \
$$TAGS 2>&1 |sed -u -E 's/^/\t/' \
; \
done
docker-upload: dockers
@set -e; \
cd docker; \
for version in $(DOCKER_VERSIONS); do \
TAGS="unera/tarantool-lp:$$version-$(GITVERSION)"; \
test $$version = $(DOCKER_LATEST) && TAGS="$$TAGS unera/tarantool-lp:latest"; \
echo "\\n/ $$version / Uploading: $$TAGS..."; \
for tag in $$TAGS; do \
echo + docker push $$tag; \
docker push $$tag; \
done; \
done
.PHONY: \
all \
test \
update-spec \
clean