From e4ceabb0e0552793cd83b6073b3389552b03e2bb Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Thu, 17 Mar 2016 20:18:16 -0700 Subject: [PATCH] Added a travis file. --- .travis.yml | 4 ++++ scripts/test.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .travis.yml create mode 100755 scripts/test.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..027bc513 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: rust +rust: + - nightly +script: ./scripts/test.sh diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 00000000..86c9530d --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e + +EXAMPLES_DIR="examples/" +LIB_DIR="lib/" +MACROS_DIR="macros/" + +function build_and_test() { + local dir=$1 + if [ -z "${dir}" ] || ! [ -d "${dir}" ]; then + echo "Tried to build and test inside '${dir}', but it is an invalid path." + exit 1 + fi + + pushd ${dir} + echo ":: Building '${PWD}'..." + cargo build --verbose + + echo ":: Running unit tests in '${PWD}'..." + cargo test --verbose + popd +} + +build_and_test $LIB_DIR +build_and_test $MACROS_DIR + +for file in ${EXAMPLES_DIR}/*; do + echo "${file}" + if [ -d "${file}" ]; then + build_and_test "${file}" + fi +done