Skip to content

Instantly share code, notes, and snippets.

@maks
Forked from miquelbeltran/pre-push
Last active October 22, 2020 10:41
Show Gist options
  • Save maks/edb25da8706cb04f45ebfdd278d91791 to your computer and use it in GitHub Desktop.
Save maks/edb25da8706cb04f45ebfdd278d91791 to your computer and use it in GitHub Desktop.
Flutter pre-push hook that runs analyze and test
#!/bin/sh
# To use add to `.git/hooks/`
# Should be named `pre-push`
# Make executable with `chmod +x`
# ref: https://gist.github.com/maks/edb25da8706cb04f45ebfdd278d91791
# run Flutter analyze + test
flutter analyze
if [ $? -ne 0 ]; then
echo 'cannot push: Flutter analyze failed'
exit 1
fi
flutter test
if [ $? -ne 0 ]; then
echo 'cannot push: Flutter tests failed'
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment