diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-01-31 18:04:01 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-02-09 13:48:14 +0100 |
commit | 756bd09a831480f753367a2dcf4985a8750a1e80 (patch) | |
tree | c533dacbb664a28cd8ca797a841d0a6f1a183409 /.travis.yml | |
parent | 7a403c7f93ebaddcfd9f38c7d3ca1ac1014b23cf (diff) |
Integrate tests in travis.yml
The tests work only if I call "tree".
Really, how fucked up is travis actually?
Diffstat (limited to '.travis.yml')
-rw-r--r-- | .travis.yml | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml index fd3a6f6e..5722fe1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ matrix: before_install: - | - c=$(git diff $TRAVIS_BRANCH..$TRAVIS_COMMIT --name-only | cut -d "/" -f 1 | uniq) + c=$(git diff $(git merge-base master $TRAVIS_COMMIT)..$TRAVIS_COMMIT --name-only | cut -d "/" -f 1 | uniq) if [[ "$c" == "doc" ]]; then echo "Only changes in DOC, exiting 0" exit 0 @@ -28,12 +28,13 @@ before_script: script: - | changes_in() { - [[ $(git diff --name-only $TRAVIS_BRANCH..$TRAVIS_COMMIT | \ + [[ $(git diff --name-only $(git merge-base master $TRAVIS_COMMIT)..$TRAVIS_COMMIT | \ cut -d "/" -f 1 | \ grep "$n") ]] > /dev/null } travis_cargo_run_in() { + echo ":: Trying to run cargo in $1" [[ -d "$1" ]] && cd "$1" && { @@ -45,14 +46,27 @@ script: } || exit 1 } + run_sh_test() { + echo "-- Running test script: $1" + bash $1 || { echo "-- Test failed. Exiting"; exit 1; } + echo "-- Test script $1 executed successfully" + } + [[ $(changes_in "doc") ]] && echo "Changes in ./doc are not build by CI" - for d in $(find -name "Cargo.toml" | grep -vE "^.$"); do + for d in $(find -name "Cargo.toml" | grep -vE "^./Cargo.toml$"); do + echo ":: Working on $d" dir=$(dirname $d) - { - changes_in $dir && \ - echo -e "\nRunning in $d\n" && \ - travis_cargo_run_in $dir + { \ + changes_in $dir && \ + echo -e "\nRunning in $d\n" && \ + travis_cargo_run_in $dir && \ + tree -I "*doc*" $dir && \ + echo "-- Running test scripts..." && \ + for testsh in $(find $dir -iname "*test.sh"); do + run_sh_test $testsh + done && \ + echo "-- Done with test scripts..." } || true done @@ -62,6 +76,7 @@ addons: - libcurl4-openssl-dev - libelf-dev - libdw-dev + - tree after_success: - travis-cargo --only stable doc-upload |