diff --git a/.travis.mk b/.travis.mk new file mode 100644 index 000000000..e732f41c8 --- /dev/null +++ b/.travis.mk @@ -0,0 +1,45 @@ +## Makefile.CI +# +# This is for use on [Travis CI](http://travis-ci.org), which is +# a free distributed continuous integration service with unique +# set of features: +# * uses clean ephemeral virtual machines for every build +# * integrates with GitHub - triggers builds on push and pull-request +# * it is open source and free for public repositories +# * features great web UI and bunch of other stuff + +JOBS ?= 2 +TAIL ?= tail -n 15 + + +EXAMPLES_ALL = hello-world + +EXAMPLES_native = ipv6/native-border-router + +CT := \033[0;0m + +ifdef BOXED_SIGNS + SKIP_SIGN := ☐ + FAIL_SIGN := ☒ + PASS_SIGN := ☑ +else + SKIP_SIGN := ✈ + FAIL_SIGN := ✘ + PASS_SIGN := ✔ +endif + + +SKIP = (echo "\033[1;36m $(SKIP_SIGN) ➝ ❨ $$e ⊈ $@ ❩$(CT)"; echo skip >> results) +FAIL = (echo "\033[1;35m $(FAIL_SIGN) ➝ ❨ $$e ∉ $@ ❩$(CT)"; $(TAIL) $(LOG); echo fail >> results) +PASS = (echo "\033[1;32m $(PASS_SIGN) ➝ ❨ $$e ∈ $@ ❩$(CT)"; echo pass >> results) + +ifeq ($(BUILD_TYPE),multi) +THIS = $(MAKE) -C examples/$$e TARGET=$@ > $(LOG) 2>&1 +MINE = $(EXAMPLES_ALL) $(EXAMPLES_$(subst -,_,$@)) +endif + +LOG = /tmp/$@_`echo $$e | sed 's:/:_:g'`.log + +%: + @echo "\033[1;37m ➠ ❨$@❩ $(CT)" + @for e in $(MINE); do $(THIS) && $(PASS) || $(FAIL); done; diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..df5a8d099 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +language: c #NOTE: this will set CC=gcc which might cause trouble +before_script: + ## Install mainline msp430 toolchain for all build types + - "sudo apt-get -qq update && sudo apt-get -qq install gcc-msp430 || true" + +script: + ## The makefile called `.travis.mk` handles most of generic logic + - "make -f .travis.mk $MAKE_TARGETS" + +after_script: + ## Print a basic summary in unix style + - "echo 'Summary:'; cat results | sort | uniq -c" + ## This will detect whether the build should pass or fail + - "grep -v -q 'fail' results" + + +env: + ## This magically kick-off parallel jobs for each of the for the sets + ## of environment variable defined below + - BUILD_TYPE='multi' MAKE_TARGETS='native minimal-net'