Yield generated for 7ed5cae2-a0ee-453b-8bf7-a5da09ebe6cb
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

79 lines
2.1 KiB

version: 2.1
jobs:
build:
docker:
- image: circleci/python:3.7.4
steps:
- checkout
- run: echo "$CONDUIT_SECRET $FLASK_APP $FLASK_DEBUG"
- run:
name: install pyth dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip3 install -r requirements/dev.txt
- save_cache:
paths:
- ./venv
key: v2-dependencies-{{ checksum "requirements/dev.txt" }}
initialise:
docker:
- image: circleci/python:3.7.4
environment:
DATABASE_URL: postgresql://myuser:somePwd@localhost:5432/myuser
- image: circleci/postgres:9.6.5
environment:
POSTGRES_DB: myuser
POSTGRES_USER: myuser
POSTGRES_PASSWORD: somePwd
steps:
- checkout
- restore_cache:
keys:
- v2-dependencies-{{ checksum "requirements/dev.txt" }}
- v2-dependencies-
- run:
name: flask upgrade
command: |
. venv/bin/activate
sleep 1
flask db upgrade
export CONDUIT_SECRET='something-really-secret'
export FLASK_APP=autoapp.py
export FLASK_DEBUG=1
- run:
name: flask test
command: |
. venv/bin/activate
sleep 1
flask test
back-deploy-heroku:
docker:
- image: buildpack-deps:trusty
steps:
- checkout
- run:
name: Heroku Deploy
command: git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git master
- 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.1
build_circleci:
jobs:
- build
- initialise:
requires:
- build
- back-deploy-heroku:
requires:
- docker-build-and-push