.travis.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. sudo: false
  2. language: rust
  3. rust:
  4. - beta
  5. - nightly
  6. - stable
  7. cache: cargo
  8. matrix:
  9. allow_failures:
  10. - rust: nightly
  11. before_install:
  12. - |
  13. c=$(git diff $(git merge-base master $TRAVIS_COMMIT)..$TRAVIS_COMMIT --name-only | cut -d "/" -f 1 | uniq)
  14. if [[ "$c" == "doc" ]]; then
  15. echo "Only changes in DOC, exiting 0"
  16. exit 0
  17. else
  18. echo "Changes in other directories than ./doc"
  19. echo "continue build..."
  20. fi
  21. before_script:
  22. - |
  23. pip install 'travis-cargo<0.2' --user &&
  24. export PATH=$HOME/.local/bin:$PATH
  25. script:
  26. - |
  27. travis_cargo_run_in() {
  28. echo ":: Trying to run cargo in $1"
  29. [[ -d "$1" ]] &&
  30. cd "$1" &&
  31. {
  32. travis-cargo build &&
  33. travis-cargo test &&
  34. travis-cargo bench &&
  35. travis-cargo --only stable doc &&
  36. cd -
  37. } || exit 1
  38. }
  39. run_sh_test() {
  40. echo "--- Running test script: '$1'"
  41. bash $1 || { echo "--- Test failed. Exiting"; exit 1; }
  42. echo "--- Test script $1 executed successfully"
  43. }
  44. echo "<< Changes in ./doc are not build by CI >>"
  45. for d in $(find -name "Cargo.toml" | grep -vE "^./Cargo.toml$"); do
  46. echo ":: Working on $d"
  47. dir=$(dirname $d)
  48. { \
  49. echo -e "\n--- Running in $d ---\n" && \
  50. travis_cargo_run_in $dir && \
  51. tree -I "*doc*" $dir && \
  52. echo "--- Running test scripts ---" && \
  53. for testsh in $(find $dir -iname "*test.sh"); do
  54. run_sh_test $testsh
  55. done && \
  56. echo -e "--- Done with test scripts ---\n\n"
  57. } || true
  58. done
  59. addons:
  60. apt:
  61. packages:
  62. - libcurl4-openssl-dev
  63. - libelf-dev
  64. - libdw-dev
  65. - tree
  66. after_success:
  67. - travis-cargo --only stable doc-upload
  68. notifications:
  69. email:
  70. on_success: never
  71. env:
  72. global:
  73. - TRAVIS_CARGO_NIGHTLY_FEATURE=dev