|
|
|
@ -93,28 +93,48 @@ 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 |
|
|
|
# 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 |
|
|
|
|
|
|
|
- save_cache: |
|
|
|
paths: |
|
|
|
- venv |
|
|
|
key: v2-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 |
|
|
|
- run: |
|
|
|
name: Smoke Test |
|
|
|
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 |
|
|
|
workflows: |
|
|
|
version: 2 |
|
|
|
build-back: |
|
|
|
build-back-deploy: |
|
|
|
jobs: |
|
|
|
- build |
|
|
|
- test: |
|
|
|
requires: |
|
|
|
- build |
|
|
|
- back-deploy-heroku: |
|
|
|
requires: |
|
|
|
- build |