Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #167 from basho/feature/sdc/buildbot
Add buildbot Makefile for CI.
  • Loading branch information
seancribbs committed Apr 24, 2014
2 parents 6c7275a + 30bc58d commit 3bf7da3
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 23 deletions.
26 changes: 26 additions & 0 deletions buildbot/Makefile
@@ -0,0 +1,26 @@
RIAK_CONF = ${RIAK_DIR}/etc/riak.conf
ADVANCED_CONF = ${RIAK_DIR}/etc/advanced.config
# RIAK = ${RIAK_DIR}/bin/riak
# RIAK_ADMIN = ${RIAK_DIR}/bin/riak-admin
# CERTS_DIR = $(shell pwd)/../src/test/resources

preconfigure:
echo "storage_backend = memory" >> ${RIAK_CONF}
echo "anti_entropy = passive" >> ${RIAK_CONF}
echo "[{riak_kv,[{test,true}]}]." >> ${ADVANCED_CONF}
echo "search = on" >> ${RIAK_CONF}
echo "listener.protobuf.internal = 127.0.0.1:8087" >> ${RIAK_CONF}
echo "distributed_cookie = riak" >> ${RIAK_CONF}
echo "nodename = riak@127.0.0.1" >> ${RIAK_CONF}

configure:
@echo "Nothing to configure on the live node."

compile:
@${MAKE} -C .. compile

lint:
@${MAKE} -C .. xref dialyzer

test:
@${MAKE} -C .. test
70 changes: 47 additions & 23 deletions tools.mk
@@ -1,44 +1,68 @@
REBAR ?= ./rebar

compile-no-deps:
${REBAR} compile skip_deps=true

test: compile
./rebar eunit skip_deps=true
${REBAR} eunit skip_deps=true

docs:
./rebar doc skip_deps=true
${REBAR} doc skip_deps=true

xref: compile
${REBAR} xref skip_deps=true

PLT ?= $(HOME)/.riak_combo_dialyzer_plt
PLT ?= $(HOME)/.combo_dialyzer_plt
LOCAL_PLT = .local_dialyzer_plt
DIALYZER_FLAGS ?= -Wunmatched_returns

${PLT}: compile
ifneq (,$(wildcard $(PLT)))
dialyzer --check_plt --plt $(PLT) --apps $(DIALYZER_APPS) && \
dialyzer --add_to_plt --plt $(PLT) --output_plt $(PLT) --apps $(DIALYZER_APPS) ; test $$? -ne 1
else
dialyzer --build_plt --output_plt $(PLT) --apps $(DIALYZER_APPS); test $$? -ne 1
endif
@if [ -f $(PLT) ]; then \
dialyzer --check_plt --plt $(PLT) --apps $(DIALYZER_APPS) && \
dialyzer --add_to_plt --plt $(PLT) --output_plt $(PLT) --apps $(DIALYZER_APPS) ; test $$? -ne 1; \
else \
dialyzer --build_plt --output_plt $(PLT) --apps $(DIALYZER_APPS); test $$? -ne 1; \
fi

${LOCAL_PLT}: compile
ifneq (,$(wildcard deps/*))
ifneq (,$(wildcard $(LOCAL_PLT)))
dialyzer --check_plt --plt $(LOCAL_PLT) deps/*/ebin && \
dialyzer --add_to_plt --plt $(LOCAL_PLT) --output_plt $(LOCAL_PLT) deps/*/ebin ; test $$? -ne 1
else
dialyzer --build_plt --output_plt $(LOCAL_PLT) deps/*/ebin ; test $$? -ne 1
endif
endif

dialyzer: ${PLT} ${LOCAL_PLT}
@if [ -d deps ]; then \
if [ -f $(LOCAL_PLT) ]; then \
dialyzer --check_plt --plt $(LOCAL_PLT) deps/*/ebin && \
dialyzer --add_to_plt --plt $(LOCAL_PLT) --output_plt $(LOCAL_PLT) deps/*/ebin ; test $$? -ne 1; \
else \
dialyzer --build_plt --output_plt $(LOCAL_PLT) deps/*/ebin ; test $$? -ne 1; \
fi \
fi

dialyzer-run:
@echo "==> $(shell basename $(shell pwd)) (dialyzer)"
@if [ -f $(LOCAL_PLT) ]; then \
dialyzer $(DIALYZER_FLAGS) --plts $(PLT) $(LOCAL_PLT) -c ebin; \
PLTS="$(PLT) $(LOCAL_PLT)"; \
else \
PLTS=$(PLT); \
fi; \
if [ -f dialyzer.ignore-warnings ]; then \
if [ $$(grep -cvE '[^[:space:]]' dialyzer.ignore-warnings) -ne 0 ]; then \
echo "ERROR: dialyzer.ignore-warnings contains a blank/empty line, this will match all messages!"; \
exit 1; \
fi; \
dialyzer $(DIALYZER_FLAGS) --plts $${PLTS} -c ebin > dialyzer_warnings ; \
egrep -v "^\s*(done|Checking|Proceeding|Compiling)" dialyzer_warnings | grep -F -f dialyzer.ignore-warnings -v > dialyzer_unhandled_warnings ; \
cat dialyzer_unhandled_warnings ; \
[ $$(cat dialyzer_unhandled_warnings | wc -l) -eq 0 ] ; \
else \
dialyzer $(DIALYZER_FLAGS) --plts $(PLT) -c ebin; \
dialyzer $(DIALYZER_FLAGS) --plts $${PLTS} -c ebin; \
fi

dialyzer-quick: compile-no-deps dialyzer-run

dialyzer: ${PLT} ${LOCAL_PLT} dialyzer-run

cleanplt:
@echo
@echo
@echo "Are you sure? It takes several minutes to re-build."
@echo Deleting $(PLT) and $(LOCAL_PLT) in 5 seconds.
@echo
@echo
sleep 5
rm $(PLT)
rm $(LOCAL_PLT)
Expand Down

0 comments on commit 3bf7da3

Please sign in to comment.