2021-07-06 11:56:56 +00:00
|
|
|
#!/usr/bin/env bash
|
2021-07-08 06:14:03 +00:00
|
|
|
|
2022-07-25 16:20:55 +00:00
|
|
|
YELLOW="\e[93m"
|
|
|
|
GREEN="\e[32m"
|
|
|
|
RED="\e[31m"
|
|
|
|
ENDCOLOR="\e[0m"
|
|
|
|
|
|
|
|
printMessage() {
|
|
|
|
printf "${YELLOW}AppFlowy : $1${ENDCOLOR}\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
printSuccess() {
|
|
|
|
printf "${GREEN}AppFlowy : $1${ENDCOLOR}\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
printError() {
|
|
|
|
printf "${RED}AppFlowy : $1${ENDCOLOR}\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
printMessage "Running local AppFlowy pre-push hook."
|
2022-07-17 20:54:49 +00:00
|
|
|
|
2021-07-06 11:56:56 +00:00
|
|
|
if [[ `git status --porcelain` ]]; then
|
2022-07-25 16:20:55 +00:00
|
|
|
printError "This script needs to run against committed code only. Please commit or stash you changes."
|
2021-07-06 11:56:56 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2022-07-17 20:54:49 +00:00
|
|
|
|
2022-07-25 16:20:55 +00:00
|
|
|
printMessage "Running the Flutter analyzer"
|
2021-07-06 11:56:56 +00:00
|
|
|
flutter analyze
|
2022-07-17 20:54:49 +00:00
|
|
|
|
2021-07-06 11:56:56 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
2022-07-25 16:20:55 +00:00
|
|
|
printError "Flutter analyzer error"
|
2021-07-06 11:56:56 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2022-07-17 20:54:49 +00:00
|
|
|
|
2022-07-25 16:20:55 +00:00
|
|
|
printMessage "Finished running the Flutter analyzer"
|
|
|
|
|
2021-07-06 11:56:56 +00:00
|
|
|
|
2022-07-25 16:20:55 +00:00
|
|
|
#printMessage "Running unit tests"
|
2021-07-06 11:56:56 +00:00
|
|
|
#flutter test
|
|
|
|
#if [ $? -ne 0 ]; then
|
|
|
|
# printf "\e[31;1m%s\e[0m\n" 'Unit tests error'
|
|
|
|
# exit 1
|
|
|
|
#fi
|
|
|
|
#printf "\e[33;1m%s\e[0m\n" 'Finished running unit tests'
|