|
|
|
@ -23,8 +23,8 @@ jobs: |
|
|
|
# Download and cache dependencies |
|
|
|
- restore_cache: |
|
|
|
keys: |
|
|
|
- v2-dependencies-{{ checksum "requirements/dev.txt" }} |
|
|
|
- v2-dependencies- |
|
|
|
- v3-dependencies-{{ checksum "requirements/dev.txt" }} |
|
|
|
- v3-dependencies- |
|
|
|
# fallback to using the latest cache if no exact match is found |
|
|
|
|
|
|
|
- run: |
|
|
|
@ -41,7 +41,7 @@ jobs: |
|
|
|
- save_cache: |
|
|
|
paths: |
|
|
|
- venv |
|
|
|
key: v2-dependencies-{{ checksum "requirements/dev.txt" }} |
|
|
|
key: v3-dependencies-{{ checksum "requirements/dev.txt" }} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -67,18 +67,16 @@ jobs: |
|
|
|
# Download and cache dependencies |
|
|
|
- restore_cache: |
|
|
|
keys: |
|
|
|
- v2-dependencies-{{ checksum "requirements/dev.txt" }} |
|
|
|
- v2-dependencies- |
|
|
|
- v3-dependencies-{{ checksum "requirements/dev.txt" }} |
|
|
|
- v3-dependencies- |
|
|
|
# fallback to using the latest cache if no exact match is found |
|
|
|
|
|
|
|
- run: |
|
|
|
name: db migrate |
|
|
|
name: bd upgrade |
|
|
|
command: | |
|
|
|
. venv/bin/activate |
|
|
|
sleep 1 |
|
|
|
flask db upgrade |
|
|
|
sleep 1 |
|
|
|
flask db migrate |
|
|
|
environment: |
|
|
|
CONDUIT_SECRET: 'something-really-secret' |
|
|
|
FLASK_APP: /home/circleci/repo/autoapp.py |
|
|
|
@ -93,42 +91,40 @@ jobs: |
|
|
|
# other common Python testing frameworks include pytest and nose |
|
|
|
# https://pytest.org |
|
|
|
# https://nose.readthedocs.io |
|
|
|
# - run: |
|
|
|
# name: run tests |
|
|
|
# environment: |
|
|
|
# CONDUIT_SECRET: 'something-really-secret' |
|
|
|
# FLASK_APP: /home/circleci/repo/autoapp.py |
|
|
|
# FLASK_DEBUG: 1 |
|
|
|
# DATABASE_URL: postgresql://myUsr:somePwd@localhost:5432/myUsr |
|
|
|
# command: | |
|
|
|
# . venv/bin/activate |
|
|
|
# sleep 1 |
|
|
|
# flask test |
|
|
|
- run: |
|
|
|
name: run tests |
|
|
|
command: | |
|
|
|
. venv/bin/activate |
|
|
|
flask test |
|
|
|
environment: |
|
|
|
CONDUIT_SECRET: 'something-really-secret' |
|
|
|
FLASK_APP: /home/circleci/repo/autoapp.py |
|
|
|
FLASK_DEBUG: 1 |
|
|
|
DATABASE_URL: postgresql://myUsr:somePwd@localhost:5432/myUsr |
|
|
|
|
|
|
|
- save_cache: |
|
|
|
paths: |
|
|
|
- venv |
|
|
|
key: v2-dependencies-{{ checksum "requirements/dev.txt" }} |
|
|
|
key: v3-dependencies-{{ checksum "requirements/dev.txt" }} |
|
|
|
|
|
|
|
back-deploy-heroku: |
|
|
|
docker: |
|
|
|
- image: buildpack-deps:trusty |
|
|
|
steps: |
|
|
|
- checkout |
|
|
|
|
|
|
|
- run: |
|
|
|
name: Heroku Deploy (main) |
|
|
|
command: | |
|
|
|
echo $HEROKU_APP_NAME |
|
|
|
git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git main |
|
|
|
name: Heroku Deploy |
|
|
|
command: git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git main |
|
|
|
|
|
|
|
- run: |
|
|
|
name: Smoke Test |
|
|
|
environment: |
|
|
|
HEROKU_APP_NAME: devops-final-back-2020-2021 |
|
|
|
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 deploy" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
if [ "$HTTPCODE" -ne 200 ]; then |
|
|
|
echo "heroku app not responding, failing deploy" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
workflows: |
|
|
|
version: 2 |
|
|
|
build-back-deploy: |
|
|
|
|