Created
October 1, 2021 14:19
-
-
Save jaredh159/634285e52456fefc9f04fb2b4bd3af28 to your computer and use it in GitHub Desktop.
wait for macOS postgres to start in github action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: start postgres | |
run: | | |
brew services start postgresql | |
echo "Check PostgreSQL service is running" | |
i=20 | |
COMMAND='pg_isready' | |
while [ $i -gt 0 ]; do | |
echo "Check PostgreSQL service status" | |
eval $COMMAND && break | |
((i--)) | |
if [ $i == 0 ]; then | |
echo "PostgreSQL service not ready, all attempts exhausted" | |
exit 1 | |
fi | |
echo "PostgreSQL service not ready, wait 3 more sec, attempts left: $i" | |
sleep 3 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment