clone_and_test.sh 950 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env bash
  2. # get travis env
  3. echo "TRAVIS_EVENT_TYPE: ${TRAVIS_EVENT_TYPE}"
  4. echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}"
  5. echo "TRAVIS_PULL_REQUEST_SLUG: ${TRAVIS_PULL_REQUEST_SLUG}"
  6. echo "TRAVIS_PULL_REQUEST_BRANCH: ${TRAVIS_PULL_REQUEST_BRANCH}"
  7. # set default variable if not in env
  8. if [ -z ${TRAVIS_EVENT_TYPE} ]; then
  9. TRAVIS_EVENT_TYPE="push";
  10. echo "TRAVIS_EVENT_TYPE set to push";
  11. fi
  12. if [ -z ${TRAVIS_BRANCH} ]; then
  13. TRAVIS_BRANCH="master";
  14. echo "TRAVIS_BRANCH set to master";
  15. fi
  16. # check if this is a pull request or a push
  17. if [ ${TRAVIS_EVENT_TYPE} == "pull_request" ]; then
  18. git clone https://github.com/${TRAVIS_PULL_REQUEST_SLUG} kalliope;
  19. cd kalliope;
  20. git checkout ${TRAVIS_PULL_REQUEST_BRANCH};
  21. else
  22. # it's a push
  23. git clone https://github.com/kalliope-project/kalliope.git kalliope;
  24. cd kalliope;
  25. git checkout ${TRAVIS_BRANCH};
  26. fi
  27. # install
  28. sudo python setup.py install
  29. # tests
  30. python -m unittest discover