2 changed files with 30 additions and 42 deletions
@ -1,79 +1,67 @@ |
|||||
version: 2.1 |
|
||||
|
version: 2 |
||||
jobs: |
jobs: |
||||
build: |
build: |
||||
docker: |
docker: |
||||
- image: circleci/python:3.7.4 |
- image: circleci/python:3.7.4 |
||||
steps: |
steps: |
||||
- checkout |
- checkout |
||||
- run: echo "$CONDUIT_SECRET $FLASK_APP $FLASK_DEBUG" |
|
||||
- run: |
- run: |
||||
name: install pyth dependencies |
name: install pyth dependencies |
||||
command: | |
command: | |
||||
python3 -m venv venv |
python3 -m venv venv |
||||
. venv/bin/activate |
. venv/bin/activate |
||||
pip3 install -r requirements/dev.txt |
|
||||
|
pip install -r requirements/dev.txt |
||||
- save_cache: |
- save_cache: |
||||
paths: |
paths: |
||||
- ./venv |
- ./venv |
||||
key: v2-dependencies-{{ checksum "requirements/dev.txt" }} |
|
||||
|
key: v3-dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/prod.txt" }} |
||||
initialise: |
initialise: |
||||
docker: |
docker: |
||||
- image: circleci/python:3.7.4 |
- image: circleci/python:3.7.4 |
||||
environment: |
environment: |
||||
DATABASE_URL: postgresql://myuser:somePwd@localhost:5432/myuser |
|
||||
|
DATABASE_URL: postgresql://myuser:somePwd@localhost:5432/mydb |
||||
- image: circleci/postgres:9.6.5 |
- image: circleci/postgres:9.6.5 |
||||
environment: |
environment: |
||||
POSTGRES_DB: myuser |
|
||||
|
POSTGRES_DB: mydb |
||||
POSTGRES_USER: myuser |
POSTGRES_USER: myuser |
||||
POSTGRES_PASSWORD: somePwd |
POSTGRES_PASSWORD: somePwd |
||||
steps: |
steps: |
||||
- checkout |
- checkout |
||||
- restore_cache: |
- restore_cache: |
||||
keys: |
keys: |
||||
- v2-dependencies-{{ checksum "requirements/dev.txt" }} |
|
||||
- v2-dependencies- |
|
||||
|
- v3-dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/prod.txt" }} |
||||
|
- v3-dependencies- |
||||
- run: |
- run: |
||||
name: flask upgrade |
name: flask upgrade |
||||
command: | |
command: | |
||||
. venv/bin/activate |
. venv/bin/activate |
||||
sleep 1 |
sleep 1 |
||||
flask db upgrade |
flask db upgrade |
||||
export CONDUIT_SECRET='something-really-secret' |
|
||||
export FLASK_APP=autoapp.py |
|
||||
export FLASK_DEBUG=1 |
|
||||
|
|
||||
|
environment: |
||||
|
CONDUIT_SECRET: 'something-really-secret' |
||||
|
FLASK_APP: /home/circleci/repo/autoapp.py |
||||
|
DATABASE_URL: postgresql://myUser:somePwd@localhost:5432/mydb |
||||
|
FLASK_DEBUG: 1 |
||||
|
POSTGRES_USER: myUser |
||||
|
POSTGRES_DB: mydb |
||||
|
POSTGRES_PASSWORD: somePwd |
||||
|
POSTGRES_PORT: 5432 |
||||
- run: |
- run: |
||||
name: flask test |
name: flask test |
||||
command: | |
command: | |
||||
. venv/bin/activate |
. venv/bin/activate |
||||
sleep 1 |
sleep 1 |
||||
flask test |
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 |
|
||||
|
environment: |
||||
|
CONDUIT_SECRET: 'something-really-secret' |
||||
|
FLASK_APP: /home/circleci/repo/autoapp.py |
||||
|
DATABASE_URL: postgresql://myUser:somePwd@localhost:5432/mydb |
||||
|
FLASK_DEBUG: 1 |
||||
|
POSTGRES_USER: myUser |
||||
|
POSTGRES_DB: mydb |
||||
|
POSTGRES_PASSWORD: somePwd |
||||
|
POSTGRES_PORT: 5432 |
||||
|
- save_cache: |
||||
|
paths: |
||||
|
- ./venv |
||||
|
key: v3-dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/prod.txt" }} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue