|
|
@ -2,7 +2,7 @@ version: 2 |
|
|
jobs: |
|
|
jobs: |
|
|
build: |
|
|
build: |
|
|
docker: |
|
|
docker: |
|
|
- image: circleci/python:latest |
|
|
|
|
|
|
|
|
- image: circleci/python:3.8 |
|
|
working_directory: ~/repo |
|
|
working_directory: ~/repo |
|
|
steps: |
|
|
steps: |
|
|
- checkout |
|
|
- checkout |
|
|
@ -25,7 +25,7 @@ jobs: |
|
|
|
|
|
|
|
|
test: |
|
|
test: |
|
|
docker: |
|
|
docker: |
|
|
- image: circleci/python:latest |
|
|
|
|
|
|
|
|
- image: circleci/python:3.8 |
|
|
- image: circleci/postgres:9.6.2-alpine |
|
|
- image: circleci/postgres:9.6.2-alpine |
|
|
environment: |
|
|
environment: |
|
|
POSTGRES_USER: myUser |
|
|
POSTGRES_USER: myUser |
|
|
@ -75,15 +75,14 @@ jobs: |
|
|
- run: |
|
|
- run: |
|
|
name: Heroku deploy |
|
|
name: Heroku deploy |
|
|
command: | |
|
|
command: | |
|
|
git config --global push.default matching |
|
|
|
|
|
git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git main |
|
|
|
|
|
|
|
|
git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD:main |
|
|
- run: |
|
|
- run: |
|
|
name: Smoke test |
|
|
name: Smoke test |
|
|
command: | |
|
|
command: | |
|
|
|
|
|
HTTPCODE=`curl -s -o /dev/null -w "%{http_code}" https://devops-project-back.herokuapp.com/api/articles` |
|
|
if [[ "$HTTPCODE" -ne 200 ]]; then |
|
|
if [[ "$HTTPCODE" -ne 200 ]]; then |
|
|
echo "heroku app not responding, failing deploy" \ |
|
|
echo "heroku app not responding, failing deploy" \ |
|
|
exit 1 \ |
|
|
|
|
|
HTTPCODE=`curl -s -o /dev/null -w "%{http_code}" https://$HEROKU_APP_NAME.herokuapp.com/` |
|
|
|
|
|
|
|
|
exit 1; \ |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
docker-build-and-push: |
|
|
docker-build-and-push: |
|
|
|