forked from wooga/eredis
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
84 lines (68 loc) · 2.23 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
75
76
77
78
79
80
81
82
83
84
.PHONY: all compile clean test ut ct-tcp ct-tls edoc xref dialyzer elvis cover coverview
REDIS_VERSION ?= 6.0.10
all: compile xref dialyzer elvis
compile:
@rebar3 compile
clean:
@rebar3 clean
@rm -rf _build
test: ut ct
ut:
@rebar3 eunit -v --cover_export_name ut
ct: ct-tcp ct-tls
ct-tcp:
-@docker rm -f redis
@docker run --name redis -d --net=host -v $(shell pwd)/priv/configs:/conf \
redis:$(REDIS_VERSION)
@docker exec redis redis-sentinel /conf/redis_sentinel.conf
@rebar3 ct -v --cover_export_name ct-tcp \
--suite eredis_tcp_SUITE,eredis_pubsub_SUITE,eredis_sentinel_SUITE || { docker logs redis; exit 1; }
@docker rm -f redis
ct-tls:
@priv/generate-test-certs.sh
-@docker rm -f redis
@docker run --name redis -d --net=host -v $(shell pwd)/priv/configs:/conf:ro \
redis:$(REDIS_VERSION) redis-server /conf/redis_tls.conf
@rebar3 ct -v --cover_export_name ct-tls \
--suite eredis_tls_SUITE || { docker logs redis; exit 1; }
@docker rm -f redis
# Generate and patch documentation.
# The patching is needed to be able to generate documentation via Elixirs mix.
# Following changes are needed:
# - Handle link targets in headers, changes:
# '### <a name="link">Header</a> ###' to
# '<a name="link"></a> ### Header ###'
# - Newline needed for before following tags:
# </table> </dd> </pre>
# - Removal of unneeded line breaks (visual only)
#
# Note: sed on macOS requires explicit in-place extensions (-i <extension>)
edoc:
@rebar3 edoc skip_deps=true
for file in doc/*.md ; do \
sed -i.bak 's|### <a name="\(.*\)">\(.*\)</a> ###|<a name="\1"></a>\n### \2 ###|g' $${file} ; \
sed -i.bak 's|</table>|\n</table>|g' $${file} ; \
sed -i.bak 's|</dd>|\n</dd>|g' $${file} ; \
sed -i.bak 's|</code></pre>|</code>\n</pre>|g' $${file} ; \
sed -i.bak 's|<br />||g' $${file} ; \
rm $${file}.bak ; \
done
publish: edoc
@touch doc/.build # Prohibit ex_doc to remove .md files
@mix docs
@if [ ! -z "$$(git status --untracked-file=no --porcelain)" ]; \
then \
echo "Error: Working directory is dirty. Please commit before publish!"; \
exit 1; \
fi
mix hex.publish
xref:
@rebar3 xref
dialyzer:
@rebar3 as test dialyzer
elvis:
@elvis rock
cover:
@rebar3 cover -v
coverview: cover
xdg-open _build/test/cover/index.html