.travis-build.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. set -e
  3. set -x
  4. if grep -nr '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .travis* dist/*.desktop \
  5. dist/*.svg dist/*.xml; then
  6. echo Trailing whitespace found, aborting
  7. exit 1
  8. fi
  9. # Only run clang-format on Linux because we don't have 4.0 on OS X images
  10. if [ "$TRAVIS_OS_NAME" = "linux" ]; then
  11. # Default clang-format points to default 3.5 version one
  12. CLANG_FORMAT=clang-format-3.9
  13. $CLANG_FORMAT --version
  14. if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
  15. # Get list of every file modified in this pull request
  16. files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' || true)"
  17. else
  18. # Check everything for branch pushes
  19. files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')"
  20. fi
  21. # Turn off tracing for this because it's too verbose
  22. set +x
  23. for f in $files_to_lint; do
  24. d=$(diff -u "$f" <($CLANG_FORMAT "$f") || true)
  25. if ! [ -z "$d" ]; then
  26. echo "!!! $f not compliant to coding style, here is the fix:"
  27. echo "$d"
  28. fail=1
  29. fi
  30. done
  31. set -x
  32. if [ "$fail" = 1 ]; then
  33. exit 1
  34. fi
  35. fi
  36. #if OS is linux or is not set
  37. if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then
  38. docker run -v $(pwd):/citra ubuntu:16.04 /bin/bash /citra/.travis-build-docker.sh
  39. elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
  40. set -o pipefail
  41. export MACOSX_DEPLOYMENT_TARGET=10.9
  42. export Qt5_DIR=$(brew --prefix)/opt/qt5
  43. mkdir build && cd build
  44. cmake .. -GXcode
  45. xcodebuild -configuration Release
  46. ctest -VV -C Release
  47. fi