diff --git a/.circleci/config.yml b/.circleci/config.yml index 818397f..49ab70f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -77,6 +77,9 @@ jobs: - run: name: Heroku Deploy command: git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD:main + - run: + name: Smoke test + command: ./testbackend.sh buildandpush_dockerhub: docker: - image: docker:17.05.0-ce-git diff --git a/testbackend.sh b/testbackend.sh new file mode 100644 index 0000000..5febb34 --- /dev/null +++ b/testbackend.sh @@ -0,0 +1,5 @@ +HTTPCODE=$(echo `curl -s -o /dev/null -w "%{http_code}" https://$HEROKU_APP_NAME.herokuapp.com/api/articles` | tr -d ' ') +if [ "$HTTPCODE" -ne 200 ];then + echo "heroku app not responding, failing deploy" + exit 1 +fi \ No newline at end of file