|
|
|
@ -3,6 +3,16 @@ jobs: |
|
|
|
build: |
|
|
|
docker: |
|
|
|
- image: circleci/python:3.9-buster-node-browsers |
|
|
|
environment: |
|
|
|
DATABASE_URL: postgresql://myUsr:somePwd@localhost:5432/psdb |
|
|
|
FLASK_APP: autoapp.py |
|
|
|
CONDUIT_SECRET: 'something-really-secret' |
|
|
|
FLASK_DEBUG: 1 |
|
|
|
- image: circleci/postgres:9.6.2-alpine |
|
|
|
environment: |
|
|
|
POSTGRES_USER: myUsr |
|
|
|
POSTGRES_DB: psdb |
|
|
|
POSTGRES_PASSWORD: somePwd |
|
|
|
steps: |
|
|
|
- checkout |
|
|
|
- restore_cache: |
|
|
|
@ -47,10 +57,10 @@ jobs: |
|
|
|
command: . venv/bin/activate |
|
|
|
- run: |
|
|
|
name: Launching upgrade |
|
|
|
command: flask db upgrade |
|
|
|
command: python -m flask db upgrade |
|
|
|
- run: |
|
|
|
name: Launching tests |
|
|
|
command: flask test |
|
|
|
command: python -m flask test |
|
|
|
|
|
|
|
deploy-heroku: |
|
|
|
docker: |
|
|
|
@ -64,12 +74,11 @@ jobs: |
|
|
|
name: Deploy main to heroku |
|
|
|
command: git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git main |
|
|
|
|
|
|
|
- run: |
|
|
|
name: Smoke test |
|
|
|
command: HTTPCODE=`curl -s -o /dev/null -w "%{http_code}" https://$HEROKU_APP_NAME.herokuapp.com/api/articles` |
|
|
|
|
|
|
|
- run: |
|
|
|
name: Smoke test check |
|
|
|
command: if [[ "$HTTPCODE" -ne 200 ]];then |
|
|
|
command: HTTPCODE=`curl -s -o /dev/null -w "%{http_code}" https://$HEROKU_APP_NAME.herokuapp.com/api/articles` |
|
|
|
if [[ "$HTTPCODE" -ne 200 ]];then |
|
|
|
echo "heroku app not responding, failing to deploy" && exit 1; |
|
|
|
fi |
|
|
|
docker-build-push: |
|
|
|
@ -102,17 +111,14 @@ workflows: |
|
|
|
build_test_deploy: |
|
|
|
jobs: |
|
|
|
- build |
|
|
|
- test: |
|
|
|
requires: |
|
|
|
- build |
|
|
|
# - test: |
|
|
|
# requires: |
|
|
|
# - build |
|
|
|
- deploy-heroku: |
|
|
|
context: Heroku-tp-final |
|
|
|
requires: |
|
|
|
- build |
|
|
|
# - test |
|
|
|
|
|
|
|
- docker-build-push: |
|
|
|
context: Docker-tp-final |
|
|
|
requires: |
|
|
|
- build |
|
|
|
# - test |