pre-push 875 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env bash
  2. YELLOW="\e[93m"
  3. GREEN="\e[32m"
  4. RED="\e[31m"
  5. ENDCOLOR="\e[0m"
  6. printMessage() {
  7. printf "${YELLOW}AppFlowy : $1${ENDCOLOR}\n"
  8. }
  9. printSuccess() {
  10. printf "${GREEN}AppFlowy : $1${ENDCOLOR}\n"
  11. }
  12. printError() {
  13. printf "${RED}AppFlowy : $1${ENDCOLOR}\n"
  14. }
  15. printMessage "Running local AppFlowy pre-push hook."
  16. if [[ `git status --porcelain` ]]; then
  17. printError "This script needs to run against committed code only. Please commit or stash you changes."
  18. exit 1
  19. fi
  20. printMessage "Running the Flutter analyzer"
  21. flutter analyze
  22. if [ $? -ne 0 ]; then
  23. printError "Flutter analyzer error"
  24. exit 1
  25. fi
  26. printMessage "Finished running the Flutter analyzer"
  27. #printMessage "Running unit tests"
  28. #flutter test
  29. #if [ $? -ne 0 ]; then
  30. # printf "\e[31;1m%s\e[0m\n" 'Unit tests error'
  31. # exit 1
  32. #fi
  33. #printf "\e[33;1m%s\e[0m\n" 'Finished running unit tests'